> From: Valeri Sarantchouk [mailto:[EMAIL PROTECTED]
> 
> I am trying to avoid creating new objects at every request.
> Is it possible to use a servlet as a (Trhowaway2)
> Controller? Or other reusable accross requests conroller.
> 
> [...]
>
> ClientModel has 38 fields and its creation and rendering
> are costly operations. Plus we have at least 70 concurrent
> users (accessing the same view at the same time) at low
> periods and 350+ at high, so creating new objects for each
> request and passing old ones to gc doesn't look good from
> performace point of view.
> 
> In "old" application, I use an object pool to get instances
> of Client objects for new users; and re-use Client objects
> found in user's session for logged-in users.
> 
> Can you advise me on how to replicate an object pool with
> Maverick and how to reuse the same object found in session?

I see you found the ControllerSingleton (and presumably FormBeanUser)
controller base classes.  However, are you sure of the performance
characteristics of your application?

Much research has gone into this subject, and the general conclusion has
been that the performance cost of object creation and collection is
vastly less than the performance cost of synchronization.  The
generational garbage collection scheme in modern JVMs is very efficient,
especially with short-lived objects such as Throwaway controllers.  On
the other hand, the thread synchronization required for an object pool
is tortuous for an application with high concurrency.  Search the JBoss
list for this subject - they concluded that the object pooling of EJBs
is only of value when the initialization cost of a bean is very high
(establishing network connections, etc).

My own experience confirms this.  The Sims Online player website
produces zillions of objects (much, much more than a typical website)
yet when maxed out under load testing I find that threads are always
waiting for monitor locks.

Just to give you some more idea of relative scale, a single Tomcat
request produces a flurry of objects.  Populating bean properties with
BeanUtils produces a flurry of objects.  Every JDBC driver I've ever
seen produces *vast* quantities of garbage.  Watching an application
under a profiler is an enlightening experience - you'll be amazed at how
many char[] and String objects a running Java app produces.

A minimal Maverick invocation produces 3 or 4 short-lived objects
(including String manipulation).  This is like shouting into a jet
engine - nobody is going to hear it on the other side.

Jeff Schnitzer
[EMAIL PROTECTED]


-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
[INVALID FOOTER]

Reply via email to