Check out my first novel, midnight's simulacra!
Fast UNIX Servers: Difference between revisions
From dankwiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Everyone ought start with Dan Kegel's classic site, "[http://www.kegel.com/c10k.html The C10K Problem]" (still updated from time to time). Jeff Darcy's "[http://pl.atyp.us/content/tech/servers.html High-Performance Server Architecture]" is much of the same. Everything here is advanced followup material to these excellent works, and of course the books of W. Richard Stevens. | Everyone ought start with Dan Kegel's classic site, "[http://www.kegel.com/c10k.html The C10K Problem]" (still updated from time to time). Jeff Darcy's "[http://pl.atyp.us/content/tech/servers.html High-Performance Server Architecture]" is much of the same. Everything here is advanced followup material to these excellent works, and of course the books of W. Richard Stevens. | ||
==Queueing Theory== | ==Queueing Theory== | ||
Line 32: | Line 26: | ||
** <tt>kqueue</tt> supports vectorized registration of event changes, extending the issue | ** <tt>kqueue</tt> supports vectorized registration of event changes, extending the issue | ||
* Threads | * Threads | ||
==See Also== | |||
* [http://lkml.indiana.edu/hypermail/linux/kernel/0101.3/0674.html "sendfile(): fairly sexy (nothing to do with ECN)"] on lkml | |||
* [http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2005-12/msg00105.html "mmap() sendfile()"] on freebsd-hackers | |||
* [http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2008-05/msg00001.html "sharing memory map between processes (same parent)"] on comp.unix.programmer | |||
* [http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2003-10/0325.html "some mmap observations compared to Linux 2.6/OpenBSD"] on freebsd-hackers | |||
* Stuart Cheshire's [http://rescomp.stanford.edu/~cheshire/rants/Networkdynamics.html "Laws of Networkdynamics"] and [http://rescomp.stanford.edu/~cheshire/rants/Latency.html "It's the Latency, Stupid"] |
Revision as of 02:07, 25 June 2009
Everyone ought start with Dan Kegel's classic site, "The C10K Problem" (still updated from time to time). Jeff Darcy's "High-Performance Server Architecture" is much of the same. Everything here is advanced followup material to these excellent works, and of course the books of W. Richard Stevens.
Queueing Theory
- "Introduction to Queueing"
- Leonard Kleinrock's peerless two-volume Queueing Systems
Event Cores
Edge and Level Triggering
- Historic interfaces like POSIX.1g/POSIX.1-2001's select(2) and POSIX.1-2001's poll(2) were level-triggered
- epoll (via EPOLLET) and kqueue (via EV_CLEAR) provide edge-triggered semantics
The Full Monty: A Theory of UNIX Servers
We must mix and match:
- Many event sources, of multiple types and possibly various triggering mechanisms (edge- vs level-triggered):
- Socket descriptors, pipes
- File descriptors referring to actual files (these usually have different blocking semantics)
- Signals, perhaps being used for asynchronous I/O with descriptors (signalfd(2) on Linux unifies these with socket descriptors; kqueue supports EVFILT_SIGNAL events)
- Timers (timerfd(2) on Linux unifies these with socket descriptors; kqueue supports EVFILT_TIMER events)
- Condition variables becoming available
- Filesystem events (inotify(7) on Linux, EVFILT_VNODE with kqueue)
- Networking events (netlink(7) (PF_NETLINK) sockets on Linux, EVFILT_NETDEV with kqueue)
- One or more event notifiers (epoll or kqueue fd)
- One or more event vectors, into which notifiers dump events
- kqueue supports vectorized registration of event changes, extending the issue
- Threads
See Also
- "sendfile(): fairly sexy (nothing to do with ECN)" on lkml
- "mmap() sendfile()" on freebsd-hackers
- "sharing memory map between processes (same parent)" on comp.unix.programmer
- "some mmap observations compared to Linux 2.6/OpenBSD" on freebsd-hackers
- Stuart Cheshire's "Laws of Networkdynamics" and "It's the Latency, Stupid"