Edmund Urbani wrote:
> John Cherouvim wrote:
>> Hello
>>
>> I'm building a mid scale web application for use within an intranet. I'm
>> using a custom web framework to handle flow, user input, validations,
>> persistence with hibernate and views with JSP and JSP 2.0 tag files. I
>> use tomcat 5.0.28 and in particular this feature it has where you can
>> write you own tag files in the WEB-INF/tags folder, and tomcat will
>> compile them and make them available in the JSPs.
>>
>> I like this feature because it provides me encapsulation. I can call any
>> tag I like with parameters and in addition I also use JSTL and EL which
>> allows me to do anything I would ever want on the presentation side of
>> the application.
>>
>> I've used jsp tag files before, in a much smaller application where I
>> had something like 10 tags.
>> Right now I am 50% done with this application and I already have 120 tag
>> files to render pojos, fields, various html controls etc. Most tags call
>> other tags in order to generate the whole page.
>> The first (small) problem is that every time I change something on a
>> tag, particularly in fine grained tags (which are heavily being used
>> from other tags) then tomcat has to recompile everything. It takes
>> around 1.5 minutes to do that on my workstation.
>>
>> The second (big) problem, is when I try to deploy on the client's web
>> server (intel xeon with 4 cpus with tomcat 5.0.28). I deploy and tomcat
>> starts up in something like 9 seconds. Then I access the application for
>> the first time, using a browser, and it takes more than an hour to build
>> the work\Catalina\localhost\MY-APPLICATION\org\apache\jsp folder.
>> Looking at the generated sources of those tag files it seems to me that
>> its taking so much because tomcat has to calculate all the dependencies
>> between tags. As soon as everything has compiled, the application runs
>> smothly as expected. There are 118 tag files, and the
>> work\Catalina\localhost\MY-APPLICATION\org\apache\jsp folder ends up
>> with 238 files (one for .java and one for .class) and takes up 2.7mb. I
>> don't know why such a fast machine needs so much time to generate 1.47mb
>> of source code, and compile it.
>>
>> This situation is really bad for me and I'd like to know what can I do
>> to improve the situation.
>> 1. Would tomcat 5.5.17 improve anything on this issue?
>> 2. Would precompiling the JSPs and tags improve anything?
>> 3. Can I upload my work\Catalina\localhost\MY-APPLICATION folder to the
>> client's server and force that tomcat not to re-compile? I tried it and
>> it did start compiling the jsps/tags again.
>> 4. Would changing some tags from tag files to proper Java
>> javax.servlet.jsp.tagext.Tag classes improve anything?
>> 5. If I package my tag files into a jar, would then tomcat had to do the
>> work thing?
>> 6. Should I change to another templating engine, such as Velocity?
>>
>> thanks,
>> Ioannis
>>
> 1-5 all sound like good ideas to try to me. 6 seems like a last resort
> kind of choice.
> 
> i can't really provide you with a satisfying answer here since I don't
> know tomcat/jasper internals that well myself. and so far i never had to
> deal with that many custom tags.
> 
> however i would like to suggest you do some java profiling. that should
> reveal which method(s) use up all the cpu time and may provide a hint to
> the source of the problem.
> 
>  Edmund
>

Taken from http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html:
...
Tomcat 5.5 uses the Jasper 2 JSP Engine to implement the JavaServer
Pages 2.0 specification.

Jasper 2 has been redesigned to significantly improve performance over
the orignal Jasper.
...

Looks like option 1 should solve your problem. Please let us know,
whether it actually does. You might also want to check the above URL for
some (minor) performance improvements for production environments.

 Edmund

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to