Re: Memory Usage
On 24/04/2019 21:46, Simon Funnell wrote: > Hi, > > I am looking at running a small ecommerce site with about 40-80 users at a > time on a virtual private server with 4 cores and 1GB of memory, I am > planning on running apache james, mysql and tomcat on this instance. My > question is will 256MB maximum heap memory with say 50 threads be enough to > handle the load without any out of memory errors? No idea. I've seen apps with 6GB heap fail with OOME with only 5 concurrent users and other apps serve 1000s of users with a few hundred MB. It all depends on the app and we can't see you code. Load testing and profiling are strongly recommended. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Memory usage increased form 500MB to 4 GB after changing the tomcat process from 32 bit to 64 bit execution
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Nagendra, On 4/14/17 4:36 AM, nagendra.r...@wipro.com wrote: > Problem statement: Memory usage increased form 500MB to 4 GB after changing the tomcat process from 32 bit to 64 bit execution Any other changes? For example, changes to the heap configuration, stack configuration, or any other memory-related parameters? Please post your complete JVM launch command. If you use "catalina.sh" or "startup.sh" to launch Tomcat, use "ps" to find out the effective command and post that. How are you measuring the "memory usage"? > As tomcat memory has increased it is impacting available memory > for other applications on server > > o Is this a bug ? Almost certainly not. > o Earlier with 32bit it was running around 400MG, If we restrict > the tomcat memory to 500GB for 64bit application will it any > impact on tomcat operations You can only restrict the size of the various heaps. AFAIK, there is no way to restrict the amount of native memory that the JVM uses. > Tomcat Version : Tomcat 7.0.73 on Solaris 11 What JVM versions (32-bit and 64-bit)? - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJY8QnDAAoJEBzwKT+lPKRYRQ0QAMc2mdwMwRmdp5Nh/9S7cVKW 2hSW3/v3nXcm0hWb6aq9e5UN9EqHQYZYIAu+Oil7aMwzQhS1blf4AZzcA/Zt1Mos scinD9dNSsoAF+hdVz0zxyF/u/PpKiIQPgVuRJb12gZzDqvYcYHAph4U5T7bi89Y eqKA+imc3ShWy3u4STDuu9RUEUqHuMUZ7efH8cDByUnwuHPDPYEdwcb5CWvimkWr E15Z9JGNsaluUZfC6hD8cFbVtegoPGIjYRKqRY0bRXshJkGlFITk/W4m5wMDTvW7 Or9THmCgtgIPkd+hdCjqlJ4kjOe5eEGhW1Lk6UsQSEOItTx23+hUYQf6q6f+Y/2o jWJoj/I2xo7pC3YptwK0eB3kI5ABaTfFOMJZ2IO0Dzp3QkVWg7nvLN2YFOG1P8Hz 6s82xP4GArx/nghaPK4IYwn3KaBbG4DHQWtND2w97PwcuE2x8qrnZce2LrQX/1lH vwzK6wqyDWJ/jlJeZm18u+nKT7cBLLcF+KJVhrjXAuDGtRYVzSA0aqqePLScQYp+ pk2H4Qhn9+HU0FTw7sXC1lSQXpwukdigeFc3qLPAb68gGBAWWa5ywVXOqQ45XHpE 43Pp1AmU3EcUgz40ZXHr0Exfoa8afDRzx4mVjP+FY4bpy1jA7hca7OGMI62eAL63 g8+unU7dnSD9VTy/S9/q =dmc3 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Memory usage increased form 500MB to 4 GB after changing the tomcat process from 32 bit to 64 bit execution
On 14.04.2017 10:36, nagendra.r...@wipro.com wrote: Hi All, Problem statement: Memory usage increased form 500MB to 4 GB after changing the tomcat process from 32 bit to 64 bit execution As tomcat memory has increased it is impacting available memory for other applications on server o Is this a bug ? o Earlier with 32bit it was running around 400MG, If we restrict the tomcat memory to 500GB for 64bit application will it any impact on tomcat operations Tomcat Version : Tomcat 7.0.73 on Solaris 11 Maybe as a very first observation : it is not Tomcat that you changed. The Tomcat code has remained exactly the same. It is the Java JVM that was changed, from a 32-bit to a 64-bit version. So /that/ is the underlying reason for the memory usage increase, not Tomcat. Read more on the topic : http://lmgtfy.com/?q=java+32-bit+vs+64-bit (I recommend this one as a starter : http://howtodoinjava.com/for-fun-only/difference-between-32-bit-java-vs-64-bit-java/) Thus, to respond to your first question : no, it is no a bug; or at least not a Tomcat bug. About your second question : there is no such thing as a 64-bit application under Tomcat. All Tomcat applications are written in Java, and are ultimately run by the Java JVM. It is the JVM which determines if this uses, for example, 32-bit or 64-bit memory pointers, 4-byte or 8-byte object references etc. If you reduce the available memory for the Tomcat Heap, then, depending on the way the applications are written, this may cause more Memory Garbage Collections to occur in any given period of time. Whether this really impacts your applications or not, is something which only you can measure and determine. Try it, and look at the results. Or add more memory to your server. If you went from a 32-bit JVM to a 64-bit JVM, presumably you had a reason for doing that. Wat was the reason ? (And if there was no good reason, you can always go back). - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Memory Usage Differ for same TOMCAT5.5.23
karthikn wrote: Hi Please need this Information Memory Usage Differ for same TOMCAT5.5.23 on 32 / 64 bit Java Version ? None. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage Differ for same TOMCAT5.5.23
Hi java on UNIX by default starts in 32 bit mode to run java in 64 bit mode , java -d64 is specified so for TOMCAT on catalina.sh HOW TO for JAVA_HOME in 64 bit ? with regards Karthik Mark Thomas wrote: karthikn wrote: Hi Please need this Information Memory Usage Differ for same TOMCAT5.5.23 on 32 / 64 bit Java Version ? None. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory usage in Tomcat 6
9 out of 10 are the heap size problem. Changing the -Xmsnm and -Xmxnm in the tomcatw.exe if you are using Windows. On the 32-bit Windows, you can only allocate 1.2 GB max. If you still have problem, check all the static vars to see any objects are growing forever. If you still have problem, there must be some huge objects created from time to time. You need to use tool like figure it out. Billy Ng - Original Message - From: Tuan Quan [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Monday, June 16, 2008 9:11 AM Subject: Memory usage in Tomcat 6 Hi all, how do I adjust Memory allocation Tomcat 6, running as service in Windows? I ran into out of memory error. thanks. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory usage in Tomcat 6
From: Billy Ng [mailto:[EMAIL PROTECTED] Subject: Re: Memory usage in Tomcat 6 Changing the -Xmsnm and -Xmxnm in the tomcatw.exe That's tomcat6w.exe, not tomcatw.exe. If you still have problem, there must be some huge objects created from time to time. It can also be PermGen space (classes) that is full, rather than the normal heap. Other resource exhaustion (e.g., file handles) can also cause OOMEs on occasion. You need to use tool like figure it out. Yes, a profiler - or even JConsole - is very useful here. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory usage in Tomcat 6
From: Tuan Quan [mailto:[EMAIL PROTECTED] Subject: Memory usage in Tomcat 6 Hi all, how do I adjust Memory allocation Tomcat 6, running as service in Windows? Use the tomcat6w.exe program in Tomcat's bin directory. Read the FAQ for memory usage information: http://wiki.apache.org/tomcat/FAQ/Memory JConsole (part of the HotSpot JVM SDK) is a good tool for monitoring memory usage on the fly. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: memory usage of specific webapp with jmx
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Subject: memory usage of specific webapp with jmx I hope that I can also see the size of the web application without writing Java code. Nope, and probably not even by writing Java code. I think so because web application classes are loaded with WebClassLoader so the WebClassLoader can count memory size per application. No, because the predominant use of memory is objects allocated on the Java heap, which is shared by everything running in that JVM, regardless of what loaded it. You can remove all applications other than the one of interest, put a load on it with whatever testing tools you use, and watch the effect on the heap. You could also use a profiler to see where objects are being created, and try to tie that back to specific applications. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: memory usage increases on application stop
En l'instant précis du 11/01/08 09:34, Morten Matras s'exprimait en ces termes: Case: I've deployed an application on a Tomcat 6.0 (current release). The application is a Hibernate / Stripes application. Almost no memory is allocated due to the deployed application. Setting: -Xmx64m -XX:MaxPermSize=128m According to memory below, those settings are not take into account, or you wouldn't go over about 70M total space (java heap space of 64M max + jvm code of a few megs). Note that the PermSize is taken from the heap, so it should be lower than max heap size. Tomcat without application uses: 27,5M (real memory) and 349M (virtual memory) Tomcat with application uses: 133M (real memory) and 367M (Virtual memory) Now if I stop this application (using the manager) the memory profile becomes: Tomcat with stopped application: 128M (real memory) and 679M (virtual memory) So stopping the application increases the virtual memory usage from 367 to 679 m and stays there! The increase is probably due to specific code your application executes when it is stopped. It seems to do memory intesive things there :) You have to be aware a JVM memory never decrease in terms of system memory size. It can only grow up to the -Xmx size. (See sun's jvm docs for details). To get an idea of what memory size is really available for your jvm, you must check the values inside the jvm (use the system class, or a easy to use tool like lambda probe). If, even after a GC, memory is not release inside the java heap, then go check for memory leaks in your webapp. Undeploying a stopped application doesn't change the numbers. Why does stopping (or undeploying) a webapplication cause a dramatic increase in memory usage? My guesses: - Some ressources are not freed? (database connections) - Some hibernate related stuff are trapped in a circular relation circle? - Tomcat punishes me for stopping something it really liked :-) -- http://www.devlog.be (a belgian developer's logs) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: memory usage
From: Jordi Prats [mailto:[EMAIL PROTECTED] Subject: memory usage There's any way to identify witch application and witch class is getting to many memory? Read the FAQ: http://wiki.apache.org/tomcat/FAQ/Memory How can I get some statistics about tomcat's memory usage? The same way you would with any other Java program - JConsole is a good starting point, but you'll likely need a profiler. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: memory usage increases on application stop
From: David Delbecq [mailto:[EMAIL PROTECTED] Subject: Re: memory usage increases on application stop Note that the PermSize is taken from the heap, so it should be lower than max heap size. Not true in a HotSpot JVM; the heap and PermGen settings are independent. The virtual space for the heap and PermGen is allocated in one chunk, using the total of the sizes. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory usage problem
From: Christoph Sperle [mailto:[EMAIL PROTECTED] Subject: Memory usage problem As you can see, tomcat uses 138m, even though, it was start up with 64m restriction (-Xmx64m). You're confusing heap size (-Xmx) with total process space. The total process space includes many other things besides the JVM heap, such as code banks, stacks, internal JVM structures, OS-related structures, etc. Even so, 138M is pretty tiny, these days. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory usage problem
Thank you Chuck, you are right. But for me, that remains a big problem (and I read about it many times in VPS forums too): How to restrict the process size of tomcat? If I stop tomcat and measure the free memory (on a VPS that's not easy at all, see http://www.webhostingtalk.com/showpost.php?p=4851698postcount=6): Used memory = 86m After I started tomcat (with my single webapp and heap restricted to 64m): Used memory = 365m That's 280m - more as four times of the heap size restriction! I never saw this behavior at any other java program. Do you have a hint to restrict/reduce the overall process memory tomcat uses. Thanks Christoph -Original Message- From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 19. Dezember 2007 15:42 To: Tomcat Users List Subject: RE: Memory usage problem From: Christoph Sperle [mailto:[EMAIL PROTECTED] Subject: Memory usage problem As you can see, tomcat uses 138m, even though, it was start up with 64m restriction (-Xmx64m). You're confusing heap size (-Xmx) with total process space. The total process space includes many other things besides the JVM heap, such as code banks, stacks, internal JVM structures, OS-related structures, etc. Even so, 138M is pretty tiny, these days. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory usage problem
From: Christoph Sperle [mailto:[EMAIL PROTECTED] Subject: RE: Memory usage problem Do you have a hint to restrict/reduce the overall process memory tomcat uses. 1) Eliminate unnecessary items in server.xml (e.g., unused connectors). 2) Reduce the number of threads configured for each connector. 3) Don't deploy any unnecessary webapps (eats up file descriptors). 4) Package webapp classes into as few jars as possible (more file descriptors). 5) Insure the applications aren't opening files or starting auxiliary threads unnecessarily. Don't know how much any of the above will help, since the impact is very dependent on the particular OS you're using and how efficient it is at conserving resources. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory usage with multiple instances of tomcat
Thank you Chuck and Chris for your help and advice. I will definitely be reading your refs Chris Regards Peter - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory usage with multiple instances of tomcat
Thanks Chuck, I am using a 64-bit versions of the OS and JVM and I was confusing virtual memory with RAM. I have 8 GB of RAM and a 80 GB disc. The commands -Xms3g -Xmx3g will set the min/max heap to 3 GB,please how do I set the RAM for each instance of Tomcat5.5 to 2 GB Regards Peter From: Peter Sparkes [mailto:[EMAIL PROTECTED] Subject: Memory usage with multiple instances of tomcat 1. Does each tomcat instance use a separate 2 GB of memory, ie the 3 instance use 6 GB between them ? 2. or do they potentially share they same memory? Don't confuse virtual memory with RAM. The heap allocations are virtual, so there is no physical relationship with the amount of RAM you have. (There are performance considerations, of course, in that if you significantly oversubscribe RAM, you may suffer from excessive paging.) One thing you've failed to mention is whether you're using 32- or 64-bit versions of the OS and JVM. If 32-bit, then process virtual space is typically limited to 2 GB, and the heap, code, and supporting libraries must fit within that - you won't be able to allocate all 2 GB to the heap. If you're running a 64-bit environment, the sky's the limit (almost), and you could make each heap 256 GB, even with only 8 GB of RAM (not recommended, due to aforementioned paging concerns). Since each Tomcat runs as a separate process, there is no active sharing of either heap or code across instances. However, if you're running a client version of a current HotSpot JVM, there is some sharing of loaded classes in the PermGen (other than static fields), primarily to reduce startup time. You can see the shared amount in the Memory tab of JConsole. There is not currently any sharing in the server version of the HotSpot JVM. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory usage with multiple instances of tomcat
From: Peter Sparkes [mailto:[EMAIL PROTECTED] Subject: Re: Memory usage with multiple instances of tomcat The commands -Xms3g -Xmx3g will set the min/max heap to 3 GB, please how do I set the RAM for each instance of Tomcat5.5 to 2 GB You can't set the amount of RAM for any process - the OS decides which processes get how much RAM out of the total available. Unfortunately, Linux isn't particularly good at optimizing paging, so you're best to keep the aggregate of virtual space allocations under the total RAM. With three instances of Tomcat running, each with 3 GB heaps, you run the risk of excessive paging if all the heaps get close to full at the same time. You might want to reduce the -Xms and -Xmx settings to something like 2512m. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory usage with multiple instances of tomcat
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter, 1. Does each tomcat instance use a separate 2 GB of memory, ie the 3 instance use 6 GB between them ? Each instance gets a separate, 2GB heap space. 2. or do they potentially share they same memory? Since Java 1.5, shared archive capability is available on Sun's JVM. This basically means that the core JVM stuff can be memory-mapped and thus shared between processes, so you actually get a benefit when you run multiple simultaneous JVMs. See: http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html#vm_classdatashare http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html These pages cover this capability if you re interested in reading all about it. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGt1nW9CaO5/Lv0PARAlFHAJ4q/MBMWrYMUBJTeu3/RPyzU1b1AQCfe8SJ AMWfHzrgP0dAKeifLPxQ4Bw= =5Dw/ -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory usage with multiple instances of tomcat
You'll need to allocate 2GB to each Tomcat instance. As long as you use the standard Tomcat startup scripts each Tomcat instance will run in a separate JVM (you'd have to be pretty deliberate about making it run any other way). Regards, Adrian Sutton http://www.symphonious.net On 04/08/2007, at 4:16 PM, Peter Sparkes wrote: Hi, I followed the Tomcat with 8 GB memory thread but did not find the answer to the following question: I am setting up a Linux server with 8 GB memory which will be running 3 instances of tomcat 5,5; when I allocate memory to java, say 2GB: 1. Does each tomcat instance use a separate 2 GB of memory, ie the 3 instance use 6 GB between them ? 2. or do they potentially share they same memory? In other words with the 6GB I want to share between the 3 separate Tomcat instances do I allocate the whole 6GB to Java or 2GB Thank you Peter Sparkes - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory usage with multiple instances of tomcat
Thanks Adrian Regards Peter You'll need to allocate 2GB to each Tomcat instance. As long as you use the standard Tomcat startup scripts each Tomcat instance will run in a separate JVM (you'd have to be pretty deliberate about making it run any other way). Regards, Adrian Sutton http://www.symphonious.net On 04/08/2007, at 4:16 PM, Peter Sparkes wrote: Hi, I followed the Tomcat with 8 GB memory thread but did not find the answer to the following question: I am setting up a Linux server with 8 GB memory which will be running 3 instances of tomcat 5,5; when I allocate memory to java, say 2GB: 1. Does each tomcat instance use a separate 2 GB of memory, ie the 3 instance use 6 GB between them ? 2. or do they potentially share they same memory? In other words with the 6GB I want to share between the 3 separate Tomcat instances do I allocate the whole 6GB to Java or 2GB Thank you Peter Sparkes - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory usage with multiple instances of tomcat
From: Peter Sparkes [mailto:[EMAIL PROTECTED] Subject: Memory usage with multiple instances of tomcat 1. Does each tomcat instance use a separate 2 GB of memory, ie the 3 instance use 6 GB between them ? 2. or do they potentially share they same memory? Don't confuse virtual memory with RAM. The heap allocations are virtual, so there is no physical relationship with the amount of RAM you have. (There are performance considerations, of course, in that if you significantly oversubscribe RAM, you may suffer from excessive paging.) One thing you've failed to mention is whether you're using 32- or 64-bit versions of the OS and JVM. If 32-bit, then process virtual space is typically limited to 2 GB, and the heap, code, and supporting libraries must fit within that - you won't be able to allocate all 2 GB to the heap. If you're running a 64-bit environment, the sky's the limit (almost), and you could make each heap 256 GB, even with only 8 GB of RAM (not recommended, due to aforementioned paging concerns). Since each Tomcat runs as a separate process, there is no active sharing of either heap or code across instances. However, if you're running a client version of a current HotSpot JVM, there is some sharing of loaded classes in the PermGen (other than static fields), primarily to reduce startup time. You can see the shared amount in the Memory tab of JConsole. There is not currently any sharing in the server version of the HotSpot JVM. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
See, tomcat doesn't create a thread per request. It uses one from the pool and after doing its job the thread returns to the pool. What might be happening in your case is that those threads are not going back to the pool after processing the request. So you will need to find out where those threads are getting blocked and then take care of that. Best way to go about that is to take a thread dump. That will tell you exactly where in your code your threads are getting blocked and it should be pretty straight forward after that. About memory, my best guess is that since the thread is blocked, its still referencing objects that it shouldn't otherwise, hence jump in memory usage per request. You fix first problem and the second one should take care of itself. On 11/22/06, Daniel L. Gross [EMAIL PROTECTED] wrote: I appreciate your help with this problem. I downloaded JProfiler and ran it on tomcat 5.5.20. The garbage collection is running fine. Memory keeps going up when I make and break connections to the database. What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I think if I could clear up the inactive threads, the garbage collection routine would get the memory back. Is there any way to release inactive threads in Tomcat 5.5? Thanks again so much, -- Dan. Gaurav Singh Kushwaha http://www.chakpak.com Ph: +91-9880101496 Bangalore, India.
Re: Memory Usage
I looked at the profiler and it appears that there are many timer threads left hanging. I have not set up a data source for Tomcat or any connection pooling. I am opening a connection to the database directly with the following code. Could this be causing my problem? thanks again, Dan public M5Connection(String DBHost, String DBName, String DBUsername, String DBPassword) throws SQLException { //setup the DB connectivity paramters DATABASE_HOST = DBHost; DATABASE_NAME = DBName; DATABASE_USERNAME = DBUsername; DATABASE_PASSWORD = DBPassword; loadDBDriver(); //load the JDBC driver class into memory at runtime connect(); //connect to the database using the above driver } // constructor public Connection getConnection() { return conn; } //used to load the DB Driver into memory at runtime private void loadDBDriver() { // The newInstance() call is a work around for some // mm.MySQL implementations try { Class.forName(com.mysql.jdbc.Driver).newInstance(); System.out.println(Driver instantiated); //debug } catch (Exception E) { System.err.println(Unable to load driver.); E.printStackTrace(); } } //connects to a database private void connect() throws SQLException { conn = DriverManager.getConnection(jdbc:mysql:// + DATABASE_HOST + / + DATABASE_NAME + ?user= + DATABASE_USERNAME + password= + DATABASE_PASSWORD); System.out.println(Connection made); //debug } Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I seriously doubt that Tomcat is doing this - much more likely that your app is causing it, or possibly the DB driver. Does the app create any auxiliary threads and not have them terminate? If that's not the case, and threads from Tomcat's pool were not returning to it after processing a request for your app, you'd run out of threads pretty quickly. What does a thread dump show about where these hanging threads are hanging out? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory Usage
From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I looked at the profiler and it appears that there are many timer threads left hanging. What do you mean by timer threads? What does a thread dump show about them? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
As an additional note: I put up a simple test servlet that prints to the screen and it does not leave any threads hanging nor does it have a memory problem so it is definately something connected to how I use the J-Connector or open and close the database. The problem only occurs when I make a connection to the database. If this helps any. Thanks again. I really need to solve this problem because it's a show stopper for my application. -- Dan Daniel L. Gross wrote: I looked at the profiler and it appears that there are many timer threads left hanging. I have not set up a data source for Tomcat or any connection pooling. I am opening a connection to the database directly with the following code. Could this be causing my problem? thanks again, Dan public M5Connection(String DBHost, String DBName, String DBUsername, String DBPassword) throws SQLException { //setup the DB connectivity paramters DATABASE_HOST = DBHost; DATABASE_NAME = DBName; DATABASE_USERNAME = DBUsername; DATABASE_PASSWORD = DBPassword; loadDBDriver(); //load the JDBC driver class into memory at runtime connect(); //connect to the database using the above driver } // constructor public Connection getConnection() { return conn; } //used to load the DB Driver into memory at runtime private void loadDBDriver() { // The newInstance() call is a work around for some // mm.MySQL implementations try { Class.forName(com.mysql.jdbc.Driver).newInstance(); System.out.println(Driver instantiated); //debug } catch (Exception E) { System.err.println(Unable to load driver.); E.printStackTrace(); } } //connects to a database private void connect() throws SQLException { conn = DriverManager.getConnection(jdbc:mysql:// + DATABASE_HOST + / + DATABASE_NAME + ?user= + DATABASE_USERNAME + password= + DATABASE_PASSWORD); System.out.println(Connection made); //debug } Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I seriously doubt that Tomcat is doing this - much more likely that your app is causing it, or possibly the DB driver. Does the app create any auxiliary threads and not have them terminate? If that's not the case, and threads from Tomcat's pool were not returning to it after processing a request for your app, you'd run out of threads pretty quickly. What does a thread dump show about where these hanging threads are hanging out? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
How to I dump the threads, there doesn't seem to be an option in the Profiler. The tomcat start/stop manager has a dump threads option, it doesn't seem to do anything when I click it. Here's some additional information from the profiler. It's a stack trace of the Timer-0 thread: java.sql.DriverManager.getConnection(java.lang.String) M5Classes.M5Connection.connect() M5Classes.M5Connection init(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) _jprofiler_annotation_class.URL:/Tracks/servlet/Router() org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run() I think we have found the problem. Every time I make a connection, it leaves one of these threads hanging. Now whats the solution? That's the $50. question. Thanks, Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I looked at the profiler and it appears that there are many timer threads left hanging. What do you mean by timer threads? What does a thread dump show about them? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory Usage
From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage The tomcat start/stop manager has a dump threads option, it doesn't seem to do anything when I click it. Start Tomcat using catalina run, and then do whatever your OS needs to send an interrupt (ctrl-break on Windows). Here's some additional information from the profiler. It's a stack trace of the Timer-0 thread: java.sql.DriverManager.getConnection(java.lang.String) M5Classes.M5Connection.connect() This shows it's trying to connect to the server; what's the DB connection timeout value? Infinite, by any chance? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
In MySql the timeout is 10 seconds. I have tried various times in the tomcat configuration file, but nothing seems to matter. -- Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage The tomcat start/stop manager has a dump threads option, it doesn't seem to do anything when I click it. Start Tomcat using catalina run, and then do whatever your OS needs to send an interrupt (ctrl-break on Windows). Here's some additional information from the profiler. It's a stack trace of the Timer-0 thread: java.sql.DriverManager.getConnection(java.lang.String) M5Classes.M5Connection.connect() This shows it's trying to connect to the server; what's the DB connection timeout value? Infinite, by any chance? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory Usage
From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have tried various times in the tomcat configuration file, but nothing seems to matter. This isn't a Tomcat configuration value - it's for the specific JDBC driver that your app is using. Might want to check the doc for that to see if anything interesting can be found. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
About thread dump: When you are using Tomcat Manager to dump threads, it might be doing that in your catalina.out file. So check that file after dumping. About timer threads: When you stop Tomcat, it waits for all the non-daemon threads to finish execution before proceeding with normal shutdown. Since your timer threads are not daemon threads and those threads don't even die a natural death, Tomcat can not shut your application down. One option for you is to declare your timer task to be a Daemon thread but then it will be killed even if it is in middle of performing the task so its not advisable. On 11/22/06, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have tried various times in the tomcat configuration file, but nothing seems to matter. This isn't a Tomcat configuration value - it's for the specific JDBC driver that your app is using. Might want to check the doc for that to see if anything interesting can be found. - Chuck Gaurav Singh Kushwaha http://www.chakpak.com Ph: +91-9880101496 Bangalore, India.
Re: Memory Usage
It appears to be running garbage collection, but it doesn't recover all the memory, so as we make and break connections to the database, the memory usage just keeps piling up. We never had this problem with the old connector running under Tomcat 4. Thanks, Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
I appreciate your help with this problem. I downloaded JProfiler and ran it on tomcat 5.5.20. The garbage collection is running fine. Memory keeps going up when I make and break connections to the database. What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I think if I could clear up the inactive threads, the garbage collection routine would get the memory back. Is there any way to release inactive threads in Tomcat 5.5? Thanks again so much, -- Dan. Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
Is there a way to force Tomcat 5.5 to run a garbage collection? Thanks, Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dan, Daniel L. Gross wrote: It appears to be running garbage collection, but it doesn't recover all the memory, so as we make and break connections to the database, the memory usage just keeps piling up. We never had this problem with the old connector running under Tomcat 4. So, what changed between TC 4 and TC 5? You mentioned the old connector... Have you tried running your test app on TC 4 to see if it behaves appropriately? Make sure you aren't running different versions of any libraries (other than the ones shipped with TC). So, for instance, make sure you are always using the same version of the Connector/J library. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFY3bK9CaO5/Lv0PARApNrAKC20iiaCPDvdFXgOhg9CvI+G/DxZQCfX/VP R1QUaLWS0gfUY63fM4RSCPk= =6Xdh -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
I would say you are barking on a wrong tree in suspecting the garbage collector to be the culprit. Garbage collection not running in time(or in proper intervals) can cause the applicatin to slow down or have spikes in the performance but it will not cause the applicaiton to stop. Lets try to list out the possible scenarios: 1. You have a memory leak and thus you are losing memory every time you invoke the servlet. In this case, you should end up with an OutOfMemoryException. 2. Your servlets are not going back to the servlet pool and hence tomcat has starting to queue up the further requests. In this case, it will appear as if Tomcat has stopped responding. Check the state of your server queue to see if you have requests waiting there. 3. You have a deadlock in your code. Take the thread dump and see if there is one. As for garbage collector, you can use System.gc() but even that doesn't ensure that the garbage collector will be invoked. Better option usually is to tune the GC parameters but all that helps is with the performance. If you have a memory leak, even invoking GC won't help. On 11/22/06, Daniel L. Gross [EMAIL PROTECTED] wrote: Is there a way to force Tomcat 5.5 to run a garbage collection? Thanks, Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Gaurav Singh Kushwaha http://www.chakpak.com Ph: +91-9880101496 Bangalore, India.
RE: Memory Usage
From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Memory Usage I made a simple servlet that just opens a connection to my MYSQL database and then closes it and does nothing else. When I look at the windows task manager, the memory usage of Tomcat jumps each time I run the servlet. The memory is never recovered. The Task Manager is not a substitute for a profiler, which is what you really need to look at. Search the archives or Google to find one to your liking. Also try turning on -verbose:gc, just to see if a garbage collection ever occurs; until a GC does happen, unused object space won't be made available for reuse. Also, the JVM almost never gives memory back to the OS, so what you're seeing is not surprising. As far as your production problem, you most likely have a memory leak in your application(s). A profiler should help uncover that. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory Usage
From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Memory Usage
From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I seriously doubt that Tomcat is doing this - much more likely that your app is causing it, or possibly the DB driver. Does the app create any auxiliary threads and not have them terminate? If that's not the case, and threads from Tomcat's pool were not returning to it after processing a request for your app, you'd run out of threads pretty quickly. What does a thread dump show about where these hanging threads are hanging out? - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]