I'm learning Grpc's implementation, and can't understand the design in epoll1 polling engine.
Based on the best practice from GRpc, users could create multiple CompleteQueues and each assigned a thread to it, this thread will while(cq.Next())
to get work to do. The picture above comes from the official tutorial which indicates that in epoll1
only one thread can actually call epoll_wait
at a time.
My first question is GRpc uses SO_REUSEPORT
to create socket fd
, so the kernel will dispatch events to these fds
, why not let these threads polling on epoll_wait
independently? Why block each other on a condition variable? What's the tradeoff here?
Aucun commentaire:
Enregistrer un commentaire