Hash: SHA256


On 8/14/19 23:44, Jerry Malcolm wrote:
> I was able to use a global resource and put a <ResourceLink> in
> the default context file for each host.

That will work, but you will have to restart Tomcat to make any
changes to the <Resource>. It's not a great solution. The same was
true for using global context.xml as well. The best option is to put
everything in each application's private context.xml file if you can
pull it off.

Back to your math:

> However, I don't think I want a different datasource for every web
>  app.  Each webapp could need, say, 100 concurrent connections at
> any one instant.  But if there are 10 web apps, if I set all 10 to
> have a max of 100 in order to handle the worst case scenario, then
> I'll need to have at least 1000 connections available on the
> database.

Your math is correct: even a small number of per-application
connections can add up to many total. But do you really want one
application to starve another of connections? You might have
per-client applications, and if one client uses lots of connections,
the other clients will suffer stalls. (Ignoring database performance
issues which are certainly present regardless of the details of

Just remember that you will have to restart ALL of the applications in
the JVM in order to make a change to the global <Resource>. If you
specify the configuration in an app-private context.xml, you can
bounce the one application to get the new configuration.

> One last question...  is there a way to determine the high-water
> mark for the most active connections at any one instant?  And along
> with that, the max number of requests waiting at any one point if
> all connections are in use?  If I have way over-allocated maxTotal,
> I'd like to know that.   And likewise, if I've under-allocated
> maxTotal and often have a bunch of requests waiting, I'd like to
> know that as well.  Is there a way to track that?  I looked at the
> MBean data in JConsole, and nothing obvious jumped out at me.

Tomcat doesn't have anything built-in for this: you'll need some
external tools. Have a look at this one:


This is the tool I use to monitor various things through the jmxproxy.
It's a Perl script that connects and pulls various data. It can append
to a file if you use the "--append" argument with a filename. (I see
that it's not documented... time to fix that!). Like this:

jmxproxy --append /file/to/append

And you'll get a file that looks like this after a while:
2019-08-16 00:08:23 112
2019-08-16 00:13:23 113
2019-08-16 00:18:23 108
2019-08-16 00:23:23 114
2019-08-16 00:28:23 114

I really should fix that so it prints out in proper ISO-8601 date
format including 'T' and time zone indicator, but I haven't done it. :)

Anyhow, if you use that, you can observe your data over time, and
graphing the data will show high-water marks quite obviously.

Hope that helps,
- -chris
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/


To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to