You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alexander Skwar <al...@skwar.name> on 2010/03/09 10:25:37 UTC

No gain after pre-compilation

Hello.

In the Tomcat 6.0 Jasper documentation at
<http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html#Production%20Configuration>
or <http://LNK.by/c2H2>, I read that the most performance gain can be
achieved by pre-compiling the JSPs. Because of that, I simply gave that
a try and can't find much of a gain at all.

I used Ant 1.8.0 with Java 1.6.0_18 and the build.xml script at
http://pastebin.ca/1828486
We're doing around the clock "performance measurements", where some
Watir based script runs a browser and calls pre-defined pages and tasks
in the web app. We measure, how long this takes. Please see
http://goo.gl/cokf for a graph showing this. "Yesterday", at about 16:00,
I installed the pre-compiled web app. There's no (visible) change in the
measurements to be found.

Did I do something wrong? Was the build.xml not good (enough)? I invoked
it with:

   tomcat_home=/usr/share/tomcat
   webapp_path=/var/webapp
   ant "-Dtomcat.home=$tomcat_home" "-Dwebapp.path=$webapp_path"

Or is it just, that this shows, that our web app doesn't have a bottleneck
in the "JSP land" (which would be a true statement - it communicates
with some background databases and apps, which might not be the
fastest...)?

One thing which confuses me a bit though, is that when I call the web
app for the first time (after deployment or after having re-started Tomcat),
the web app is "slow". Ie. I go to http://server:8080/webapp and wait for
like 10 seconds until the login screen of the web app is shown. This
wait only happens for the very first time after deployment. When I do
this again a few minutes/hours later, http://server:8080/webapp is shown
right away.

Shouldn't pre-compilation also make this first time wait go away?

Thanks a lot,

Alexander

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: No gain after pre-compilation

Posted by Markus Schönhaber <to...@list-post.mks-mail.de>.
09.03.2010 13:25, Markus Schönhaber:

> What you could check [...]

Forgot to mention: it might be useful to increase the log-level of
Jasper's Compiler class, i. e. add
org.apache.jasper.compiler.Compiler.level=FINE
to conf/logging.properties
You should then see in Tomcat's logs whether compilation of the accessed
JSP really takes place, if so, how long it took etc.

-- 
Regards
  mks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: No gain after pre-compilation

Posted by Markus Schönhaber <to...@list-post.mks-mail.de>.
09.03.2010 12:43, Alexander Skwar:

> Do you happen to have any idea, why I did not notice any impovements  
> in the 1st time load delay? Ie. why do I still have to wait 10s after  
> having deployed, before the login screen is shown for the first time?
> 
> At this point in time, the web app does not require the background  
> daemons at all. The login page is even shown, when those daemons are  
> down.

No idea.
What you could check (besides taking a look at your application to see
if it really is doing nothing that consumes time) is whether the
pre-compilation did work. In the deployed web-app you should notice a
change in web.xml, since the deployer creates additional servlet and
servlet-mapping entries. I. e. if your web-app contains a hello.jsp you
should see something like

[...]
    <servlet>
        <servlet-name>org.apache.jsp.hello_jsp</servlet-name>
        <servlet-class>org.apache.jsp.hello_jsp</servlet-class>
    </servlet>
[...]
    <servlet-mapping>
        <servlet-name>org.apache.jsp.hello_jsp</servlet-name>
        <url-pattern>/hello.jsp</url-pattern>
    </servlet-mapping>
[..]

in the web.xml generated by the deployer.

-- 
Regards
  mks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: No gain after pre-compilation

Posted by Alexander Skwar <al...@skwar.name>.
Hello!

Thanks a lot for the conformation.

Do you happen to have any idea, why I did not notice any impovements  
in the 1st time load delay? Ie. why do I still have to wait 10s after  
having deployed, before the login screen is shown for the first time?

At this point in time, the web app does not require the background  
daemons at all. The login page is even shown, when those daemons are  
down.

Best regards,

Alexander

Am 09.03.2010 um 10:54 schrieb Markus Schönhaber <tomcat-users@list-post.mks-mail.d 
e>:

> 09.03.2010 10:25, Alexander Skwar:
>
> I didn't look at your build script, just a general remark below.
>
>> Or is it just, that this shows, that our web app doesn't have a  
>> bottleneck
>> in the "JSP land" (which would be a true statement - it communicates
>> with some background databases and apps, which might not be the
>> fastest...)?
>>
>> One thing which confuses me a bit though, is that when I call the web
>> app for the first time (after deployment or after having re-started  
>> Tomcat),
>> the web app is "slow". Ie. I go to http://server:8080/webapp and  
>> wait for
>> like 10 seconds until the login screen of the web app is shown. This
>> wait only happens for the very first time after deployment. When I do
>> this again a few minutes/hours later, http://server:8080/webapp is  
>> shown
>> right away.
>>
>> Shouldn't pre-compilation also make this first time wait go away?
>
> Not "also" - the *only* gain that can be expected by pre-compilation  
> of
> JSPs is the elimination of the first time wait, since Tomcat doesn't
> need to do the compilation on-the-fly when the JSP is accessed for the
> first time. For all following accesses of the JSP it shouldn't matter
> whether or not it was pre-compiled.
> But: a noticeable difference can only be expected if it really is the
> compilation that slows things down on first access. If, OTOH, the vast
> amount of time is taken by, say, creation of DB connections,
> pre-compiling the JSPs won't make much of a difference.
>
> -- 
> Regards
>  mks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: No gain after pre-compilation

Posted by Markus Schönhaber <to...@list-post.mks-mail.de>.
09.03.2010 10:25, Alexander Skwar:

I didn't look at your build script, just a general remark below.

> Or is it just, that this shows, that our web app doesn't have a bottleneck
> in the "JSP land" (which would be a true statement - it communicates
> with some background databases and apps, which might not be the
> fastest...)?
> 
> One thing which confuses me a bit though, is that when I call the web
> app for the first time (after deployment or after having re-started Tomcat),
> the web app is "slow". Ie. I go to http://server:8080/webapp and wait for
> like 10 seconds until the login screen of the web app is shown. This
> wait only happens for the very first time after deployment. When I do
> this again a few minutes/hours later, http://server:8080/webapp is shown
> right away.
> 
> Shouldn't pre-compilation also make this first time wait go away?

Not "also" - the *only* gain that can be expected by pre-compilation of
JSPs is the elimination of the first time wait, since Tomcat doesn't
need to do the compilation on-the-fly when the JSP is accessed for the
first time. For all following accesses of the JSP it shouldn't matter
whether or not it was pre-compiled.
But: a noticeable difference can only be expected if it really is the
compilation that slows things down on first access. If, OTOH, the vast
amount of time is taken by, say, creation of DB connections,
pre-compiling the JSPs won't make much of a difference.

-- 
Regards
  mks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org