RE: [EXT]Re: performance tunning of Tomcat 10

2024-03-27 Thread Rick Noel


Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Christopher Schultz  
Sent: Wednesday, March 27, 2024 8:24 AM
To: Tomcat Users List ; Rick Noel 

Cc: Voodoo nmulcahy gmail ; David Jung 

Subject: [EXT]Re: performance tunning of Tomcat 10

Rick,

On 3/27/24 07:53, Rick Noel wrote:
> I was wondering if the apache foundation has any tools we can use to 
> fine tune Tomcat 10. Tools to deteming how to set the best heap size 
> for Tomcat startup and the best connection attributes of 
> minSpareThreads and MaxThreads.
What is your goal?
Our application is a sip phone call handling application.(A voice response xml 
application)
The goal is to not have  call bottleneck at peak call volume.
Sometimes too many folks call at one time hit our app and calls are not handle 
correctly.

> I know my application at times will reach 100 concurrent connections
 > and some times goes has high as 500 connections.

Okay.
Well I do not have actual traffic info down to the sec,
But from the application logs I know that that points in the day more than 300 
calls can come in

> Should I boost minSpareThreads and maxThread values of what I plan to 
> use below? > Or why would we not just set very high minSpareThreads 
> and maxThread values like minSpareThreads =300  and maxThread=1000
>
> This is a snippet of my server.xml
>
>   minSpareThreads="50"
>maxThreads="300"/>
>
>   executor="tomcatPhoneAppThreadPool"
>   compression="on"
>   compressionMinSize="2048"
>   
> compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml"
>   protocol="org.apache.coyote.http11.Http11NioProtocol"
> redirectPort="8443">
>  className="org.apache.coyote.http2.Http2Protocol" />
>
>   
>
> Also, am I good with setting  
> protocol="org.apache.coyote.http11.Http11NioProtocol"
> And then setting  className="org.apache.coyote.http2.Http2Protocol" />
>
> That will tell Tomcat to do HTTP2 Correct?

That's the only way to enable h2. Well... you could use Http11Nio2Protocol, 
too. NIO is the default protocol so you don't even need to add that 
specifically if you don't want to.

Back to threads.

Each thread (unless you go virtual, but that's not really production-ready IMHO 
at this point unless you have very strict circumstances where it will work 
great for you) takes up a bunch of memory, so you can't just set maxThreads=1M. 
Threads take "time" to start, but it's not really that much. If starting and 
stopping threads is what is making your application slow, than you have a very 
high-performance application and environment indeed.

Your question as stated is unanswerable.

You say you are sometimes hitting 500 connections. The default maximum number 
of connections is 1 and you are only using 500. That means you aren't being 
flooded, which is a Good Thing. (BTW: How are you measuring "how many 
connections" you have? Make sure you are measuring the right thing...

I am estimating the actual connections just based on application call logs.

Is your *current* maxThreads set to 500? If so, then your thread pool maximum 
is set to your high-water mark which seems like it should be fine. If you set 
your maxThreads to 1000 you won't get any benefit because only 500 requests are 
ever being sent at once, right?

What else does your application do?
Our application is a sip phone call handling application.(A voice response xml 
application)

For example, if you have a thread-pool max-threads of 1000 and your application 
uses an RDBMS for every request but your db connection pool size is more like 
10, then many threads waiting on a small number of connections gets you 
absolutely no benefit. You'd have to make changes elsewhere in your application 
in order to make use of those extra threads.

Similarly, if you have a big thread pool and a big db connection pool, but your 
database performs slowly, then having all that power on the application server 
doesn't really help you.

Yes our app is using a database  (we use Postres)
And yes I assume that is our bottleneck
Our tomcat context.xml defines that database maxConnction to be only 
maxTotal="20"
We have other apps  and that hit this same database, so we define low maxTotal  
on each  server so each server can have only limit connection access to the 
database
I am thinkingit would be best to try and NOT optimize  minSpareThreads and 
maxThreads but instead to determine what is the optimal
Database  connection maxTotal to set

So anyone trying to answer "how big should be thread pool be" really needs to 
understand the nature of your application and the other things happening in 
your environment.

Sometimes the answer is "just add more 

Re: performance tunning of Tomcat 10

2024-03-27 Thread Christopher Schultz

Rick,

On 3/27/24 07:53, Rick Noel wrote:

I was wondering if the apache foundation has any tools we can use to
fine tune Tomcat 10. Tools to deteming how to set the best heap size
for Tomcat startup and the best connection attributes of
minSpareThreads and MaxThreads.

What is your goal?


I know my application at times will reach 100 concurrent connections

> and some times goes has high as 500 connections.

Okay.


Should I boost minSpareThreads and maxThread values of what I plan to
use below? >
Or why would we not just set very high minSpareThreads and maxThread values
like minSpareThreads =300  and maxThread=1000

This is a snippet of my server.xml



   


  

Also, am I good with setting  
protocol="org.apache.coyote.http11.Http11NioProtocol"
And then setting 

That will tell Tomcat to do HTTP2 Correct?


That's the only way to enable h2. Well... you could use 
Http11Nio2Protocol, too. NIO is the default protocol so you don't even 
need to add that specifically if you don't want to.


Back to threads.

Each thread (unless you go virtual, but that's not really 
production-ready IMHO at this point unless you have very strict 
circumstances where it will work great for you) takes up a bunch of 
memory, so you can't just set maxThreads=1M. Threads take "time" to 
start, but it's not really that much. If starting and stopping threads 
is what is making your application slow, than you have a very 
high-performance application and environment indeed.


Your question as stated is unanswerable.

You say you are sometimes hitting 500 connections. The default maximum 
number of connections is 1 and you are only using 500. That means 
you aren't being flooded, which is a Good Thing. (BTW: How are you 
measuring "how many connections" you have? Make sure you are measuring 
the right thing...


Is your *current* maxThreads set to 500? If so, then your thread pool 
maximum is set to your high-water mark which seems like it should be 
fine. If you set your maxThreads to 1000 you won't get any benefit 
because only 500 requests are ever being sent at once, right?


What else does your application do?

For example, if you have a thread-pool max-threads of 1000 and your 
application uses an RDBMS for every request but your db connection pool 
size is more like 10, then many threads waiting on a small number of 
connections gets you absolutely no benefit. You'd have to make changes 
elsewhere in your application in order to make use of those extra threads.


Similarly, if you have a big thread pool and a big db connection pool, 
but your database performs slowly, then having all that power on the 
application server doesn't really help you.


So anyone trying to answer "how big should be thread pool be" really 
needs to understand the nature of your application and the other things 
happening in your environment.


Sometimes the answer is "just add more threads/CPUs/memory" and 
sometimes the answer is "re-think your application architecture".


-chris

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



performance tunning of Tomcat 10

2024-03-27 Thread Rick Noel
Hello,

I was wondering if the apache foundation has any tools we can use to fine tune 
Tomcat 10.
Tools to deteming how to set the best heap size for Tomcat startup and the best 
connection attributes of minSpareThreads and MaxThreads.

I know my application at times will reach 100 concurrent connections and some 
times goes has high as 500 connections.
Should I boost minSpareThreads and maxThread values of what I plan to use below?

Or why would we not just set very high minSpareThreads and maxThread values
like minSpareThreads =300  and maxThread=1000

This is a snippet of my server.xml



  
   

 

Also, am I good with setting  
protocol="org.apache.coyote.http11.Http11NioProtocol"
And then setting 

That will tell Tomcat to do HTTP2 Correct?

Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com



Community Over Code NA 2024 Travel Assistance Applications now open!

2024-03-27 Thread Gavin McDonald
Hello to all users, contributors and Committers!

[ You are receiving this email as a subscriber to one or more ASF project
dev or user
  mailing lists and is not being sent to you directly. It is important that
we reach all of our
  users and contributors/committers so that they may get a chance to
benefit from this.
  We apologise in advance if this doesn't interest you but it is on topic
for the mailing
  lists of the Apache Software Foundation; and it is important please that
you do not
  mark this as spam in your email client. Thank You! ]

The Travel Assistance Committee (TAC) are pleased to announce that
travel assistance applications for Community over Code NA 2024 are now
open!

We will be supporting Community over Code NA, Denver Colorado in
October 7th to the 10th 2024.

TAC exists to help those that would like to attend Community over Code
events, but are unable to do so for financial reasons. For more info
on this years applications and qualifying criteria, please visit the
TAC website at < https://tac.apache.org/ >. Applications are already
open on https://tac-apply.apache.org/, so don't delay!

The Apache Travel Assistance Committee will only be accepting
applications from those people that are able to attend the full event.

Important: Applications close on Monday 6th May, 2024.

Applicants have until the the closing date above to submit their
applications (which should contain as much supporting material as
required to efficiently and accurately process their request), this
will enable TAC to announce successful applications shortly
afterwards.

As usual, TAC expects to deal with a range of applications from a
diverse range of backgrounds; therefore, we encourage (as always)
anyone thinking about sending in an application to do so ASAP.

For those that will need a Visa to enter the Country - we advise you apply
now so that you have enough time in case of interview delays. So do not
wait until you know if you have been accepted or not.

We look forward to greeting many of you in Denver, Colorado , October 2024!

Kind Regards,

Gavin

(On behalf of the Travel Assistance Committee)