I am using embedded jetty as a Java application server, with maximum JVM memory set to 800MB. I created a method to deploy and un-deploy web archives. Every time I deploy a war with a basic hello world application the embedded application server uses approximately 200MB additional memory which causes an out of memory after I add the 4th web app. Is this the expected behaviour for embedded Jetty when used as an application server?
@ManagedOperation
public boolean deployWebApp(String context, String pathToWar){
boolean success = false;
WebAppContext webctx = null;
try{
webctx = addWebApp(context, pathToWar);
webctx.getTempDirectory();
webctx.start();
success = webctx.isRunning();
} catch (Exception e) {
e.printStackTrace();
logger.log(Level.SEVERE, "Failed to startup webapp with webappcontext: ", webapps.get(context).getContextPath());
}
return success;
}
No, I use embedded Jetty and it doesn't use anything like that amount of memory.
The best thing to do is create a heap dump and then use a tool like the Eclipse Memory Analyzer to analyse the heap and see what it is about the web apps that are consuming so much memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With