tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cmanola...@yahoo.com>
Subject Re: Object pooling performance
Date Wed, 09 Jul 2003 16:00:28 GMT
Glenn Nielsen wrote:

> Remy Maucherat wrote:
>> Bill Barker wrote:
>> 
>>> Now, if we could only convince the Jasper developers of this ... ;-).
>> 
>> 
>> Tag pooling is definitely not the same situation and use case as session
>> pooling. Tag pooling *is* useful in many cases.
>> 
> 
> There are a number of things to consider when evaluating the performance
> of object pooling.
> 
> The performance hit of obtaining/recycling an object can be greater than
> instantiating a new object, it depends on the JVM.

And depending on the recyling mechanism :-)
Using per-thread objects ( like tomcat request objects ) doesn't require
sync, and I can't see any way creating/gc a new object by the VM could be
faster. 

Pools that use sync may be slower than modern VMs which use multiple 
memory areas to allocate objects ( or per thread ) - since the VM avoids
the sync. A smarter object pool that would use buckets of objects or 
per thread data would again be faster than VM.

The think to remember is that "one object" doesn't matter too much, but if 
you have big arrays or other data structures that could be reused - more
likely even the most stupid pool will beat the VM.


> But you also have to consider the impact on GC.  One big impact on
> performance of Tomcat is the frequency of and the time it takes to do
> incremental and Full GC's.
> 
> Full GC's can be especially nasty. In most JVM's a Full GC freezes
> processing of
> requests by Tomcat.  I would rather have a slight performance hit from
> recycling objects than see the frequency of Full GC's increase and the
> time they take increase.
> 
> I saw a huge performance boost when recycling of JSP custom tags was
> implemented in
> Jasper.  Most of that performance boost comes from reducing the frequency
> and length of GC's.

On the other hand, I've seen pages where JSP tag pooling was worse. 

That's why I think per page customization, and supporting per-thread pooling
are very important. This is a "fine-tune" operation for pages that are
frequently accessed, not a "one size fit all" problem.


Costin

> 
> To collect GC data add the -verbose:gc arg to java when you start Tomcat.
> 
> Regards,
> 
> Glenn



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


Mime
View raw message