Skip to content

[FeedSim] Keep number of driver threads and thrift threads in balance with SMT#567

Open
lukalt wants to merge 1 commit into
facebookresearch:v2-betafrom
lukalt:fix-feedsim-smt-balance
Open

[FeedSim] Keep number of driver threads and thrift threads in balance with SMT#567
lukalt wants to merge 1 commit into
facebookresearch:v2-betafrom
lukalt:fix-feedsim-smt-balance

Conversation

@lukalt

@lukalt lukalt commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

To achieve optimal performance for FeedSim, the number of driver connections and thrift threads should be always kept in balance. Every driver thread uses 4 connections of the thrift server, so we need to ensure that #driver_threads * 4 = #thrift_threads.

  • On systems without SMT support, this balance is achieved (#driver_threads = #thrift_threads/4).
  • If SMT is enabled (detected via /sys/devices/system/cpu/smt/active), #driver_threads = #thrift_threads/5 is used. So, the number of driver connections is only 80% of the number of thrift threads. Consequently, the driver does not spawn enough threads and only 80% of the thrift threads are busy.

This PR fixes this discrepancy by using the same formula to compute the number of driver threads on systems with and without SMT. This improves performance by up to 20%.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 8, 2026
@meta-codesync

meta-codesync Bot commented Apr 8, 2026

Copy link
Copy Markdown

@charles-typ has imported this pull request. If you are a Meta employee, you can view this in D100063129.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant