RE: [Mav-user] reusable controllers and session objects
How about a base class with derived classes? The base class handles exceptions and logging, and defers to the subclasses for actual processing. Perhaps with a template method. -Thomas -Original Message- From: Valeri Sarantchouk [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 6:56 AM To: [EMAIL PROTECTED] Subject: RE: [Mav-user] reusable controllers and session objects 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? You certainly can do this with ControllerSingleton - but why? Is it really that hard to have lots of individual classes, one for each action? What do you hope to gain? I find that lots of little classes is far more convenient than few big classes, especially with several engineers and version control. YMMV though. Jeff Schnitzer [EMAIL PROTECTED] I completely agree that in most cases a separate class per action makes code easier to read and understand. I am just trying to simplify exception handling for many (16) tiny classes that take actions on the same model. For now, the exception handling and related logging code is repeated in each of those classes. Or it's not such a big cost after all? Thank you Valeri --- 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=plusref=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] --- 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]
RE: [Mav-user] reusable controllers and session objects
Will definately work. Thank you Thomas. Valeri --- On Wed, 2 Apr 2003 08:13:43 Thomas Wheeler wrote: How about a base class with derived classes? The base class handles exceptions and logging, and defers to the subclasses for actual processing. Perhaps with a template method. -Thomas -Original Message- From: Valeri Sarantchouk [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 6:56 AM To: [EMAIL PROTECTED] Subject: RE: [Mav-user] reusable controllers and session objects 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? You certainly can do this with ControllerSingleton - but why? Is it really that hard to have lots of individual classes, one for each action? What do you hope to gain? I find that lots of little classes is far more convenient than few big classes, especially with several engineers and version control. YMMV though. Jeff Schnitzer [EMAIL PROTECTED] I completely agree that in most cases a separate class per action makes code easier to read and understand. I am just trying to simplify exception handling for many (16) tiny classes that take actions on the same model. For now, the exception handling and related logging code is repeated in each of those classes. Or it's not such a big cost after all? Thank you Valeri --- 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=plusref=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] --- 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=plusref=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]
RE: [Mav-user] reusable controllers and session objects
IMHO a sensible strategy of developping apps is to first focus on the behavoir and after that focus on performance issues. That does not mean that it is wrong to take performance issues in account in an early stage, but just do not let it overtake the main focus of your project. In my experience caching CAN make a huge difference though, especially when you have database heavy apps or - like Jeff said - object that have high initialisation costs. But ya, things like synchronisation can be killers as well. And if you use transactions for instance... be smart with them (like: is it possible to do more in the same transaction... made huge differences for us when working with OJB). And as a side note: three years ago I developed several java webapps for the AS-400 platform (JDK1.1.x). In that case object creation *was* very expensive so it did make sense to use object caching. I do not know about the current performance charactaristics of that platform. Second side note: GC can give you problems at times. A recent project where we made heavy use of JSTL could crash our server! There is/ are memory leak(s) in JSTL presumably the forEach tag. The strange thing was that in certain cases when the GC did a run the JVM ended up using more memory than before this run. On several servers (both on Win and Lunix) the memory usage could exeed gigabytes within one minute before crashing... That brings me to an example where caching makes a big difference. If you look at the performance gain Tomcat 4.1.x got compared to Tomcat 4.0.x: for our apps it was the caching of the custom tags in Tomcat 4.1.x that made the difference (about 1500 milis!). Funny thing though is that, allthough Tomcat 4.0.x is a lot slower with our JSTL intensive project than Tomcat 4.1.x, the former never crashes. This is to illustrate that, allthough caching can make a huge difference at times, it also adds complexity thus usually more bugs (can confirm that from personal experience too!) So my bottom line is to be practical. First build your app only addressing the most obvious performance issues. When all works/ is stable look at performance characteristics. IF you want to cache be aware of the added complexity, maybe using something like JCS (http://jakarta.apache.org/turbine/jcs/index.html) can help reducing that (allthough I never used it). The reason that I sometimes use singleton controllers is that those controllers do a lot of initialisation that is equal for all users and should be done only once. Eelco -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Schnitzer, Jeff Sent: maandag 31 maart 2003 23:42 To: [EMAIL PROTECTED] Subject: RE: [Mav-user] reusable controllers and session objects 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
RE: [Mav-user] reusable controllers and session objects
I prefer Velocity for simplicity and, combined with the toolbox and velocity servlet project, you can do all the stuff you can do in JSP's. With XML/XSLT you have 'know' all the stuff you're going to use in a view beforehand (just like using Velocity without the toolbox extention). Personally I like program 'dirty' at times according to the majority of Java programmers it seems. For instance, I have no problem with getting data from a database with a query that's in a view (that needs no input). Just like PhP :). I think one of the reasons that a lot of starters/ webdesigners prefer PhP and ASP/.NET over Java (at least that what I see around me) is not that it is harder, but that the Java way of programming webapps allways has to be in perfect OO style. So, even for a small site, you *have* to start with an object model. Then translate that (or the other way around) to a RDBMS. Then use something like OJB/ Hibernate/ Castor to talk to your model (and I NEVER have seen a project that did not cost a lot of time thanks to bugs in these mapping layers). Then ofcourse for every trival piece of info to show on your site you have to write an controller (hey, I wonder where the C in MVC is for... could it the controller for INPUT usage?). But then... finally we have build ourselves a nice and clean webapp. Funny thing is though, that for the smaller to average sized web projects your average PhP 'script kiddie' would have build the whole damn thing in one third of the time it took us! And we did not even start thinking about using EJB's. My point? Don't overengineer all the time. Seen it happen too often. AND it gives Java a bad name for the more 'pragmatical' programmers (read PhP/ ASP/ 4GL adepts) and managers in general. Hah that's a relieve. I just had to put this on a mailing list. I seriously have discussions at least once a week on this subject with my Java oriented collegues (who strongly disagree on this, just as they prefer Struts over Maverick as it 'does so much for you' (read: they have the form beans/ tags)), and I have to hear too often from collegues who use PhP/ ASP/ .NET/ Delphi to build applications that they think Java takes too long to develop an application. Be practical! Engineer according to the complexity of your application! Allright... I'm feeling like a scoolteacher/ know-all. Sorry about that. But I *am* wondering what other people think about this. Maybe a new thread? Eelco -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Valeri Sarantchouk Sent: dinsdag 1 april 2003 16:23 To: [EMAIL PROTECTED] Subject: RE: [Mav-user] reusable controllers and session objects Yes, sometimes I loose balance between adhering to initial design and making shortcuts when I encounter a performance bottleneck. I also considered contrast of JSTL simplicity from page author point of view with its complexity from precompiler/VM point of view, and concluded (but I still could be wrong) that even JSF+JSTL don't make JSP ideal View technology. I see XSLT as the cleanest and most elegant approach to build a View. Though, I like XMLC and Velocity for their performance. (I might look unreasonably obsessed with performance issues. I am :) I think that each new software product I develop should perform at least on the same level as its predecessor. Expecially knowing how good PHP- and Perl-based solutions could be in simple applications.) Thanks, Valeri --- On Tue, 1 Apr 2003 10:41:51 Eelco Hillenius wrote: IMHO a sensible strategy of developping apps is to first focus on the behavoir and after that focus on performance issues. That does not mean that it is wrong to take performance issues in account in an early stage, but just do not let it overtake the main focus of your project. In my experience caching CAN make a huge difference though, especially when you have database heavy apps or - like Jeff said - object that have high initialisation costs. But ya, things like synchronisation can be killers as well. And if you use transactions for instance... be smart with them (like: is it possible to do more in the same transaction... made huge differences for us when working with OJB). And as a side note: three years ago I developed several java webapps for the AS-400 platform (JDK1.1.x). In that case object creation *was* very expensive so it did make sense to use object caching. I do not know about the current performance charactaristics of that platform. Second side note: GC can give you problems at times. A recent project where we made heavy use of JSTL could crash our server! There is/ are memory leak(s) in JSTL presumably the forEach tag. The strange thing was that in certain cases when the GC did a run the JVM ended up using more memory than before this run. On several servers (both on Win and Lunix) the memory usage could exeed gigabytes within one minute before crashing... That brings me to an example where caching makes a big difference. If you look
RE: [Mav-user] reusable controllers and session objects
Yes, sometimes I loose balance between adhering to initial design and making shortcuts when I encounter a performance bottleneck. I also considered contrast of JSTL simplicity from page author point of view with its complexity from precompiler/VM point of view, and concluded (but I still could be wrong) that even JSF+JSTL don't make JSP ideal View technology. I see XSLT as the cleanest and most elegant approach to build a View. Though, I like XMLC and Velocity for their performance. (I might look unreasonably obsessed with performance issues. I am :) I think that each new software product I develop should perform at least on the same level as its predecessor. Expecially knowing how good PHP- and Perl-based solutions could be in simple applications.) Thanks, Valeri --- On Tue, 1 Apr 2003 10:41:51 Eelco Hillenius wrote: IMHO a sensible strategy of developping apps is to first focus on the behavoir and after that focus on performance issues. That does not mean that it is wrong to take performance issues in account in an early stage, but just do not let it overtake the main focus of your project. In my experience caching CAN make a huge difference though, especially when you have database heavy apps or - like Jeff said - object that have high initialisation costs. But ya, things like synchronisation can be killers as well. And if you use transactions for instance... be smart with them (like: is it possible to do more in the same transaction... made huge differences for us when working with OJB). And as a side note: three years ago I developed several java webapps for the AS-400 platform (JDK1.1.x). In that case object creation *was* very expensive so it did make sense to use object caching. I do not know about the current performance charactaristics of that platform. Second side note: GC can give you problems at times. A recent project where we made heavy use of JSTL could crash our server! There is/ are memory leak(s) in JSTL presumably the forEach tag. The strange thing was that in certain cases when the GC did a run the JVM ended up using more memory than before this run. On several servers (both on Win and Lunix) the memory usage could exeed gigabytes within one minute before crashing... That brings me to an example where caching makes a big difference. If you look at the performance gain Tomcat 4.1.x got compared to Tomcat 4.0.x: for our apps it was the caching of the custom tags in Tomcat 4.1.x that made the difference (about 1500 milis!). Funny thing though is that, allthough Tomcat 4.0.x is a lot slower with our JSTL intensive project than Tomcat 4.1.x, the former never crashes. This is to illustrate that, allthough caching can make a huge difference at times, it also adds complexity thus usually more bugs (can confirm that from personal experience too!) So my bottom line is to be practical. First build your app only addressing the most obvious performance issues. When all works/ is stable look at performance characteristics. IF you want to cache be aware of the added complexity, maybe using something like JCS (http://jakarta.apache.org/turbine/jcs/index.html) can help reducing that (allthough I never used it). The reason that I sometimes use singleton controllers is that those controllers do a lot of initialisation that is equal for all users and should be done only once. Eelco -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Schnitzer, Jeff Sent: maandag 31 maart 2003 23:42 To: [EMAIL PROTECTED] Subject: RE: [Mav-user] reusable controllers and session objects 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
RE: [Mav-user] reusable controllers and session objects
From: Valeri Sarantchouk [mailto:[EMAIL PROTECTED] But what about old good servlets? My simple tests comparing chains of JavaBeans with analogous servlet filters shows filters more performant. I'm not sure what you mean by this - JavaBeans vs filters? 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? You certainly can do this with ControllerSingleton - but why? Is it really that hard to have lots of individual classes, one for each action? What do you hope to gain? I find that lots of little classes is far more convenient than few big classes, especially with several engineers and version control. YMMV though. 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]
Re: [Mav-user] reusable controllers and session objects
Thanks for the tip. We did not set these contex-params. Btw, since we had our problems, there's been several reports about memory leaks in the Jakarta lists as well. It only (AFAIK) shows up with Tomcat 4.1.x. Our solution was to port the views to Velocity; three days of work and runs like a baby! Eelco - Original Message - From: Schnitzer, Jeff [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 4:10 AM Subject: RE: [Mav-user] reusable controllers and session objects From: Eelco Hillenius [mailto:[EMAIL PROTECTED] Second side note: GC can give you problems at times. A recent project where we made heavy use of JSTL could crash our server! There is/ are memory leak(s) in JSTL presumably the forEach tag. The strange thing was that in certain cases when the GC did a run the JVM ended up using more memory than before this run. On several servers (both on Win and Lunix) the memory usage could exeed gigabytes within one minute before crashing... FWIW, I haven't seen anything like this on the TSO site. There are a lot of synchronization issues in the Jakarta JSTL implementation, but I haven't seen any memory leaks yet. Make sure you explicitly set the locale and timezone context-params in web.xml - the auto-discovery process tickles a nasty synchronization bottleneck in java.util.Locale. Jeff --- 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] --- 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]
RE: [Mav-user] reusable controllers and session objects
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=plusref=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/
Re: [Mav-user] reusable controllers and session objects
My dad can beat up your dad! - Original Message - From: Michael McGrady [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 2:25 AM Subject: Re: [Mav-user] reusable controllers and session objects I see, you meant to say I am trying to STOP applying my stuff to a frameless application instead of I am trying to apply my stuff to a frameless application. So, you have to see that it was not a matter of ignorance, or knowledge, but basic communication. There is no need to get snarky. I was answering to try to be helpful. Perhaps I should just ignore you. You might in fact prefer that, and prefer to have help that soothes rather than helps. That is okay with me. Whatever! At 01:00 PM 3/29/03 -0800, you wrote: Valeri these are just standard coding things. You essentially are asking how to code your project. I asked: is it possible? Maverick is a framework, so you can hardly apply it to a framework-less web application. You mean it doesn't make any sense to convert spagetti applicatios to a well-designed ones? Yes, you are right: why bother? Thank you for poining out at my total ignorance. Valeri --- On Sat, 29 Mar 2003 12:35:09 Michael McGrady wrote: Valeri these are just standard coding things. You essentially are asking how to code your project. Maverick is a framework, so you can hardly apply it to a framework-less web application. My apologies if I am not understanding you. This is meant to be helpful. On your coding questions, I have no idea what your application does, so I could not nor could anyone else give an intelligent reponse to the questions. If you don't need a lot of the infomation in the ClientModel, I would definitely use lazy initialization of the Client, or a similar technique. At 12:14 PM 3/29/03 -0800, you wrote: Dear Maverick experts, I am trying to apply Maverick to a framework-less web application, and my question is a very basic one. 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. Situation: I have a servlet that checks if there is a Client object in the user's session. If yes, the Client object is reused, otherwise a new Client instance is created. The Client object looks like this: public class Client{ private ClientModel model; private ClientModelHandler modelHandler; private CardViewHandler cardViewHandler; private FormViewHandler formViewHandler; private FormPrintHandler formPrintHandler; // methods go here... } 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? Thank you very much! Valeri _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored
Re: [Mav-user] reusable controllers and session objects
Eelco, Do you know by any chance if it possible to have a controller which itself can be borrowed from some kind of controller factory? Similar to servlet thread pool. Thanks, Valeri --- On Sat, 29 Mar 2003 22:31:30 Eelco Hillenius wrote: Sure, np If you're using ControllerSingleton (or FormBeanUser as it implements ControllerSingleton) you should use the latest version of Maverick from CVS as a bug that was fixed two weeks ago had the effect that init(controllerNode) was never called for implementors of ControllerSingleton. Eelco - Original Message - From: Valeri Sarantchouk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 10:10 PM Subject: Re: [Mav-user] reusable controllers and session objects Hi Eelco, Thank you! I took a look at Maverick's source code, and found it: I can simply subclass ControllerSingleton and use object pools from the subclass. Cheers, Valeri --- On Sat, 29 Mar 2003 21:46:42 Eelco Hillenius wrote: I am not sure that understand you well, but... You can still use sessions (and all other servlet stuff) in Maverick. Just get it like getCtx().getRequest().getSession(). If you are working with expensive controllers (controllers that have to do a lot of initialising or have a lot of fields) you can extend org.infohazard.maverick.ctl.FormBeanUser or implement org.infohazard.maverick.flow.ControllerSingleton. This way, your controllers are created only once. Be sure to read the javadocs and explore the code of the org.infohazard.maverick.ctl package to clearify things ;-) And of course... use inheritance to factor common behaviour in your controllers. As for the object pool, sure you can use whatever you think suits you; Maverick won't stop you! Hope that helps a bit, Eelco - Original Message - From: Valeri Sarantchouk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:14 PM Subject: [Mav-user] reusable controllers and session objects Dear Maverick experts, I am trying to apply Maverick to a framework-less web application, and my question is a very basic one. 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. Situation: I have a servlet that checks if there is a Client object in the user's session. If yes, the Client object is reused, otherwise a new Client instance is created. The Client object looks like this: public class Client{ private ClientModel model; private ClientModelHandler modelHandler; private CardViewHandler cardViewHandler; private FormViewHandler formViewHandler; private FormPrintHandler formPrintHandler; // methods go here... } 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? Thank you very much! Valeri _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
Re: [Mav-user] reusable controllers and session objects
Valeri these are just standard coding things. You essentially are asking how to code your project. Maverick is a framework, so you can hardly apply it to a framework-less web application. My apologies if I am not understanding you. This is meant to be helpful. On your coding questions, I have no idea what your application does, so I could not nor could anyone else give an intelligent reponse to the questions. If you don't need a lot of the infomation in the ClientModel, I would definitely use lazy initialization of the Client, or a similar technique. At 12:14 PM 3/29/03 -0800, you wrote: Dear Maverick experts, I am trying to apply Maverick to a framework-less web application, and my question is a very basic one. 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. Situation: I have a servlet that checks if there is a Client object in the user's session. If yes, the Client object is reused, otherwise a new Client instance is created. The Client object looks like this: public class Client{ private ClientModel model; private ClientModelHandler modelHandler; private CardViewHandler cardViewHandler; private FormViewHandler formViewHandler; private FormPrintHandler formPrintHandler; // methods go here... } 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? Thank you very much! Valeri _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER]
Re: [Mav-user] reusable controllers and session objects
Hi Eelco, Thank you! I took a look at Maverick's source code, and found it: I can simply subclass ControllerSingleton and use object pools from the subclass. Cheers, Valeri --- On Sat, 29 Mar 2003 21:46:42 Eelco Hillenius wrote: I am not sure that understand you well, but... You can still use sessions (and all other servlet stuff) in Maverick. Just get it like getCtx().getRequest().getSession(). If you are working with expensive controllers (controllers that have to do a lot of initialising or have a lot of fields) you can extend org.infohazard.maverick.ctl.FormBeanUser or implement org.infohazard.maverick.flow.ControllerSingleton. This way, your controllers are created only once. Be sure to read the javadocs and explore the code of the org.infohazard.maverick.ctl package to clearify things ;-) And of course... use inheritance to factor common behaviour in your controllers. As for the object pool, sure you can use whatever you think suits you; Maverick won't stop you! Hope that helps a bit, Eelco - Original Message - From: Valeri Sarantchouk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:14 PM Subject: [Mav-user] reusable controllers and session objects Dear Maverick experts, I am trying to apply Maverick to a framework-less web application, and my question is a very basic one. 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. Situation: I have a servlet that checks if there is a Client object in the user's session. If yes, the Client object is reused, otherwise a new Client instance is created. The Client object looks like this: public class Client{ private ClientModel model; private ClientModelHandler modelHandler; private CardViewHandler cardViewHandler; private FormViewHandler formViewHandler; private FormPrintHandler formPrintHandler; // methods go here... } 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? Thank you very much! Valeri _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER]
Re: [Mav-user] reusable controllers and session objects
I see, you meant to say I am trying to STOP applying my stuff to a frameless application instead of I am trying to apply my stuff to a frameless application. So, you have to see that it was not a matter of ignorance, or knowledge, but basic communication. There is no need to get snarky. I was answering to try to be helpful. Perhaps I should just ignore you. You might in fact prefer that, and prefer to have help that soothes rather than helps. That is okay with me. Whatever! At 01:00 PM 3/29/03 -0800, you wrote: Valeri these are just standard coding things. You essentially are asking how to code your project. I asked: is it possible? Maverick is a framework, so you can hardly apply it to a framework-less web application. You mean it doesn't make any sense to convert spagetti applicatios to a well-designed ones? Yes, you are right: why bother? Thank you for poining out at my total ignorance. Valeri --- On Sat, 29 Mar 2003 12:35:09 Michael McGrady wrote: Valeri these are just standard coding things. You essentially are asking how to code your project. Maverick is a framework, so you can hardly apply it to a framework-less web application. My apologies if I am not understanding you. This is meant to be helpful. On your coding questions, I have no idea what your application does, so I could not nor could anyone else give an intelligent reponse to the questions. If you don't need a lot of the infomation in the ClientModel, I would definitely use lazy initialization of the Client, or a similar technique. At 12:14 PM 3/29/03 -0800, you wrote: Dear Maverick experts, I am trying to apply Maverick to a framework-less web application, and my question is a very basic one. 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. Situation: I have a servlet that checks if there is a Client object in the user's session. If yes, the Client object is reused, otherwise a new Client instance is created. The Client object looks like this: public class Client{ private ClientModel model; private ClientModelHandler modelHandler; private CardViewHandler cardViewHandler; private FormViewHandler formViewHandler; private FormPrintHandler formPrintHandler; // methods go here... } 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? Thank you very much! Valeri _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] _ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER] --- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER]