-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Eric,
(Late reply. Sorry.) On 2/17/12 11:41 PM, Robinson, Eric wrote: > Recently, we had someone tell us that a particular thread of one > particular Windows tomcat instance was freezing up due to lack of > memory. They insisted that we set that instance to -Xms512M > -Xmx512M. Wow, that's quite a jump. Obviously a "best practice" they read somewhere and are making you follow it blindly. Does this "someone" have any real power? Or, are they a contractor being brought-in to tell you that your team doesn't have a clue what it's doing? (In that case, whatever they say usually goes, unfortunately, because you are already considered wrong at the outset). > I felt that they were wrong because there were no OOM or GC > messages in the logs, but I wanted to make them happy, so I set it > to -Xms16M -Xmx512M because I felt that this would give them the > max memory they were requesting while also ensuring that the > instance did not use more memory than it really needed. It seemed > like a win-win. However, they were not happy. They insisted that we > set the minimum to 512M as well. That sounds a little foolish. The only reason to set Xms=Xmx is to avoid heap re-sizing at runtime. Unless there is a bug in the GC or memory manager, then there should only be performance differences in the way Xms=Xmx versus Xms<Xms behaves: the max heap size is still the same and the JVM won't trigger an OOME unless it's out of space (given Xmx as well as some other factors that aren't relevant to the heap, such as PermGen, stacks, etc.). If you aren't seeing OOMEs, then the problem probably isn't the heap size at all. Then again, you might not be seeing OOMEs because you're not looking in the right place. > My plan was to come onto the tomcat list and see if I could drum up > support for my thoughts, but I realize that I also risk being told > that I'm wrong. :-) We(*) usually recommend that Xms=Xmx to avoid heap re-sizing and maximize performance. I figure that if you're going to need the memory, you may as well ask for it up front. I'll have to do some more reading about the JVM returning memory to the OS after the heap shrinks: if the JVM does not return the memory, then your most-recent peak-heap-size will dictate the amount of memory your process controls until it it shut down. In that case, I would size the heap Xms=Xmx where both are set to your peak load expectation. - -chris * Well, me, and several others on this list. There is no "official" stance from either Apache or Tomcat. -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9D1kgACgkQ9CaO5/Lv0PAdAQCfUXd8AvfWAvWya7R8RlNMZjXX AEcAn1yp1eZZRycAH1cIAAeBCNHezjeV =kQ8j -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org