6 ms·
* is Unix
- iuguy 17y agoNo. * is most definitely not Unix. Unix is Unix. Anything else is not Unix.
- wooby 17y agoThe 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.
- antonovka 17y agoThis meme is a silly amateur-hour wheel re-invention and ignorance of history. The fact is, pre-forking a pool of processes without implementing a per-process multiple-connection event mechanism is going to be grossly inefficient in terms of memory utilization (ie, you need to use select, poll, kqeueue, etc.). You can claim otherwise (COW pages et al), but history is not on your side (look at the scalability of existing pre-fork/connection-per-process network daemons). Think about it -- how much of the runtime can truly be shared across connection handlers? The fact that this model doesn't scale is not news. It doesn't require rediscovery. It shouldn't be surprising. Anyone who has run Apache, sendmail, or any 80s/90s networking software -- much less authored something similar -- will know better. Moreover, there's nothing wrong with threads -- threads are a low-level tool that can be used to implement high-level concurrent systems. They're cheaper than processes because they do support mutable state where it's useful, but you don't have to use fork() to avoid avoid mutable state. If you don't want shared mutable state (and you don't), then don't use it.
- jacobian 17y agoThis meme is a silly amateur-hour wheel re-invention and ignorance of history. Yeah, well fuck you too. As it turns out, I am an amateur, at least when it comes to POSIX, but more importantly I find this stuff fun. I hadn't realized that having fun and learning about new topics was such an offensive thing to do. Maybe this is just frivolity, but it's surely a better way to spend a few minutes than crapping all over somebody else's fun.
- antonovka 17y agoMy intention was to elucidate why the fork(2) non-event-based "mini-meme" is known dead-end.
- omouse 17y agoOff-topic but...we need a proper computer science/programming collection of papers, books, etc. built up so that people can go off and learn things from the past instead of learning about them independently and then spawning blog posts about it.
- ilyak 17y agonginx is Unix It's obviously designed by Unix orthdoxes and it shows No dynamic linking! No threads! Not much of mem alloc, either!
- claymation 17y agoI love an in-depth, technical blog post as much as anyone, and kudos to Ryan for dissecting Unicorn, but I didn't know whether to laugh or cry when I read that Unicorn has, "teh Unix turned up to 11". zOMG! fork! This series of blog posts underscores my point that the Rails community, perhaps the Web 2.0 community at large, is just now learning things the rest of us have known for years. accept(2)-based pre-forking socket servers are not news.
- silentbicycle 17y ago> "teh Unix turned up to 11". zOMG! Yeah. Ruby people suddenly feeling all hardcore after touching Unix syscalls for the first time. Ick.