4 ms·
The alternative to preforking is select(2), which lets you get away with a single-process server and avoid IPC in certain scenarios: http://www.lowtek.com/socke
by wooby 17y ago
The alternative to preforking is select(2), which lets you get away with a single-process server and avoid IPC in certain scenarios: http://www.lowtek.com/sockets/select.html http://www.lowtek.com/sockets/select.html
I think Boa and thttpd use select instead of forking for clients.
- bretthoerner 17y agoYou have to combine select with processes or threads if you want to take advantage of SMP like these examples do.
- maw 17y agoselect doesn't scale particularly well, though. (And I'm not wild about its interface either; poll conceptually similar but much nicer to program to.) http://www.kegel.com/c10k.html http://www.kegel.com/c10k.html (a now fairly old document, by internet standards) discusses a number of other options.
- silentbicycle 17y agoYou might want to look at libevent (http://www.monkey.org/~provos/libevent/ http://www.monkey.org/~provos/libevent/) and libev (http://software.schmorp.de/pkg/libev.html http://software.schmorp.de/pkg/libev.html). They're wrappers to kqueue (on BSD) and epoll (on Linux), both of which improve upon select (http://www.monkey.org/~provos/libevent/libevent-benchmark.jpg http://www.monkey.org/~provos/libevent/libevent-benchmark.jp...).
- mace 17y agoLibevent is great for multiplatform code. PyEvent is the Python wrapper module for libevent also written by dugsong.