You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jerry Malcolm <te...@malcolms.com> on 2021/06/21 18:54:59 UTC
DB Max Connections with Auto-Scaling Group
I have a TC instance running on an EC2 in an AWS Autoscaling group. I
have a database with 500 max connections. The default EC2 count is 2
instances in the autoscaling group. I guess that means that I should
set the Tomcat resource config for this datasource to be maxTotal = 250,
so if both instances max out we never exceed the 500 db max. But sooner
or later, the auto-scaling group is going to add a third and maybe a
fourth instance at some crunch time, all still talking to the same
database. Now we have a maxTotal combined of 1000 connections talking
to a database that can handle 500 which seems to be a recipe for
disaster. Yet I want to utilize all 500 available connections when I
have one two EC2 instances running.
Is there something I can do inside TC to rebalance the maxTotal
connections available to each TC instance as instances are added and
removed?
Other suggestions?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DB Max Connections with Auto-Scaling Group
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Jerry,
On 6/21/21 14:54, Jerry Malcolm wrote:
> I have a TC instance running on an EC2 in an AWS Autoscaling group. I
> have a database with 500 max connections. The default EC2 count is 2
> instances in the autoscaling group. I guess that means that I should
> set the Tomcat resource config for this datasource to be maxTotal = 250,
> so if both instances max out we never exceed the 500 db max. But sooner
> or later, the auto-scaling group is going to add a third and maybe a
> fourth instance at some crunch time, all still talking to the same
> database. Now we have a maxTotal combined of 1000 connections talking
> to a database that can handle 500 which seems to be a recipe for
> disaster. Yet I want to utilize all 500 available connections when I
> have one two EC2 instances running.
>
> Is there something I can do inside TC to rebalance the maxTotal
> connections available to each TC instance as instances are added and
> removed?
>
> Other suggestions?
You may be surprised at how few connections per node you can get away
with. At $work, we usually have ~500 users per Tomcat node and they are
each sharing a connection pool with maxTotal=20. Maybe you need more,
but you might want to "work forward" from what you actually need on each
node, rather than "working backward" from your database's limits.
Thanks,
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org