-2

My concern is that with one upstream pool being shared between two servers, each server will send requests to the pool and if the pool becomes overloaded, neither server will be able to properly throttle or timeout future requests.

I've defined two servers, one listening to port 80, the other to port 443. Both define an upstream pool with the same resources.

web_one_80.conf:

  upstream app_pool1 {
    server 1.1.1.1:5000
    server 1.1.1.1:5001
    server 1.1.1.1:5002
  }

  http {
    listen 80;
    location / {
      proxy_pass http://app_pool1;
    }
  }

web_one_443.conf:

  upstream app_pool2 {
    server 1.1.1.1:5000
    server 1.1.1.1:5001
    server 1.1.1.1:5002
  }

  http {
    listen 443 ssl;
    location / {
      proxy_pass http://app_pool2;
    }
  }

What if I have two servers on two different machines sharing an upstream server?

web_one_80.conf:

  upstream app_pool1 {
    server 1.1.1.1:5000
    server 1.1.1.1:5001
    server 1.1.1.1:5002
  }

  http {
    listen 80;
    location / {
      proxy_pass http://app_pool1;
    }
  }

web_two_80.conf:

  upstream app_pool1 {
    server 1.1.1.1:5000
    server 2.2.2.2:5001
    server 2.2.2.2:5002
  }

  http {
    listen 80;
    location / {
      proxy_pass http://app_pool1;
    }
  }

Full disclosure: I'm checking on another's work. I would expect that neither of these setups should work properly. I'm happy being wrong!

4
  • 1
    Could you clarify how that can be unsafe?
    – VBart
    Aug 18 '16 at 17:39
  • I tried, see latest update. I'm concerned that if server to pool is not 1:1 (or if virtual servers in the pool are not 1:1) than the pool will not function properly. Or the servers will compete for resources within the same pool. Aug 18 '16 at 18:42
  • What do you mean by phrase: properly throttle or timeout future requests? How will they compete? How is this situation different to multiple users connect to the same server? What's wrong with multiple virtual hosts served from one physical server? Redundancy is a common practice, and it's quite normal to have a number of load-balancers in front of a bunch of application servers.
    – VBart
    Aug 18 '16 at 19:40
  • It wasn't clear to me that these resources could be shared between pools, between servers, between machines. I guess it's OK. Thanks! Aug 19 '16 at 22:25
2

Yes. I define PHP and SSL session cache outside my server config and use them from many server blocks.

2
  • Are these server definitions all part of the same NGINX instance on one machine? What if one of each server definitions are running on NGINX instances on two separate machines? Aug 18 '16 at 18:38
  • 1
    One machine, ten machines, doesn't matter.
    – Tim
    Aug 18 '16 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.