3 ms·
That is a cool trick! Does that work via pipes and maybe also unix sockets? I suspect latency might still be slightly better with a pool of pre-forked processes
by rdtsc 13y ago
That is a cool trick! Does that work via pipes and maybe also unix sockets? I suspect latency might still be slightly better with a pool of pre-forked processes/threads.
- bratsche 13y agoYes, you can do it with unix sockets.
- joosters 13y agoYes, you can do it with unix sockets. Not sure about the latency, but you can pass the listen sockets in advance, rather than having one process accept()ing incoming connections and then passing those to other processes to handle. So unless you're binding to new ports all the time, it's all just a little extra startup work and won't impact the performance of the server.
- bdarnell 13y agoIt uses unix sockets. Latency is the same as the standard pre-forking model; the only difference is that file-descriptor passing lets you manage the worker processes independently instead of requiring them to have a common parent process (this is important when rolling out new code to a service with a lot of active connections, since it's disruptive to restart all the workers at once). Here's a demo in Python: https://gist.github.com/bdarnell/1073945 https://gist.github.com/bdarnell/1073945
- rdtsc 13y agoThat is pretty neat, thanks for sharing. I added it to my notes and code snippet for future.