# One goal. 2 settings. Which one would you recommend?

**URL:** <https://www.ruby-forum.com/t/one-goal-2-settings-which-one-would-you-recommend/244926>\
**Category:** NGINX\
**Created:** [July 11, 2016, 6:34pm UTC](https://www.ruby-forum.com/t/one-goal-2-settings-which-one-would-you-recommend/244926 "2016-07-11T18:34:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [July 11, 2016, 6:34pm UTC](https://www.ruby-forum.com/t/one-goal-2-settings-which-one-would-you-recommend/244926/1 "2016-07-11T18:34:39Z")

</div>

Hi

I am debating what is a better setting between the 2 settings below.

Setting#1 and Setting#2 attempt to do the same task (flow control by  
controlling the IP sources).

Setting#1 uses one machine and Setting#2 uses 2 machines in a cascading  
manner.

Thank you for your help

1. Setting #1 1 machine with N CPU  
===========================

[…]

upstream dynamic {  
least\_conn;  
server XXX.XXX.XXX.XXX:9990;  
[…]  
keepalive 5;  
}

upstream locallayer {  
server 127.0.0.1:7999;  
keepalive 200;  
}

limit\_conn\_zone $binary\_remote\_addr zone=peripconn:100m;  
limit\_req\_zone $binary\_remote\_addr zone=peripreq:1000m rate=30000r/s;

server {  
listen 7999;  
server\_name [local.com](http://local.com);  
proxy\_intercept\_errors on;  
location / {  
limit\_conn peripconn 160;  
limit\_req zone=peripreq burst=100 nodelay;  
limit\_conn\_status 503;  
limit\_req\_status 503;  
proxy\_http\_version 1.1;  
proxy\_set\_header Connection “”;  
proxy\_connect\_timeout 10ms;  
proxy\_send\_timeout 10ms;  
proxy\_read\_timeout 60ms;  
proxy\_pass [http://dynamic](http://dynamic);  
}  
error\_page 302 400 403 404 408 500 502 503 504 = /empty;  
location /empty {  
return 204;  
}  
}

server {  
listen 8002;  
proxy\_intercept\_errors on;

```
location / {
    limit_conn peripex 5;
    limit_conn_status 503;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_pass http://locallayer;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
    return 204;
}

```

}

[…]

1. Setting #2 2 machines each N/2 CPU  
==============================

- Machine #1:

[…]

upstream machine2 {  
least\_conn;  
server ip/of/machine2:7999;  
keepalive 200;  
}

server {  
listen 8002;  
proxy\_intercept\_errors on;

```
location / {
    limit_conn peripex 5;
    limit_conn_status 503;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_pass http://machine2;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
    return 204;
}

```

}

[…]

- Machine #2:

[…]

upstream dynamic {  
least\_conn;  
server XXX.XXX.XXX.XXX:9990;  
[…]  
keepalive 5;  
}

limit\_conn\_zone $binary\_remote\_addr zone=peripconn:100m;  
limit\_req\_zone $binary\_remote\_addr zone=peripreq:1000m rate=30000r/s;

server {  
listen 7999;  
server\_name [local.com](http://local.com);  
proxy\_intercept\_errors on;  
location / {  
limit\_conn peripconn 160;  
limit\_req zone=peripreq burst=100 nodelay;  
limit\_conn\_status 503;  
limit\_req\_status 503;  
proxy\_http\_version 1.1;  
proxy\_set\_header Connection “”;  
proxy\_connect\_timeout 10ms;  
proxy\_send\_timeout 10ms;  
proxy\_read\_timeout 60ms;  
proxy\_pass [http://dynamic](http://dynamic);  
}  
error\_page 302 400 403 404 408 500 502 503 504 = /empty;  
location /empty {  
return 204;  
}  
}  
[…]

Posted at Nginx Forum:

> **[One goal. 2 settings. Which one would you recommend?](https://forum.nginx.org/read.php?2,268243,268243#msg-268243)**
>
> Hi I am debating what is a better setting between the 2 settings below. Setting#1 and Setting#2 attempt to do the same task (flow control by controlling the IP sources). Setting#1 uses one machine and Setting#2 uses 2 machines in a cascading manner.
