记点笔记:High-Performance Server Architecture
性能问题一般因以下四个原因而起:
- Data copies(数据复制)
- Context switches(上下文切换)
- Memory allocation(内存分配)
- Lock contention(锁争用)
为避免Data copies,作者使用的方法是间接使用和通过buffer descriptor来代替buffer pointer,每一个buffer descriptor由以下部分构成:
- A pointer and length for the whole buffer. 一个指向整个buffer的指针和大小。
- A pointer and length or offset and length for the part of the buffer that's actually used. 一个指向buffer实际使用部分的指针和大小或偏移量及大小。
- Forward and back pointers to other descriptors in a list. 指向其他描述符的向前及向后的指针列表。
- a reference count. 一个引用计数。

Leave a comment