-1

I have an nginx server which pass request from one URL to some other servers silimar this:

upstream main {
    server {{OPENSHIFT_INTERNAL_IP}}:15010 weight=1 fail_timeout=1s;
    server {{OPENSHIFT_INTERNAL_IP}}:15011 weight=1 fail_timeout=1s;
    server {{OPENSHIFT_INTERNAL_IP}}:15012 weight=1 fail_timeout=1s;
    server {{OPENSHIFT_INTERNAL_IP}}:15013 weight=1 fail_timeout=1s;

    keepalive 300;

    }

location  ~* ^/(.*) {
         proxy_pass http://main;
         #proxy_read_timeout 5s;
         proxy_connect_timeout 5s;
        }

, SO i need to refusing for sending request to busied servers,so how could i prevent for requesting to overloaded servers .

Soheil Paper
  • 1
  • 2
  • 8
  • 25
  • Have you read http://nginx.org/en/docs/http/ngx_http_upstream_module.html? – Roman Jun 05 '16 at 05:33
  • thanks i read this site page and i found two this : fail_timeout=time and max_conns=number and health_check match=welcome; which is useful for me and need to be tested.thanks a lot. – Soheil Paper Jun 05 '16 at 15:11

1 Answers1

0

I used Fair module in nginx:

git clone https://github.com/gnosek/nginx-upstream-fair.git

cd nginx-${NGINX_VERSION}   
./configure\
   --prefix=${OPENSHIFT_HOMEDIR}/app-root/runtime/srv/nginx\
   --with-pcre=$OPENSHIFT_TMP_DIR/pcre-${PCRE_VERSION}\
   --with-zlib=$OPENSHIFT_TMP_DIR/zlib-${ZLIB_VERSION}\
   --with-http_ssl_module\
   --with-http_geoip_module\
   --with-http_realip_module \
   --with-http_addition_module \
   --with-http_sub_module\
   --with-http_dav_module \
   --with-http_flv_module \
   --with-http_mp4_module \
   --with-http_gunzip_module\
   --with-http_gzip_static_module \
   --with-http_random_index_module \
   --with-http_secure_link_module\
   --with-http_stub_status_module \
   --with-mail \
   --with-mail_ssl_module \
   --with-file-aio\
   --with-ipv6  \
   --add-module=$OPENSHIFT_TMP_DIR/nginx-upstream-fair\

by this configuration:

upstream main {
    fair;
    server {{OPENSHIFT_INTERNAL_IP}}:15010 weight=1 fail_timeout=1s; #diy-tornado4ss.rhcloud.com
    #server {{OPENSHIFT_INTERNAL_IP}}:15011 weight=1 fail_timeout=1s; #diy2-elasa2.rhcloud.com
    server {{OPENSHIFT_INTERNAL_IP}}:15012 weight=1 fail_timeout=1s; #diy-phantomjs4so.rhcloud.com
    #server {{OPENSHIFT_INTERNAL_IP}}:15013 weight=1 fail_timeout=1s;
    #max_connections 3;
    keepalive 2100;

    }
Soheil Paper
  • 1
  • 2
  • 8
  • 25