Maxim Dounin
April 13, 2015 09:08AM
Hello!

On Mon, Apr 13, 2015 at 04:16:56AM -0400, HUMing wrote:

> For a simple Nginx configuration like this:
> For a simple Nginx configuration like this:
>
> upstream myservers {
> server 127.0.0.1:3000;
> server 127.0.0.1:3001;
> }
> server {
> listen 80;
> location / {
> proxy_pass http://myservers;
> }
> I have two questions related zero downtime of the application:
>
> If I change the configuration to mark the first server server 127.0.0.1:3000
> as down, I assume that no new request will go to that server, but what about
> the current request that is handled by the upstream server? Does Nginx can
> still return valid response to end user for that request?
>
> If I remove the first server server 127.0.0.1:3000 and reload the
> configuration, what about the current request that is handled by this
> upstream server?

Both removal of the server and marking it down are equivalent as
long as you are using round-robin balancing (there is a difference
when using ip_hash and hash balancers, as "down" implies less
remapping when temporary disabling a server).

In both cases the server won't be used by new worker processes to
handle new requests, and old worker processes will gracefully
terminate upon completion of previously started requests.

See here for details:

http://nginx.org/en/docs/control.html#reconfiguration

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

How does Nginx handle the request of the upstream server when it is marked as `down`?

HUMing April 13, 2015 04:16AM

Re: How does Nginx handle the request of the upstream server when it is marked as `down`?

Maxim Dounin April 13, 2015 09:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 243
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready