Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 9.1pe
    • Fix Version/s: 9.1pe_dev
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      843
    • Status Whiteboard:
      Hide

      fixed-pwc12

      Show
      fixed-pwc12

      Description

      Repetitive calls to a JSP mean that the static strings within the page are
      subject to repeated encoding as they are written to the client. This is
      impacting our performance.

      We should store the encoded byte array as a static variable within the JSP and
      write out that data to the client.

        Activity

        Hide
        kchung added a comment -

        Good ideas! Unfortunately I have serveral issues when looking into implementing it.

        1) It is necessary to add a non-API mthod such as

        void write(byte[] bytes);

        to both org.apache.jasper.runtime.JspWriterImpl and
        org.apache.coyote.tomcat5.CoyoteWriter classes.

        The first is called from the generated codes, and the second is called from
        the first. Since such a method is non-standard, an explicit cast is needed to
        call such a method. This makes Jasper dependent on catalina. This is bad
        because then Jasper cannot be used by other containers, such as Jetty.

        2) In JSP, outputs for Strings and chars are buffered. If we intermix writing
        chars with writing bytes, then chars cannot be buffered or at least be flushed
        more often. This may have a negative impact on the performance.

        3) Flushing the char buffer to request also means that the request output is
        committed. Doing this early, as we need to do when we output bytes, may change
        the behavior of the application, even the the spec. For instance, redirecting
        to another page is allowed if the output is not committed.

        Show
        kchung added a comment - Good ideas! Unfortunately I have serveral issues when looking into implementing it. 1) It is necessary to add a non-API mthod such as void write(byte[] bytes); to both org.apache.jasper.runtime.JspWriterImpl and org.apache.coyote.tomcat5.CoyoteWriter classes. The first is called from the generated codes, and the second is called from the first. Since such a method is non-standard, an explicit cast is needed to call such a method. This makes Jasper dependent on catalina. This is bad because then Jasper cannot be used by other containers, such as Jetty. 2) In JSP, outputs for Strings and chars are buffered. If we intermix writing chars with writing bytes, then chars cannot be buffered or at least be flushed more often. This may have a negative impact on the performance. 3) Flushing the char buffer to request also means that the request output is committed. Doing this early, as we need to do when we output bytes, may change the behavior of the application, even the the spec. For instance, redirecting to another page is allowed if the output is not committed.
        Hide
        jluehe added a comment -

        Reopening this bug so it can be marked as fixed.

        Show
        jluehe added a comment - Reopening this bug so it can be marked as fixed.
        Hide
        jluehe added a comment -

        If the page is unbuffered, output (to the response writer) the static text in
        bytes, encoded with the current page encoding. The generated codes contains
        logics to detect possible change of response encoding at runtime.

        Also add a compilation options to set the default buffer to "none", if not
        explictly set.

        Modified:

        glassfish/appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/JspC.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/Options.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java
        glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java

        File [changed]: EmbeddedServletOptions.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java?r1=1.14&r2=1.15

        File [changed]: JspC.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/JspC.java?r1=1.34&r2=1.35

        File [changed]: Options.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/Options.java?r1=1.8&r2=1.9

        File [changed]: Compiler.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java?r1=1.24&r2=1.25

        File [changed]: Generator.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java?r1=1.21&r2=1.22

        File [changed]: PageInfo.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java?r1=1.7&r2=1.8

        File [changed]: Validator.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java?r1=1.23&r2=1.24

        File [changed]: JspWriterImpl.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java?r1=1.6&r2=1.7

        File [changed]: PageContextImpl.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java?r1=1.21&r2=1.22

        File [changed]: ServletResponseWrapperInclude.java
        Url:
        https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java?r1=1.5&r2=1.6

        Show
        jluehe added a comment - If the page is unbuffered, output (to the response writer) the static text in bytes, encoded with the current page encoding. The generated codes contains logics to detect possible change of response encoding at runtime. Also add a compilation options to set the default buffer to "none", if not explictly set. Modified: glassfish/appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java glassfish/appserv-webtier/src/java/org/apache/jasper/JspC.java glassfish/appserv-webtier/src/java/org/apache/jasper/Options.java glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java File [changed] : EmbeddedServletOptions.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java?r1=1.14&r2=1.15 File [changed] : JspC.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/JspC.java?r1=1.34&r2=1.35 File [changed] : Options.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/Options.java?r1=1.8&r2=1.9 File [changed] : Compiler.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java?r1=1.24&r2=1.25 File [changed] : Generator.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java?r1=1.21&r2=1.22 File [changed] : PageInfo.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java?r1=1.7&r2=1.8 File [changed] : Validator.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java?r1=1.23&r2=1.24 File [changed] : JspWriterImpl.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java?r1=1.6&r2=1.7 File [changed] : PageContextImpl.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java?r1=1.21&r2=1.22 File [changed] : ServletResponseWrapperInclude.java Url: https://glassfish.dev.java.net/source/browse/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java?r1=1.5&r2=1.6
        Hide
        kmeduri added a comment -

        Merged the fix to PWC12Dev_Branch

        Show
        kmeduri added a comment - Merged the fix to PWC12Dev_Branch
        Hide
        kmeduri added a comment -

        Merged the fix to PWC12Dev_Branch:

        Checking in
        appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java,v
        <-- Compiler.java
        new revision: 1.22.6.3; previous revision: 1.22.6.2
        done
        Checking in
        appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java,v

        <-- Generator.java
        new revision: 1.17.6.2; previous revision: 1.17.6.1
        done
        Checking in
        appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java,v
        <-- PageInfo.java
        new revision: 1.6.10.2; previous revision: 1.6.10.1
        done
        Checking in
        appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java,v

        <-- Validator.java
        new revision: 1.21.10.2; previous revision: 1.21.10.1
        done
        Checking in
        appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java,v

        <-- EmbeddedServletOptions.java
        new revision: 1.13.6.2; previous revision: 1.13.6.1
        done
        Checking in appserv-webtier/src/java/org/apache/jasper/JspC.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/JspC.java,v
        <-- JspC.java
        new revision: 1.28.6.3; previous revision: 1.28.6.2
        done
        Checking in appserv-webtier/src/java/org/apache/jasper/Options.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/Options.java,v
        <-- Options.java
        new revision: 1.8.6.1; previous revision: 1.8
        done
        Checking in
        appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java,v

        <-- JspWriterImpl.java
        new revision: 1.4.6.3; previous revision: 1.4.6.2
        done
        Checking in
        appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java;
        /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java,v

        <-- PageContextImpl.java
        new revision: 1.16.6.3; previous revision: 1.16.6.2
        done

        Show
        kmeduri added a comment - Merged the fix to PWC12Dev_Branch: Checking in appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Compiler.java,v <-- Compiler.java new revision: 1.22.6.3; previous revision: 1.22.6.2 done Checking in appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Generator.java,v <-- Generator.java new revision: 1.17.6.2; previous revision: 1.17.6.1 done Checking in appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/PageInfo.java,v <-- PageInfo.java new revision: 1.6.10.2; previous revision: 1.6.10.1 done Checking in appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/compiler/Validator.java,v <-- Validator.java new revision: 1.21.10.2; previous revision: 1.21.10.1 done Checking in appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/EmbeddedServletOptions.java,v <-- EmbeddedServletOptions.java new revision: 1.13.6.2; previous revision: 1.13.6.1 done Checking in appserv-webtier/src/java/org/apache/jasper/JspC.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/JspC.java,v <-- JspC.java new revision: 1.28.6.3; previous revision: 1.28.6.2 done Checking in appserv-webtier/src/java/org/apache/jasper/Options.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/Options.java,v <-- Options.java new revision: 1.8.6.1; previous revision: 1.8 done Checking in appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/JspWriterImpl.java,v <-- JspWriterImpl.java new revision: 1.4.6.3; previous revision: 1.4.6.2 done Checking in appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java; /cvs/glassfish/appserv-webtier/src/java/org/apache/jasper/runtime/PageContextImpl.java,v <-- PageContextImpl.java new revision: 1.16.6.3; previous revision: 1.16.6.2 done

          People

          • Assignee:
            kchung
            Reporter:
            Scott Oaks
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: