RE: Calculating required memory
> From: Oleg [mailto:[EMAIL PROTECTED] > Now regarding shared/lib directory I thought that every > application loads > its own copy of those libraries, but if its only one time > load and since all > my applications are identical copies (only data changes) I > might as well > move all my classes into shared, before I only had struts, > hibernate jars and so on http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html is the page you want. They're loaded by the Shared classloader, of which there is only one per Tomcat instance. > That wouldnt create any thread safety issues would it? Potentially yes (so test with Jmeter or similar), and it might also cause some fun and games with multiple servlets if any perform initialization assuming they're the only user of a particular library. Imagine one servlet running for an extended period using a library, then a second servlet starting and calling the initialization code of that library... You get the idea. A well-written library should ride this out. - Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calculating required memory
Thank you very much for your input gentlemen. Increasing PermGen is a great idea, because I do see my server giving me out of memory permgen error at least twice a day and now it makes sense why, I was thinking my -Xmx settings 1024m should take care of my needs for now and that was wrong, I set MaxPermSize=256m and the server seem to be fine for now, keeping my fingers crossed. Now regarding shared/lib directory I thought that every application loads its own copy of those libraries, but if its only one time load and since all my applications are identical copies (only data changes) I might as well move all my classes into shared, before I only had struts, hibernate jars and so on That wouldnt create any thread safety issues would it? Thanks again for your time, this helps a lot! Oleg On 8/17/05, Peter Crowther <[EMAIL PROTECTED]> wrote: > > > From: Oleg [mailto:[EMAIL PROTECTED] > > I am trying to approximate the amount of memory my server > > will need running > > tomcat. I understand that a lot depends on how the appication handles > > resources, however at this point I am trying to figure out > > what will be the > > mimimum needed. In my case I have virtual hosting setup, with > > all hosts > > sharing the same libraries, so I have struts, hibernate,... > > all sitting in > > shared/lib directory of Tomcat. Would I be correct to > > estimate that Tomcat > > will atleast need > > > > n(number of users/applications) * mb(total size of shared/lib) > > As Chuck has already pointed out, no (but I'm going to try a slightly > different angle on it :-) ). Each class that is loaded from shared/lib > will be loaded by the Shared classloader, so you'll only have one copy > of the class in your JVM. Jars are compressed, so the sizes of the > loaded classes will be larger than the bytes occupied on disk; but not > all of the classes from a jar will be loaded, so the sizes will probably > be smaller. Note, however, that any classes in the webapp's WEB-INF/lib > *will* be loaded once per webapp. If you have large numbers of > applications, you may want to put more common libraries in shared/lib, > and you may also wish to increase the size of the permanent generation > (PermGen) in the JVM's memory model as this is where the classes are > stored. > > Your per-session and per-page data will dwarf the space required for > classes; and, as Chuck pointed out, the only way to find out these sizes > is to profile the app. This will also make sure that you're not going > to fall foul of any other performance limits, such as CPU use or disk > bandwidth. > > - Peter > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
RE: Calculating required memory
> From: Oleg [mailto:[EMAIL PROTECTED] > I am trying to approximate the amount of memory my server > will need running > tomcat. I understand that a lot depends on how the appication handles > resources, however at this point I am trying to figure out > what will be the > mimimum needed. In my case I have virtual hosting setup, with > all hosts > sharing the same libraries, so I have struts, hibernate,... > all sitting in > shared/lib directory of Tomcat. Would I be correct to > estimate that Tomcat > will atleast need > > n(number of users/applications) * mb(total size of shared/lib) As Chuck has already pointed out, no (but I'm going to try a slightly different angle on it :-) ). Each class that is loaded from shared/lib will be loaded by the Shared classloader, so you'll only have one copy of the class in your JVM. Jars are compressed, so the sizes of the loaded classes will be larger than the bytes occupied on disk; but not all of the classes from a jar will be loaded, so the sizes will probably be smaller. Note, however, that any classes in the webapp's WEB-INF/lib *will* be loaded once per webapp. If you have large numbers of applications, you may want to put more common libraries in shared/lib, and you may also wish to increase the size of the permanent generation (PermGen) in the JVM's memory model as this is where the classes are stored. Your per-session and per-page data will dwarf the space required for classes; and, as Chuck pointed out, the only way to find out these sizes is to profile the app. This will also make sure that you're not going to fall foul of any other performance limits, such as CPU use or disk bandwidth. - Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Calculating required memory
> From: Oleg [mailto:[EMAIL PROTECTED] > Subject: Calculating required memory > > Would I be correct to estimate that Tomcat will atleast need > > n(number of users/applications) * mb(total size of shared/lib) In a word, no - disk space occupied by class files has no correlation with memory consumed by a running application. Class files are primarily composed of the constant pool and byte codes, whereas the vast majority of memory used by most Java applications is taken up by dynamically created objects, which is highly dependent on application logic. You really can't estimate memory use with any degree of confidence without actually running your application, using various loads and forcing garbage collections to occur. Given the low price and ready availability of memory these days, this really shouldn't be much of a concern. Of course, it would be possible for some monstrous app to exhaust the per-process virtual space provided by your OS... - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]