eclipse-vertx / eclipse-vertx/vert.x

Event loop thread affinity

Open
#3,966 3 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
14.7k
Forks
2.1k
Avg merge
2d 7h
Merged PRs (30d)
28

Description

Allow users to define Netty event loop threads cores affinity.

Given that Vert-x use long-living threads bound to specific selectors, being able to bind it to a specific core can increase performance (and its stability) of both I/O and non I/O tasks because of a reduced amount of context-switches and a better usage of cache, given that the event loop data won't "migrate" across cores (and caches) anymore.

This feature, thanks to the symmetric nature of event loop threads, could be implemented by allowing users to specify at startup
a preference set of cores and the application will take care to "distribute" such cores to the existing event loop threads.
A similar strategy as been used on hazelcast/hazelcast@a7e7def#diff-41c605cf06cabcb23d4cf7c2b39333741976c154934d6de8d9e1d724670310a

A good candidate for a POC implementation is https://github.com/OpenHFT/Java-Thread-Affinity, while a final version can use an ad-hoc JNA affinity util a-la hazelcast/hazelcast#17435 to save "OpenHFT lib to be on the classpath and libffi.so to be loadable too" as mentioned in the HZC PR.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.