This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How much Heap Size is enough for Tomcat

 
Khosrow Moossavi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,

We're currently having a Private Tomcat (version 6.0.16) hosting package, which gives us plenty of control over server, tomcat. So basically we're happy. But after deploying almost each and every new Java Application to Tomcat, we have to purchase more Heap size, which is ok and reasonable on the other hand.

The question is How much Heap Memory Size per application we need? I know that the more, the better, but what is the minimum of it?
Applications are generally a typical struts/spring/hibernate integration. The current is 32 MB starting, 128 MB maximum, and 4 applications work perfectly fine, but for recently deployed 5th and 6th, sweet little PermGen is there, slap me in the face!

If there are more things I should tell in order for "an" answer or a better one, please tell me to find that out. I don't think of anything else right now.

Regards,
Khosrow.
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
before you deployed your application to tomcat, have you done any load tests? a good load test should give you some good estimate of memory usage.
 
Kees Jan Koster
JavaMonitor Support
Rancher
Posts: 251
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Khosrow,

The answer to your question is: that depends.

Make sure you monitor your heap size and permgen sizes. These are not the same, by the way. A bigger heap does not mean you have a bigger permgen.

Kees Jan
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Khosrow Moossavi wrote:The question is How much Heap Memory Size per application we need? I know that the more, the better, but what is the minimum of it?


"Too Big to Fail" doesn't work for heap memory size. Garbage collection could slow down the application, while cleaning large heap. There are plenty of information on web regarding JVM tuning. Keep in mind that you have to find guidelines for your particular JVM flavor.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18161
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garbage collection could slow down the application, while cleaning large heap.


Actually most JVMs these days run an incremental garbage collector instead of a "wait till it's full and then shut everything down while we GC".

But merely adding more resource demands to the server is enough to slow it down anyway. Then again, what use is an idle server?
 
Khosrow Moossavi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys for your answers.

Well I have not considering monitoring that much, because we were good both in Development and Deployment environment. But after this, I've installed Java-monitor and here is the Result about Heap, PermGen and GC:


java.lang:type=MemoryPool, name=PS Perm Gen
    Usage.used: 107 MiB and 588 KiB
    Usage.committed: 114 MiB and 256 KiB
    Usage.max: 128 MiB


java.lang:type=Memory
    NonHeapMemoryUsage.committed: 120 MiB and 384 KiB
    HeapMemoryUsage.used: 87 MiB and 667 KiB
    ObjectPendingFinalizationCount: 0
    NonHeapMemoryUsage.used: 113 MiB and 119 KiB
    NonHeapMemoryUsage.max: 176 MiB
    HeapMemoryUsage.max: 113 MiB and 832 KiB
    HeapMemoryUsage.committed: 109 MiB and 512 KiB


java.lang:type=GarbageCollector,name=PS MarkSweep
    CollectionCount: 4
    CollectionTime: 1 second and 426 milliseconds


java.lang:type=GarbageCollector,name=PS Scavenge
    CollectionCount: 77
    CollectionTime: 652 milliseconds +5


Well, to be honest I didn't google for these terms yet. But are we good or anything seems not working all right?
What Monitor Application should I use? There are plenty out there and I couldn't decide what is good, so I went for the one that is on Kees Jan's signature.

Regards,
Khosrow.
 
Kees Jan Koster
JavaMonitor Support
Rancher
Posts: 251
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Khosrow,

Welcome to Java-monitor. :-)

It is actually more useful to post the graphs, rather than the actual values. The graphs show how memory develops over time and the stats you posted are just a snapshot.

You will find a "post graph" button under each one. Please post the heap memory graph on Java-monitor and I'll help you there. :-)

Kees Jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic