-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi Rod,
i don't know if you've found the answer to this, but i came across a usefull post (it relates to jetty) a wee while ago about this. here it is.
Cheers Mike
JSP Precompilation - What, Why and How ?
- ----------------------------------------- If you include a .jsp in your .war and hit it, Jasper (the JSP engine) will find the JSP, transform it into a .java, compile that into a .class, load and run it, returning the output. The .class file is then cached and reused on subsequent hits.
This can lead to 3 problems. 1). You might prefer to be notified of compile errors during your development cycle - rather than post deployment. 2). The first person to hit the page will have to wait a while whilst this process is carried out. 3). If you are deploying into a heavily loaded site, it is possible that a page may be hit again before the first hit has finished it's on-the-fly preparation. This may result in more than one concurrent attempt at compiling the page, resulting in unecessary load on the server and more than one user waiting a long time for the resource that they have requested.
The way out of all these problems is to precompile your JSPs - i.e. Do what Jasper would do lazily, preemptively during your development iteration.
Doing this results in the further following advantages:
- - your production site may consider the presence of a compiler a security breach. Precompiled JSPs do not need one. - - dispatch of request to servlet is simpler and therefore quicker since it goes direct from Jetty->Servlet and not Jetty->Jasper->Servlet.
Here is a mail I sent to jboss-user to help someone who wanted to do this: I have just fixed up the JBoss website to precompile JSPs.
This is a diff showing the code I added to the build.xml
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/website/content/bui ld.xml.diff?r1=text&tr1=1.7&r2=text&tr2=1.8&diff_format=h
and this is a diff showing what I added to the web.xml
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/website/content/src /resources/content-war/WEB-INF/web.xml.diff?r1=text&tr1=1.7&r2=text&tr2= 1.8&diff_format=h
The comment line in the web.xml MUST be after the last <servlet/> and before the first <servlet-mapping/> directive.
JspC will generate some xml <servlet/> and <servlet-mapping/> elements which I substitute in at this comment.
The rest you will have to figure out for yourself - it is well commented.
You will probably not need some of the workarounds I have had to retrofit.....
Since adding this item I have found the following :
1). Throwing a lot of concurrent requests at compile-on-the-fly JSPs can make Jasper simply fall about and complain about files not existing. Remove the load and hit the same page and it is returned no problem - conclusion compile-on-the-fly is simply not an option for enterprise level sites.
2). The JspC stuff referenced above fails to take into account welcome-files. Jetty will look for a file of the same (e.g. index.jsp) (so you should make sure something is there - even if it is an empty file) and if so redirectt the request to it. - Of course, you could probably remove the welcome-file directive and map your servlet directly.
Rod Macpherson wrote:
| Ironically nobody on our team would consider using weblogic for | development because it is far too slow. Individual jars cannot be hot | deployed and the EJB compile stage add several micro-eons to the | development process. Letting weblogic compile the EJBs for you does not | help since it is even slower and has the undesirable efffect of | crashing, without exception :( | | As far as precompiled JSPs it would be nice to just stipulate | "precompile my jsps" without having to resort to servlet mapping. Having | said that, it's only a deployment issue where QA can start testing at | full speed right out of the gates. How many milliseconds does it taking | to compile a single JSP? If it takes a second rather than half a second | is that really a material issue? I am a little puzzled by that one. | | Several people have been hitting the "compile my JSPs please" issue so | hopefully we will get that as a simple push-button solution at some | point. | | Cheers, | | Rod | | -----Original Message----- | From: Konstadinis Euaggelos [mailto:[EMAIL PROTECTED] | Sent: Monday, October 06, 2003 1:24 AM | To: [EMAIL PROTECTED] | Subject: Re: [JBoss-user] Pre compile jsps on jboss server | | | This is true, | | In our company, it's the first time we use JBOSS (Web-Logic is too | fast), If you make a change in jsp, the JBoss is to slow in compilation | of that jsp . <Host name="localhost" unpackWars="true" autoDeploy="true" | workDir="${jboss.server.home.dir}/work/MainEngine/localhost"><attribute | name="DeleteWorkDirs">false</attribute> | | I have made this changes to jboss-service.xml of Tomcat in order to | keep the compiled jsp in work directory and not in tmp. This sometimes | causes a wired behaviour, a change that is made in layout of a jsp or in | javascript is not reflected immediately in JBOSS, | | We must shutdown clean tmp, work and restart JBOSS to see the changes, | so the development time it's not so quick. | | | Vangos. | | | | ----- Original Message ----- | From: <[EMAIL PROTECTED]> | To: <[EMAIL PROTECTED]> | Sent: Monday, October 06, 2003 10:55 AM | Subject: RE: [JBoss-user] Pre compile jsps on jboss server | | | |>In WebLogic, there's a setting to make the container compile all the |>JSPs as they are deployed (rather than when they are first hit). Could | | |>a simple setting like this be introducted in JBoss? |> |>Rgds, |> |>Dan. |> |>-- |>Danny Yates |> |> |> |>-----Original Message----- |>From: Rod Macpherson [mailto:[EMAIL PROTECTED] |>Sent: 02 October 2003 19:03 |>To: [EMAIL PROTECTED] |>Subject: RE: [JBoss-user] Pre compile jsps on jboss server |> |> |>This is one of my pet peeves. It is true that you can precompile your |>JSPs and configure them as servlets and that is a reasonable approach |>in most circumstances. Having said that, if you have several hundred |>that you are dynamically updating during development the preference is | | |>to use JSPs as they were designed: update as-needed on a running |>server. The servlet approach is a bit of a hack (IMHO) when the |>container is perfectly capable of compiling the whole mess on its own |>with no intervention on your part. Where a compiled JSP goes and what |>its called is not part of the specification so it would be nice to |>have the container do that for you. |> |>Here's a link to an ANT script that precompiles for Tomcat. Haven't |>tried it but at least it avoids the servlet approach and the script |>looks very simple. |> |>http://cvs.apache.org/~fhanik/precompile.html |> |> |> |> |>-----Original Message----- |>From: JD Brennan [mailto:[EMAIL PROTECTED] |>Sent: Thursday, October 02, 2003 10:24 AM |>To: [EMAIL PROTECTED] |>Subject: RE: [JBoss-user] Pre compile jsps on jboss server |> |> |>I think the Ant jspc target can generate a web XML fragment that Ant |>can then substitute into your web.xml automatically. Haven't tried |>this myself ... yet - just read about it. |> |>JD |> |>-----Original Message----- |>From: Balakrishnan, Vijay [mailto:[EMAIL PROTECTED] |>Sent: Thursday, October 02, 2003 8:29 AM |>To: '[EMAIL PROTECTED]' |>Subject: [JBoss-user] Pre compile jsps on jboss server |> |> |>Hi, |> |>I tried looking through the archives but found nothing substantial.I |>want to precompile jsps on the server before deploying them to improve | | |>performance.I saw 1 mthod using the web.xml but that would mean |>putting all my zillions of jsp's under it- a nightmare scenario for |>maintenance.Is there any other way to do that on the server side.(jspc | | |>does not seem to work on the server side). My apologies if this |>question has been answered before. Thanks, Vijay |> |> |>------------------------------------------------------- |>This sf.net email is sponsored by:ThinkGeek |>Welcome to geek heaven. |>http://thinkgeek.com/sf |>_______________________________________________ |>JBoss-user mailing list |>[EMAIL PROTECTED] |>https://lists.sourceforge.net/lists/listinfo/jboss-user |> |> |>------------------------------------------------------- |>This sf.net email is sponsored by:ThinkGeek |>Welcome to geek heaven. |>http://thinkgeek.com/sf |>_______________________________________________ |>JBoss-user mailing list |>[EMAIL PROTECTED] |>https://lists.sourceforge.net/lists/listinfo/jboss-user |> |> |>------------------------------------------------------- |>This sf.net email is sponsored by:ThinkGeek |>Welcome to geek heaven. |>http://thinkgeek.com/sf |>_______________________________________________ |>JBoss-user mailing list |>[EMAIL PROTECTED] |>https://lists.sourceforge.net/lists/listinfo/jboss-user |> |> |>_____________________________________________________________________ |>Notice to recipient: |>The information in this internet e-mail and any attachments is | | confidential | |>and may be privileged. It is intended solely for the addressee. If you | | |>are not the intended addressee please notify the sender immediately by | | |>telephone. If you are not the intended recipient, any disclosure, |>copying, distribution or any action taken or omitted to be taken in |>reliance on it, is prohibited and may be unlawful. |> |>When addressed to external clients any opinions or advice contained in | | this | |>internet e-mail are subject to the terms and conditions expressed in |>any applicable governing terms of business or client engagement letter | | |>issued | | by | |>the pertinent Bank of America group entity. |> |>If this email originates from the U.K. please note that Bank of |>America, N.A., London Branch, Banc of America Securities Limited and |>Banc of | | America | |>Futures Incorporated are regulated by the Financial Services |>Authority. |>_____________________________________________________________________ |> |> |> |> |>------------------------------------------------------- |>This sf.net email is sponsored by:ThinkGeek |>Welcome to geek heaven. |>http://thinkgeek.com/sf |>_______________________________________________ |>JBoss-user mailing list |>[EMAIL PROTECTED] |>https://lists.sourceforge.net/lists/listinfo/jboss-user |> | | | | | ------------------------------------------------------- | This sf.net email is sponsored by:ThinkGeek | Welcome to geek heaven. | http://thinkgeek.com/sf _______________________________________________ | JBoss-user mailing list | [EMAIL PROTECTED] | https://lists.sourceforge.net/lists/listinfo/jboss-user | | | ------------------------------------------------------- | This sf.net email is sponsored by:ThinkGeek | Welcome to geek heaven. | http://thinkgeek.com/sf | _______________________________________________ | JBoss-user mailing list | [EMAIL PROTECTED] | https://lists.sourceforge.net/lists/listinfo/jboss-user
- -- ___________________________________________________________________
Mike Hepburn Phone: +44 (0)207 749 7900 Anvil Software Limited Fax: +44 (0)207 749 7916 51-53 Rivington Street E-mail: [EMAIL PROTECTED] London EC2A 3SE [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3-nr1 (Windows XP) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQE/g/ko1Go8kWxl8sERAmZWAJ9HlkQCMTPoUmUQRT8wML1lii/aUACeLPeC 4fYaBLvUqugcN1RBxDJWcps= =2+1R -----END PGP SIGNATURE-----
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user