erpc-io / eRPC

Efficient RPCs for datacenter networks
Other
851 stars 138 forks source link

Regarding background threads for same registered function #80

Closed psistakis closed 2 years ago

psistakis commented 2 years ago

Hello.

I just wanted to check with you if it is safe to assume that a node with N background threads, that concurrently receives N different eRPC requests of the same type (i.e., they are expected to* invoke the same registered function) will concurrently run a "copy" of that function (i.e., no serialization; no waiting for each function invocation to finish)?

Thank you.

anujkaliaiitd commented 2 years ago

This is not guaranteed: it's only guaranteed that the handlers will run in a background thread.

The current logic is here: https://github.com/erpc-io/eRPC/blob/d29c4f5c4ae070a9780eaa95aaf644deb0d2b3ba/src/rpc_impl/rpc_rx.cc#L94

In the current implementation, each "foreground" thread round-robins background requests among background threads. So the behavior also depends on the number of foreground threads.