C10K 问题
一篇出名的老文章&好文章,涵盖了现代 Web Server 设计的基础理论,设计目标是写出一个能支持 10k 个连接的服务器软件。
五种常见的 I/O 策略:
- 多线程,每个线程使用 nonblocking I/O 和 
select()/poll()这类 level-triggered readiness notification 接口处理 data waiting。 - 多线程,每个线程使用 nonblocking I/O 和 edge-triggered readiness notification,这类接口包括 
kqueue(),epoll(), realtime signal, etc. - 使用 asynchronous I/O
 - 每个线程对应一个 client.
 - 把 server code 写到 kernel 中
 
另外,还有一些问题需要额外注意
- TCP 在 userspace 中处理
 - 调大 ulimit
 - 调低 thread 的 stack space 占用量
 - zero-copy
 
推荐阅读:W. Richard Stevens 写的 Unix 网络编程