Hi Jeff,

Thank you for such insightfull answer! I simply wasn't 
aware of much of these inner workings.

It breaks many of my stereotypes: 

1. Object pool stereotype: always create a cache of idle
 objects for average number of simultaneous users. 
 I thought "if caching of static content and XSLT 
 templates is good, why don't we cache everything else?
 (Especially after Jason Hunter's article "Cache As Mad".)
 After all, start-up time of Perl/CGI scripts (creating 
 a new process, loading program from disk into process in 
 memory, starting interpreter,..) is the major reason for
 scalability problem with CGI applications. And such 
 improvements to plain CGI as mod_perl with 
 Apache::Session use persistent in-memory data structures.

 But now, it appears to me that then the only usable type
 of object pool is the one for database connections. 

2. GC stereotype: Don't make GC work very hard - it takes
  valuable CPU time, plus it's prone to leaking memory.
  These issues, apparently, are exaggerated.

But what about old good servlets? My simple tests comparing
chains of JavaBeans with analogous servlet filters shows 
filters more performant. 

If I can take more of your time, what do you think about
multi-action controllers? For cases of related but small
in processing weight actions, it's might be appropriate to
invoke a single (static) method instead of a class based
on the url query parameters. Is ControllerSingleton / 
FormBeanUser everything we would possible want for 
multi-action controllers?

Thank you very much!

Valeri

---





On Mon, 31 Mar 2003 13:42:22  
 Schnitzer, Jeff wrote:
>> 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]
>



_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus


-------------------------------------------------------
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