tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Cruikshank <a...@epitonic.com>
Subject Re: [PATCH]: significant performance boost for JSP pages
Date Wed, 23 Feb 2000 01:39:45 GMT
At 04:32 PM 2/22/00 -0800, you wrote:
>Alex Cruikshank wrote:
> > [snipped description of JSP performance problems]
> > What's worse, the code called from a synchronized method, 
> JspLoader.loadJSP(),
> > which means that every JSP page request will have wait its turn to execute
> > this code. [...]
>
>I'm pretty sure this method was made synchronized as a quick and dirty fix
>for a serious multithreading problem (two JSP pages accessed for the first 
>time
>at roughly the same time ended up as servlets mixing content from the two
>pages). Besides removing "synchronized", the core problem must be solved.

I don't advocate removing the synchronization, but rather, increasing the 
granularity of the synchronization block.

+ if ((jspClass == null) || (compiler.isOutDated() ))
+ {
+       synchronized ( this )
+       {
+               if ((jspClass == null) || (compiler.isOutDated() ))
+                       outDated = compiler.compile();
+       }
+ }

This type of construct is impossible without making the isOutDated() method 
public.  The code should be equally thread safe, because the file is tested 
before and after the synchronization lock.  Synchronization can be 
expensive by itself, and I feel some effort should be made to avoid it 
where safe to do so regardless of the duration of the code within the 
synchronization block.

- alex


>Hans
>--
>Hans Bergsten           hans@gefionsoftware.com
>Gefion Software         http://www.gefionsoftware.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message