tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berglas, Anthony" <aberg...@rsasecurity.com>
Subject RE: Fix to Tomcat Jasper slow .tag compilation problem.
Date Mon, 29 Oct 2007 23:18:57 GMT
Precompiling would not help.

1. Precompiling JSPs with .tag files is broken in Jasper, if tags call
other tags.

2. If it were fixed I would imagine that it would still recompile each
tag over and over again.  A precompile of a few dozen jsps would then
take hours.

The next issue to fix is the very slow one tag at a time Java compiles.
Then the dependencies can be looked at, but the code is fairly complex.

My enthusiasm for addressing these issues is dependent on the community
being able to incorporate my fixes into the core.  Otherwise I fork
Tomcat, not a good idea.  

My feeling is that my fix below will just be ignored.

Anthony

> -----Original Message-----
> From: Peng Tuck Kwok [mailto:pengtuck@gmail.com]
> Sent: Monday, October 29, 2007 8:17 PM
> To: Tomcat Users List
> Subject: Re: Fix to Tomcat Jasper slow .tag compilation problem.
> 
> Would pre-compiling your jsp files help you instead? AFAIK that works
on
> the
> tags so you probably don't need to touch jspc.
> 
> On 10/29/07, Berglas, Anthony <aberglas@rsasecurity.com> wrote:
> >
> > As described in a previous post, Jasper is *extremely* slow at
compiling
> > .tag files packaged in a .jar.  Tens of seconds every time you touch
a
> > new .jsp for the first time.  Almost unusable if you use .tags
> > extensively, as I do.
> >
> > The following few lines is a hack to fix this.  The added code is
marked
> > between // -------- AJB markers.  It effectively turns off the
timestamp
> > checking on .jar files.
> >
> > This does NOT actually introduce a bug.  There is an existing bug in
> > that .jsp files are not automatically recompiled if any .tags in
.jars
> > are changed.  So you need to purge work in either case.  A proper
fix
> > would be to check dependencies properly, at least to the .jar file
> > itself.  But the current fix is *much* better that the existing
> > behavior.
> >
> > COULD SOMEBODY PLEASE ARRANGE FOR THIS CODE TO BE ADDED TO THE
CURRENT
> > SUBVERSION REPOSITORY?
> >
> > Outstanding is to make the compilation of .tags themselves much
faster,
> > not tens of seconds.  To do that one needs to call the Java compiler
> > once at the end for all the .tags, rather than once for each
individual
> > .tag which is *much* slower.
> >
> > I must admit that I got rather lost reading the Jasper source, with
all
> > the contexts etc.  Some better comments on the classes describing
their
> > relationships to each other would be most helpful.
> >
> > Thanks,
> >
> > Anthony
> >
> >
> >
> > // Tomcat 6.0.10 Src deployed version.
> >
> > public class JspCompilationContext {...
> >
> >     public void compile() throws JasperException,
FileNotFoundException
> > {
> >         createCompiler();
> >
> >         // ------------ begin AJB
> >         // Hack to stop .tag files that are packaged in .jars being
> > recompiled for every single .jsp that uses them.
> >         // The hack means that .tag files will not be automatically
> > recompiled if they change -- you need to delete work area.
> >         // But that was actually an existing bug -- .jsps are not
> > dependent on the .tag .jars so the work area needed deleting anyway.
> >         // (Outstanding is to compile multiple .tags in one pass and
so
> > make the process Much faster.)
> >         boolean outDated;
> >         if (isPackagedTagFile) outDated = ! new
> > File(getClassFileName()).exists();
> >         else outDated = jspCompiler.isOutDated();
> > //        AjbLog.log("### Compiler.compile " + jspUri + " pkgTagFile
" +
> > isPackagedTagFile + " outDated " + outDated + " " +
getClassFileName());
> >         if (outDated) {
> > //     if (isPackagedTagFile || jspCompiler.isOutDated()) {
> > //     ---------------- end AJB
> >             try {
> >                 jspCompiler.removeGeneratedFiles();
> >                 jspLoader = null;
> >                 jspCompiler.compile();
> >                 jsw.setReload(true);
> >                 jsw.setCompilationException(null);
> >             } catch (JasperException ex) {
> >                 // Cache compilation exception
> >                 jsw.setCompilationException(ex);
> >                 throw ex;
> >             } catch (Exception ex) {
> >                 JasperException je = new JasperException(
> >
> > Localizer.getMessage("jsp.error.unable.compile"),
> >                             ex);
> >                 // Cache compilation exception
> >                 jsw.setCompilationException(je);
> >                 throw je;
> >             }
> >         }
> >     }
> >
> > --
> > Dr Anthony Berglas
> > Ph. +61 7 3227 4410
> > Mob. +61 44 838 8874
> > ABerglas@RSA.com; Anthony@Berglas.org
> >
> >
> >
---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >

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


Mime
View raw message