facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.05k stars 539 forks source link

Add BoundThreadFactory which creates threads that are bound to a cpu core #67

Closed sanjosh closed 7 years ago

sanjosh commented 8 years ago

Added BoundThreadFactory which binds each new thread to a specified CPU core. This is useful for NUMA processing

Added test to verify that the threads created by this factory get bound to specified core

Please let me know if there is a portable way in folly or wangle to set thread affinity. Right now, I am using pthread_setaffinity_np()

djwatson commented 7 years ago

We've tried a similar threadpool internally and haven't had great results (although I think one exists in the fbthrift repo), so I'm hesitant to merge because we don't use this internally. If it works for you, great though.

(Maybe we should start a contrib directory instead?)