twemproxy源码分析之五:zero copy
2015-07-20 09:59
381 查看
先给出msg的数据结构:
看这三个成员
TAILQ_ENTRY(msg) c_tqe;
TAILQ_ENTRY(msg) s_tqe;
TAILQ_ENTRY(msg) m_tqe;
c_tqe是用来插入到client类型的conn中的输入或者输出队列中
s_tqe是用来插入到server类型的conn(即连接后端redis server的conn)中的输入或者输出队列中
m_tqe是用来插入到发送对列(一个发送队列对应一个远端或是client或是redisinstance)中的输入或者输出队列中
具体的插入删除过程见上一篇。
truct msg { TAILQ_ENTRY(msg) c_tqe; TAILQ_ENTRY(msg) s_tqe; TAILQ_ENTRY(msg) m_tqe; uint64_t id; int route_idx; struct msg *peer; struct conn *owner; struct rbnode tmo_rbe; struct mhdr mhdr; uint32_t mlen; int state; uint8_t *pos; uint8_t *token; msg_parse_t parser; msg_parse_result_t result; mbuf_copy_t pre_splitcopy; msg_post_splitcopy_t post_splitcopy; msg_coalesce_t pre_coalesce; msg_coalesce_t post_coalesce; msg_type_t type; uint8_t *key_start; uint8_t *key_end; uint32_t vlen; uint8_t *end; uint8_t *narg_start; uint8_t *narg_end; uint32_t narg; uint32_t rnarg; uint32_t rlen; uint32_t integer; struct msg *frag_owner; uint32_t nfrag; uint64_t frag_id; err_t err; unsigned error:1; unsigned ferror:1; unsigned request:1; unsigned quit:1; unsigned noreply:1; unsigned done:1; unsigned fdone:1; unsigned first_fragment:1; unsigned last_fragment:1; unsigned swallow:1; unsigned redis:1; |
TAILQ_ENTRY(msg) c_tqe;
TAILQ_ENTRY(msg) s_tqe;
TAILQ_ENTRY(msg) m_tqe;
c_tqe是用来插入到client类型的conn中的输入或者输出队列中
s_tqe是用来插入到server类型的conn(即连接后端redis server的conn)中的输入或者输出队列中
m_tqe是用来插入到发送对列(一个发送队列对应一个远端或是client或是redisinstance)中的输入或者输出队列中
具体的插入删除过程见上一篇。
相关文章推荐
- Tomcat的Web部署
- 解决外网无法访问Linux主机上的tomcat问题
- getopt getopts
- 通过网页集中访问Docker容器
- Windows/Linux环境下模拟服务端口方法
- BASH操作环境的一些笔记
- linux scp命令(主机,服务器间复制文件)
- Photoshop做32位带Alpha通道的bmp图片
- 用户用浏览器访问一个网站的时候具体的过程与步骤
- hadoop2提交到Yarn: Mapreduce执行过程分析
- PuTTY + Xming 远程使用 Linux GUI
- PuTTY + Xming 远程使用 Linux GUI
- hadoop优化
- Apache Shiro与Spring Security学习
- hadoop-1.2.1添加节点的方法
- nginx+iis实现负载均衡
- 基于OpenCV的傅里叶变换及逆变换
- Linux C函数使用记录
- Mac/Windows/Linux安装MYSQL
- Linux下使用多个不同版本的R