Closed shenweihai1 closed 2 years ago
Hi Weihai. Currently there isn't a way in eRPC to use event-driven I/O instead of polling-based I/O.
One possibility is that if you're running an RPC server with many server-side threads, you can use just one "foreground" polling thread for the packet transport. The other application handling threads can be "background" threads (e.g., see the example below). The background threads can be put sleep when there is no work available from the "foreground" thread.
Thank you so much for your advice @ankalia
In
eRPC
, from the server perspective, we userun_event_loop_once
to check if there is a response received from another endpoint withbusy loop
. Here is an example of how to useeRPC
to wait for a request from anothereRPC
endpoint.In this example, there is a
busy loop
in it which wastes a lot of cpu time, what can i do to avoidbusy loop
? All high-performance rpc frameworks use the event_driven way to solve this issue, I think the only way to solve this issue could also be using the event-driven method. To support event-driven, we should useepoll_wait
andepoll_ctl
system calls in the kernel via a file descriptor, but it is slow compared to the kernel-bypass way, why don't I use TCP/IP directly instead ofeRPC
, right? So does anyone have any idea how to implement it in an event-driven way or any example?Or any idea can help