Reputation: 883
I'm looking for a runtime solution for finding memory usage of web apps. I'm providing a framework that includes tomcat on which different clients deploys several web apps. sometimes one of them consumes a lot of memory, thus crushing the entire process. I would like to have a manager web app (like the tomcat's manager) that will detect this and maybe undeploy \ re-deploy the problematic webapp. another solution (I don't think it's possible) is to allocate a slice of the heap to each web app separately.
Demanding the clients to change the existing web apps is possible, but I'd rather not to.
any thoughts?
Upvotes: 2
Views: 1381
Reputation: 11715
You can't intercept the allocations in each webapp, and there are no callbacks from the garbage collector, so you can't know how much memory each webapp uses. I think you're better off deploying several Tomcat instances, so that one "rogue" webapp does not kill all the others (up to one Tomcat per webapp, but you can also create groups to limit the number of instances, depending on the criticity of your different applications).
Upvotes: 3
Reputation: 19185
Tomact runs as single java process so it is hard to allocate memory per application. You can increase MaxPermSize,-Xmx only.
You can check leak detector for Tomcat but it will hardly help since you can not change source code of other apps.
Upvotes: 1
Reputation: 20063
I think what you want to look at would be VisualVM, this will give you an overview of Tomcats memory usage in the JVM.
http://techblog.zabuchy.net/2012/monitoring-of-tomcat-with-visualvm-and-visualgc/
Upvotes: 0