Nginx as remote proxy - limit number of concurrent connections?

I’m using nginx as a remote proxy server in front of a bunch of Tomcat
instances, and occasionally I’m running into a situation where all
available threads are used up in the Tomcat instances, which causes
various problems. Rather than trying to deal with these problems in that
layer, I was wondering about preventing the situation from arising by
limiting the number of concurrent connections to the upstream servers in
nginx. I’m not entirely sure how to do this, but I have no doubt it’s
doable. Suggestions, please!

I’m using nginx as a remote proxy server in front of a bunch of Tomcat
instances, and occasionally I’m running into a situation where all
available threads are used up in the Tomcat instances, which causes
various problems. Rather than trying to deal with these problems in that
layer, I was wondering about preventing the situation from arising by
limiting the number of concurrent connections to the upstream servers in
nginx. I’m not entirely sure how to do this, but I have no doubt it’s
doable. Suggestions, please!

Try this: http://nginx.localdomain.pl/wiki/UpstreamFair

with the weight_mode=peak option.

–appa