redis 异步网络通信流程 - 单线程
2020-06-19 10:44:28 1 举报
redis 异步网络通信流程,linux 下依赖 epoll 多路复用来网络网络读写事件。详细信息可以参考我的博客。
作者其他创作
大纲/内容
server.clients_to_close
fcntl
c->buf
main
aeCreateFileEvent
aeApiPoll
write
Y
aeDeleteFileEvent
epoll_ctl
processTimeEvents
client_fd
AE_WRITABLE
eventLoop->events
freeClientsInAsyncFreeQueue
c->reply
redis 异步网络I/O通信流程 - 单线程
conn->write_handler = sendReplyToClient
EPOLL_CTL_DEL
loop
epoll_create
freeClient
...
fdN
clientHasPendingReplies
fd2
N
aeMain
aeCreateEventLoop
fd1
EPOLL_CTL_ADD - EPOLLIN
O_NONBLOCK
aeApiCreate
mask : one of AE_(READABLE|WRITABLE|BARRIER)clientData : connection
readQueryFromClient
EPOLL_CTL_ADD - EPOLLOUT
writeToClient
aeFileEvent
ret == 0
processInputBuffer
wenfh2020.com
AE_READABLE
listDelNode
close
wfileProc
kernel
server.clients_pending_write
rfileProc
sendReplyToClient
server_fd == events[i].data.fd
aeFileEvent
+ mask : int+ rfileProc : aeFileProc+ wfileProc : aeFileProc+ clientData : void*
EPOLL_CTL_MOD - ~EPOLLOUT
read
serverCron
bind
aeProcessEvents
connSocketEventHandler
acceptTcpHandler
aftersleep
accept
socket
beforesleep
c->querybuf
listenToPort
handleClientsWithPendingWritesUsingThreads
block
device
freeClientAsync
server_fd
epoll_fd
listen
add
epoll_wait
0 条评论
回复 删除
下一页