# Setting of the connection limit of an individual server

**URL:** <https://www.ruby-forum.com/t/setting-of-the-connection-limit-of-an-individual-server/210016>\
**Category:** NGINX\
**Created:** [July 28, 2011, 2:14pm UTC](https://www.ruby-forum.com/t/setting-of-the-connection-limit-of-an-individual-server/210016 "2011-07-28T14:14:14Z")\
**Posts on this page:** 4\
**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:** [July 28, 2011, 2:14pm UTC](https://www.ruby-forum.com/t/setting-of-the-connection-limit-of-an-individual-server/210016/1 "2011-07-28T14:14:14Z")

</div>

Hi,this is Ichiro.  
When I used nginx as a load balancer, I want to set the connection limit  
of an individual server.

ex)---------------------------------------------  
upstream 192.168.1.1 {  
server 192.168.11.1:80; ← 100 conn/sec  
server 192.168.11.2:80; ← 100 conn/sec  
}

## total 200 conn/sec

It is not a connection limit of the entire VirtualServer[192.168.1.1],  
and I want to set it to an individual server[192.168.11.[1,2]].

Is such a setting possible?  
Would you teach this setting method?

Regards.

Posted at Nginx Forum:

> **[Setting of the connection limit of an individual server.](https://forum.nginx.org/read.php?2,213042,213042#msg-213042)**
>
> Hi,this is Ichiro. When I used nginx as a load balancer, I want to set the connection limit of an individual server. ex)--------------------------------------------- upstream 192.168.1.1 { server 192.168.11.1:80; \<- 100 conn/sec server 1

---

<div class="post-metadata">

**Author:** ![Ichiro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a183cd/32.png) [@Ichiro](https://www.ruby-forum.com/u/Ichiro)\
**Post date:** [July 28, 2011, 3:38pm UTC](https://www.ruby-forum.com/t/setting-of-the-connection-limit-of-an-individual-server/210016/2 "2011-07-28T15:38:31Z")

</div>

Hi!

You need a third party module ( [NGINX 3rd Party Modules | NGINX](http://wiki.nginx.org/3rdPartyModules) )  
such as EY Balancer: [http://github.com/ry/nginx-ey-balancer/tree/master](http://github.com/ry/nginx-ey-balancer/tree/master)

Posted at Nginx Forum:

> **[Re: Setting of the connection limit of an individual server.](https://forum.nginx.org/read.php?2,213042,213043#msg-213043)**
>
> Hi,this is Ichiro. When I used nginx as a load balancer, I want to set the connection limit of an individual server. ex)--------------------------------------------- upstream 192.168.1.1 { server 192.168.11.1:80; \<- 100 conn/sec server 1

---

<div class="post-metadata">

**Author:** ![Ichiro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a183cd/32.png) [@Ichiro](https://www.ruby-forum.com/u/Ichiro)\
**Post date:** [July 29, 2011, 2:54am UTC](https://www.ruby-forum.com/t/setting-of-the-connection-limit-of-an-individual-server/210016/3 "2011-07-29T02:54:13Z")

</div>

Hello Ensiferous.  
Thanks you!

I read explanation of EY Balancer, so understood that I just matched a  
purpose.  
I’m tring to install that soon!

Kind regards,  
Ichiro

Posted at Nginx Forum:

> **[Re: Setting of the connection limit of an individual server.](https://forum.nginx.org/read.php?2,213042,213058#msg-213058)**
>
> Hi,this is Ichiro. When I used nginx as a load balancer, I want to set the connection limit of an individual server. ex)--------------------------------------------- upstream 192.168.1.1 { server 192.168.11.1:80; \<- 100 conn/sec server 1

---

<div class="post-metadata">

**Author:** ![Ichiro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a183cd/32.png) [@Ichiro](https://www.ruby-forum.com/u/Ichiro)\
**Post date:** [August 3, 2011, 3:15am UTC](https://www.ruby-forum.com/t/setting-of-the-connection-limit-of-an-individual-server/210016/4 "2011-08-03T03:15:21Z")

</div>

Hi.  
This is Ichiro.

I installed EY Balancer Module.  
So I looked like to be finished this problem.  
This problem seemed to be over.

However, a problem occurred one more…

The queue beyond max\_connections is kept waiting forever.  
I tuned up ”max\_connections\_module.c", but behavior does not change.

Can you throw away connection beyond the “max\_connections” to  
sorry\_server?

ex)---------------------------------------------  
\*nginx.conf  
upstream 192.168.1.1 {  
server 192.168.11.1:80; \<- 1 conn/sec  
server 192.168.11.2:80; \<- 1 conn/sec  
max\_connections 1  
}

_max\_connections\_module.c  
if (conf == NULL) return NGX\_CONF\_ERROR;  
max\_connections\_rr\_index = 0;  
conf-\>max\_connections = 1;  
conf-\>max\_queue\_length = 10; /_ default max queue length 10000 _/  
conf-\>queue\_timeout = 10; /_ default queue timeout 10 seconds \*/  
return conf;
