tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Tomcat: one user per application
Date Mon, 10 Jun 2013 16:44:49 GMT
Hash: SHA256


On 6/10/13 11:56 AM, André Warnier wrote:
> Christopher Schultz wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> Mihamina,
>> On 6/10/13 7:12 AM, Mihamina Rakotomandimby wrote:
>>> I have one Tomcat instance, which has several applications 
>>> (containers)
>> Note: these are not "containers" (at least not in any
>> spec-recognized way). Tomcat is the container, the webapps are
>> called "contexts" -- or just webapps usually.
>>> On my installation, when Tomcat is running, only "java"
>>> process owned by "tomcat" is listed.
>>> When the "java" process gets 100% CPU, I would like to be able
>>> to differentiate which application is it about.
>> You can only do this by taking a series of thread-dumps (maybe 1
>> every 5 seconds for 15 or 20 seconds) and comparing them to each
>> other. You can probably find out which threads are doing a lot of
>> work (because they are running a lot of code over the time
>> period) and which applications are being used (because of the
>> content of the stack traces).
>> Of course, you have to have a way to detect "high" CPU usage
>> (100% probably isn't good enough) and then trigger these thread
>> dumps, etc.
>>> One solution, for me, is to be able to run one java process
>>> per war under a (pre-created) system user. I would like to keep
>>> only one Tomcat instance.
>> You can have one of these, but not both. You *can* have a single 
>> Tomcat /installation/ and multiple instances, of course (read
>> the RUNNING.txt file that comes with the Tomcat bundle under the 
>> "Advanced" section).
>> Remember: memory is cheap. It's not that costly to run multiple
>> Tomcat instances. Tomcat requires roughly 12MiB on my system
>> (64-bit with compressed OOPs) with no web applications deployed
>> into it.
> Alternatively, a "cheap" way of getting at least an idea of what 
> application is using a lot of time :
> In a first approximation, I would tend to believe that an
> application which uses a lot of CPU time, is also probably slow to
> respond (to the user). You could enable the Tomcat Access Log, and
> provide a format which prints to the log, the time needed to
> process each request. Then by examining the log, it should give you
> at least some idea of which application is taking such resources. 
> It is a very rough, and may give you false results. But it is also 
> easier and quicker than any other method which I can think of.


We have such "timing logs" enabled in production for all of our
applications. Periodically running them through a Perl script to run
statistical measurements on them and then graphing them allows us to
focus our optimization efforts where they are actually needed.

For example, one report takes each request (categorized by URI) and
plots a point where the range is the popularity of the request (like,
it represents 100,000 requests) and the value is the average response
time in ms. We have a 3rd axis (displayed as a circle surrounding the
aforementioned point: it's a "bubble chart") whose radius is
proportional to the standard deviation of all of the request times.

This simple graph easily enables us to look at popular, slow requests
and focus our attention there. We can also see which requests have
wildly-varying response times just by looking for "big dots".

We find this immensely useful even when we aren't looking for any
specific problem.

Hope that helps,
- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message