kmemcache是sina的jgli作品
github连接如下:https://github.com/jgli/kmemcache
blog如下:http://blog.sina.com.cn/u/3289939872
学习的参考blog为:http://godorz.info/2013/06/kmemcache/#kmemcache0
以上文章皆为参考文章和源代码
kmemcache是为了解决one million issue而开发的kernel版本memcache,本文主要梳理kmc的函数流程,在接下的的文章在仔细品味kernel下packet级别sock数据处理。
入口函数
dispatcher_init->server_init->server_inet_init->server_socket_inet-> no matter udp or tcp, all will call __dispatch_conn_new instead to create a new listen
->(binding mc_listen_work/accept into main ss, if this is a tcp link then bind callback fn, if not call udp create)
->__dispatch_conn_new->mc_conn_new_work->mc_conn_new->mc_conn_work->mc_worker_machine(main work)
set_sock_callbacks->set
sk->sk_data_ready = mc_worker_data_ready; sk->sk_write_space = mc_worker_write_space; sk->sk_state_change = mc_worker_state_change;
if data is coming, mc_queue_conn is called, then queue_work(slaved, &c->work) put this job into wq, finally, mc_conn_work->mc_worker_machine(main work) is called.