Hi Dan, If you're interested in CPU affinity for the entire server process on Linux, you can use `taskset` https://linux.die.net/man/1/taskset. Otherwise, you'll likely want to patch `thd.cc` and use pthread's affinity APIs, but I don't recommend it.
For more advanced use cases with the C/C++ library, you can also get full control over the threading model and all async behavior by implementing a custom EventEngine <https://github.com/grpc/grpc/blob/5c988a47c4285bf8973a96c3a45bc15a7b9b678b/include/grpc/event_engine/event_engine.h> . Cheers, -aj On Thursday, January 25, 2024 at 10:26:07 AM UTC-8 Dan Cohen wrote: > Hello, > > I'm implementing an async gRPC server in c++. > I need to control and limit the cores that are used by gRPC internal > threads (the completion queues handler threads are controlled by me) - i.e. > I need to set those threads' affinity. > > Is there a way for me to do this without changing gRPC code? > If not, where in the code would you recommend to start looking for > changing this? > > Thanks, > Dan > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/4255a086-3c2a-4fe7-8329-026c6da17340n%40googlegroups.com.