# Service availability during reload

**URL:** <https://www.ruby-forum.com/t/service-availability-during-reload/237782>\
**Category:** NGINX\
**Created:** [November 29, 2013, 12:13pm UTC](https://www.ruby-forum.com/t/service-availability-during-reload/237782 "2013-11-29T12:13:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [November 29, 2013, 12:13pm UTC](https://www.ruby-forum.com/t/service-availability-during-reload/237782/1 "2013-11-29T12:13:28Z")

</div>

Hello

In an apache webserver with many virtual hosts, a “reload” command can  
cause a (quick) unavailability of the service while apache re-reads its  
configuration files.

Does anyone have any experience with this on Nginx? Will sending it a  
SIGHUP cause the main process to block and not be able to handle  
connections during that instant?

Thank you,  
Andre

---

<div class="post-metadata">

**Author:** ![reflex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@reflex](https://www.ruby-forum.com/u/reflex)\
**Post date:** [November 29, 2013, 1:00pm UTC](https://www.ruby-forum.com/t/service-availability-during-reload/237782/2 "2013-11-29T13:00:48Z")

</div>

Hello,

Sometimes reading the documentation might help :  
[http://nginx.org/en/docs/control.html](http://nginx.org/en/docs/control.html)

If you look at your service file, you’ll notice that a ‘reload’ means  
sending SIGHUP to the master process for the particular case of nginx.  
I’ll leave the conclusion to you, assuming that the doc is clear enough.

## As a general thinking methodology, considering implicitly that other webserver (especially modern ones with huge shifts in paradigms) behave the same as Apache only leads to deception…

_B. R._

---

<div class="post-metadata">

**Author:** ![reflex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@reflex](https://www.ruby-forum.com/u/reflex)\
**Post date:** [November 29, 2013, 1:13pm UTC](https://www.ruby-forum.com/t/service-availability-during-reload/237782/3 "2013-11-29T13:13:40Z")

</div>

Hello!

On Fri, Nov 29, 2013 at 09:12:39AM -0200, Andre N. wrote:

> Hello
> 
> In an apache webserver with many virtual hosts, a “reload” command can  
> cause a (quick) unavailability of the service while apache re-reads its  
> configuration files.
> 
> Does anyone have any experience with this on Nginx? Will sending it a  
> SIGHUP cause the main process to block and not be able to handle  
> connections during that instant?

Short answer:

This is not a problem with nginx.

Long answer:

Connections are handled by worker processes. On SIGHUP, master  
process parses new configuration and spawns new worker processes  
(while old workers still handle requests). Then it asks old  
workers to gracefully shutdown. That is, all the time requests  
are handled by worker processes and service is available.

Moreover, it is possible to upgrade nginx binary on the fly  
without loosing any single request.

See here for more details:

[http://nginx.org/en/docs/control.html](http://nginx.org/en/docs/control.html)

–  
Maxim D.  
[http://nginx.org/en/donation.html](http://nginx.org/en/donation.html)

---

<div class="post-metadata">

**Author:** ![reflex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@reflex](https://www.ruby-forum.com/u/reflex)\
**Post date:** [November 29, 2013, 1:28pm UTC](https://www.ruby-forum.com/t/service-availability-during-reload/237782/4 "2013-11-29T13:28:52Z")

</div>

On 11/29/2013 10:13 AM, Maxim D. wrote:

> Connections are handled by worker processes. On SIGHUP, master  
> process parses new configuration and spawns new worker processes  
> (while old workers still handle requests). Then it asks old  
> workers to gracefully shutdown. That is, all the time requests  
> are handled by worker processes and service is available.

Thank you so much Maxim. That was the impression I had skimming through  
ngx\_cycle.c and ngx\_process\_cycle.c but since I’m not familiar with the  
code, I just wanted to make sure.

Cheers,  
Andre
