Nginx – Tomcat and nginx sizing

nginxreverse-proxysizingtomcat

I manage an application that is deployed on Tomcat servers, with nginx in front, as a reverse proxy. I need some help for the sizing of thread pools / connection pools / … I find quite a lot of documentation describing the different parameters (Tomcat executors, nginx workers, keepalive, …) but not much documentation explaining how to find the right sizing. And I'm not sure that I understand correctly the documentation.

For example, I see in my nginx monitoring graphs that I have around 350 active connections, 30 writing connections and 320 waiting connections. I have about 30 requests per seconds.

I have 200 threads configured on the Tomcat server to handle HTTP processing.

I have 1 worker process on nginx with 1024 worker connections.

From what I understand from the docs, the waiting connections are HTTP1.1 keepalive. But I also understand that nginx only does HTTP1.0 as a proxy. I am a bit puzzled. Are those waiting connections consuming Tomcat threads doing just nothing ?

Do you know of a good resource about sizing Tomcat / nginx (or another reverse proxy, the concepts should be the same).

Thanks for your help!

Best Answer

1 worker process on nginx with 1024 worker connections.

So you cannot handle more than 1*1024 connections and nginx cannot use more than 1 processor core.

But I also understand that nginx only does HTTP1.0 as a proxy.

Wrong. See: http://nginx.org/r/proxy_http_version

Are those waiting connections consuming Tomcat threads doing just nothing

No. It's keepalive connections with clients. Also it may include keepalive connections to backends, but no more than you set up by the keepalive directive ( http://nginx.org/r/keepalive ).