Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can Nginx be upgraded without dropping any requests?
    primarykey
    data
    text
    <p>According to <a href="http://wiki.nginx.org/CommandLine" rel="nofollow">the Nginx documentation</a>:</p> <blockquote> <p>If you need to replace nginx binary with a new one (when upgrading to a new version or adding/removing server modules), you can do it without any service downtime - no incoming requests will be lost.</p> </blockquote> <p>My coworker and I were trying to figure out: <strong>how does that work?</strong>. We know (we think) that:</p> <ul> <li>Only one process can be listening on port 80 at a time</li> <li>Nginx creates a socket and connects it to port 80</li> <li>A parent process and any of its children can all bind to the same socket, which is how Nginx can have multiple worker children responding to requests</li> </ul> <p>We also did some experiments with Nginx, like this:</p> <ul> <li>Send a <code>kill -USR2</code> to the current master process </li> <li>Repeatedly run <code>ps -ef | grep unicorn</code> to see any unicorn processes, with their own pids and their parent pids</li> <li>Observe that the new master process is, at first, a child of the old master process, but when the old master process is gone, the new master process has a ppid of 1.</li> </ul> <p>So apparently the new master process can listen to the same socket as the old one while they're both running, because at that time, the new master is a child of the old master. But somehow the new master process can then become... um... nobody's child?</p> <p>I assume this is standard Unix stuff, but <strong>my understanding of processes and ports and sockets is pretty darn fuzzy</strong>. Can anybody explain this in better detail? Are any of our assumptions wrong? And is there a book I can read to really grok this stuff?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload