Synchronous GRPC server threading model/IO model

111 views
Skip to first unread message

Rasmus Johansson

unread,
Jun 12, 2020, 5:08:25 AM6/12/20
to grpc.io
Hi,

I have some wondering regarding the threading and IO model of a synchronous gRPC server.

As I understand it, gRPC uses epoll together with pollsets, polling islands in order to watch several fds for incoming data. If data is ready to be read, correct worker thread is woken up to deal with it...(simplified..)
In asynchronous gRPC with only one thread and one completion queue, all fds (1 client <-> 1 fd) are in the same pollset and the same polling island etc (I am not confident in the exact details of the implementation). This enables one thread to serve all clients (or n threads to serve all clients).

Now to my question/wondering:
What does this look like in synchronous gRPC? To my understanding, if I limit the resourceQuota to a number of threads, then I am only able to serve a limited number of concurrent clients. Why is it like this?
That is, in synchronous gRPC, each "worker thread" is blocked on a client connection, why is this?

Could someone explain the threading model / IO model of synchronus gRPC? Or where could I read up on it on my own?
Thank you,
Rasmus

Rasmus Johansson

unread,
Jun 12, 2020, 5:09:57 AM6/12/20
to grpc.io
Sorry, forgot to add that I am talking about C++.
Reply all
Reply to author
Forward
0 new messages