Check Used Wars on Tomcat 7

Hello all,
since on our production we have multiple Wars deployed, the performance of the overall website result being very slow and on random restarts,
is there any way to check which ones are the WARs used, so we can undeploy the other unused WARs to gain some performance?
Thanks you.

How much WARs do you have deployed, and how did you figure out that that is the source of your performance issues?

Sei ton

Greenhorn

Posts: 4

posted 1 month ago

Stephan van Hulst wrote:How much WARs do you have deployed, and how did you figure out that that is the source of your performance issues?

Hello Stephan,
we have 70 Wars deployed, and we're sure that most of them are not being used at all, i just need to clean up the unused Wars, so i can make a better analysis,
we figured out that the performance is superfast to everything at the start up, the website responds great (the login process takes 10-15 second or so), but after 5 min or so just to login takes 2 minutes or so.

If a WAR is deployed in Tomcat, it is "used". What you really need to know is how many webapps are being used. A webapp is not the same thing as a WAR, since you can use the same WAR for multiple instances of a webapp. You might do that, for example, if you are running a multi-client webserver and you want to keep the clients' usage of the webapps totally isolated.

It's fairly easy to track what webapps are being used. Every webapp is deployed with a context path, and by activating the Tomcat request logging Valve, you can see the URLs as they come in and examine the logs for context paths. If a WAR is not being used, the context path(s) it was deployed under will see no URL requests.

This isn't foolproof. Some apps might only be used at month- or year- end. Some might be used even more infrequently. So the best approach would be to setup a secondary server, move the unreferenced webapps over there and leave the primary server for the active stuff.

You might also want to measure some stats on those apps and do some load balancing while you're at it. There's no law that says a single instance of a Tomcat server has to contain everything. You can balance by app and/or balance by Tomcat cluster.

When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.

Sei ton

Greenhorn

Posts: 4

posted 1 month ago

Tim Holloway wrote: It's fairly easy to track what webapps are being used. Every webapp is deployed with a context path, and by activating the Tomcat request logging Valve, you can see the URLs as they come in and examine the logs for context paths. If a WAR is not being used, the context path(s) it was deployed under will see no URL requests.
.

Hello Tim,
you talking about this configuration?

So on the log file i should get any request if used that is referred to the name of the War/Webapp deployed?

Sei ton wrote: So on the log file i should get any request if used that is referred to the name of the War/Webapp deployed?

No, I don't think so. I believe that this Valve is invoked before the URL gets sent to a webapp, so the WAR isn't directly known yet.

But since the context path part of the URL does determine which WAR will ultimately be used, you can record the incoming URL context paths and use them to determine what WARs are being invoked.

You can determine what context path has been assigned to which WAR(s) by looking at how the WARs were deployed into Tomcat. This can be done by manual inspection, but with that many WARs, I'd use one of the Tomcat management interfaces to automate the process of generating the context-to-WAR map.

When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.

Sei ton

Greenhorn

Posts: 4

posted 1 month ago

Tim Holloway wrote: You can determine what context path has been assigned to which WAR(s) by looking at how the WARs were deployed into Tomcat. This can be done by manual inspection, but with that many WARs, I'd use one of the Tomcat management interfaces to automate the process of generating the context-to-WAR map.

Read the Tomcat instructions. There's a management webapp, that's installed by default in many Tomcat distros. There are management web services. There's MBeans, I believe. And several other APIs, depending on which version and configuration of Tomcat you're using.

When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.