# Calculating the max. clients by worker\_connections

**URL:** <https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649>\
**Category:** NGINX\
**Created:** [February 3, 2011, 4:53am UTC](https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649 "2011-02-03T04:53:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 3, 2011, 4:53am UTC](https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649/1 "2011-02-03T04:53:17Z")

</div>

In the wiki ([http://wiki.nginx.org/EventsModule#worker\_connections](http://wiki.nginx.org/EventsModule#worker_connections)), it  
said:

* * *

The worker\_connections and worker\_proceses from the main section  
allows you to calculate maxclients value:

max\_clients = worker\_processes \* worker\_connections

In a reverse proxy situation, max\_clients becomes

max\_clients = worker\_processes \* worker\_connections/4

Since a browser opens 2 connections by default to a serve…

---

<div class="post-metadata">

**Author:** ![mindel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc8723/32.png) [@mindel](https://www.ruby-forum.com/u/mindel)\
**Post date:** [February 3, 2011, 9:45am UTC](https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649/2 "2011-02-03T09:45:23Z")

</div>

I would say “and nginx uses the fds (file descriptors) from the same  
pool to  
connect to the upstream backen” (wiki quote). But that should be 2, not  
4: I  
agree with you on this.  
If any of the gurus out there could shed light on this, I’m sure a lot  
of us  
would appreciate.

Antoine.

----- Original Message ----

---

<div class="post-metadata">

**Author:** ![mindel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc8723/32.png) [@mindel](https://www.ruby-forum.com/u/mindel)\
**Post date:** [February 3, 2011, 5:40pm UTC](https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649/3 "2011-02-03T17:40:06Z")

</div>

In fact,

As normal web server, the maths would also be

max\_clients = worker\_processes \* worker\_connections / 2

since every browser opens 2 connections by default,

On Thu, Feb 3, 2011 at 4:43 PM, Antoine BONAVITA

---

<div class="post-metadata">

**Author:** ![mindel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc8723/32.png) [@mindel](https://www.ruby-forum.com/u/mindel)\
**Post date:** [February 3, 2011, 9:32pm UTC](https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649/4 "2011-02-03T21:32:09Z")

</div>

So, if you have 2 per browser, it’s normal to have 4 in reverse proxy.  
Basically, the reverse proxy uses one connection to the backend for each  
connection to the browser. And since all connections come from the same  
pool,  
the 4 makes sense.

A.

----- Original Message ----

> since every browser opens 2 connections by default,
> 
> On Thu, Feb 3, 2011 at 4:43 PM, Antoine BONAVITA  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I would say “and nginx uses the fds (file descriptors) from the same pool  
> > to  
> > connect to the upstream backen” (wiki quote). But that should be 2, not 4:  
> > I  
> > agree with you on this.  
> > If any of the gurus out there could shed light on this, I’m sure a lot of  
> > us

---

<div class="post-metadata">

**Author:** ![mindel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc8723/32.png) [@mindel](https://www.ruby-forum.com/u/mindel)\
**Post date:** [December 9, 2011, 5:53am UTC](https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649/5 "2011-12-09T05:53:17Z")

</div>

Hello

Finally we found both Outlook & Thunderbird uses 6 connections for 1  
client.  
So the formula can be :  
max\_clients = worker\_processes \* worker\_connections / 6  
for mail proxy .  
I don’t know if this should be described in the wiki page though…

Regards,  
Soichiro Miki

Posted at Nginx Forum:

> **[Re: Calculating the max. clients by worker\_connections](https://forum.nginx.org/read.php?2,171776,219814#msg-219814)**
>
> In the wiki (http://wiki.nginx.org/EventsModule#worker\_connections), it said: ----------------- The worker\_connections and worker\_proceses from the main section allows you to calculate maxclients value: max\_clients = worker\_processes \*...

---

<div class="post-metadata">

**Author:** ![mindel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc8723/32.png) [@mindel](https://www.ruby-forum.com/u/mindel)\
**Post date:** [November 7, 2011, 8:55am UTC](https://www.ruby-forum.com/t/calculating-the-max-clients-by-worker-connections/202649/6 "2011-11-07T08:55:40Z")

</div>

Hi,

Regarding max clients , I understand it’s normal to have 4 in reverse  
proxy  
since browser uses 2 connections in HTTP 1.1.  
How about mail reverse proxy?  
It seems POP command from telnet client uses 4 also, although I couldn’t  
find  
POP3 uses more than 1 connection in RFC 1939.

Regards,  
Soichiro

Posted at Nginx Forum:

> **[Re: Calculating the max. clients by worker\_connections](https://forum.nginx.org/read.php?2,171776,217904#msg-217904)**
>
> In the wiki (http://wiki.nginx.org/EventsModule#worker\_connections), it said: ----------------- The worker\_connections and worker\_proceses from the main section allows you to calculate maxclients value: max\_clients = worker\_processes \*...
