Uploaded image for project: 'Tiles'
  1. Tiles
  2. TILES-522

Performance of TemplateAttributeRender in Tomcat

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.2.2
    • None
    • tiles-core
    • Java6, Java7, Tomcat6

    • Patch

    Description

      TeamplateAttributeRender.write(..) boils down to using JspRuntimeLibrary.include(..)

      In Tomcat-6 this involves wrapping the request and response (a number of times?) and going through security checks (again and again and again...).

      At FINN.no we're getting scores of requests per second per jvm and seeing this method becoming a bottleneck, mainly due to thread contention in the security checks.

      The method can be sped up by calling, if possible, requestDispatcher.include(..)

      For example we have overridden TemplateAttributeRender like

      public void write(
      final Object template,
      final Attribute attribute,
      final TilesRequestContext request) throws IOException {

      if(request instanceof JspTilesRequestContext && template instanceof String){
      try

      { ((JspTilesRequestContext) request) .getPageContext() .getServletContext() .getRequestDispatcher((String)template) .include((ServletRequest) request.getRequest(), (ServletResponse) request.getResponse()); }

      catch (ServletException ex)

      { throw new TilesIOException(ex); }

      }else

      { super.write(template, attribute, request); }

      }

      I doubt that this is an appropriate patch to apply, it hides superclass functionality, but maybe there is a better place to apply it?

      Attachments

        1. TILES-522.patch
          0.9 kB
          Michael Semb Wever

        Activity

          People

            Unassigned Unassigned
            mck Michael Semb Wever
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: