Skip IO-thread read-done followup unless update_state sync-invokes handlers (9.0) - #4414
Conversation
…ndlers (9.0) Follow-up of valkey-io#3335 (9.0 port of valkey-io#3611). Fixes a regression introduced by that PR, mirroring upstream valkey-io#4401. After the postpone-mask method landed, processIOThreadsReadDone() started postponing READ and returning needs_post_read_update = 1 for every non-ACCEPTING completed read. That second phase (lookupClientByID + processPendingCommandAndInputBuffer + connUpdateState) is only required when update_state may synchronously invoke handlers. For other transports it is per-completion overhead, hitting small payloads with io-threads and shallow pipelines the hardest. This restores the original gate without bringing struct client into the connection driver: - ConnectionType.sync_handlers_in_update_state (0 by default) - Set only where update_state can sync-call handlers (RDMA) - Mask is still computed in networking.c from IO state - connUpdateState() still runs immediately, including ACCEPTING Signed-off-by: quanyeyang <quanyemostima@gmail.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 9.0 #4414 +/- ##
===========================
===========================
🚀 New features to boost your workflow:
|
|
Benchmark ran on this commit: RPS Benchmark Comparison: 9.0 vs 760a0a17 significant change(s)
9 with no significant change Click to expand full comparison tablesdata_size = 128
data_size = 16
Configuration:
Legend:
Statistical Notes:
|
VinayakGhai
left a comment
There was a problem hiding this comment.
Wait, upstream had a bug where we kept rescheduling read followups. Skipping it makes sense. But the condition update_state sync-invokes handlers feels like a hack. Is there a cleaner way to track whether the transport needs a post-read update? Let's check if this is safe for TLS connections.
Thanks for review, I understand this is a little hack, because in the first approach we introduce this method and for cleaner abtraction we remove this and introduce new performance regression, and also currently unstable uses the same approach in this PR. maybe we could think out of a clean and elegant way to solve this, but it needs to be synchronized with unstable, then it's ok. also maybe the function name |
zuiderkwast
left a comment
There was a problem hiding this comment.
Thanks,
yes, first let's fix the regression, so I want to merge this ASAP.
Later, we can try to find a better abstraction.
Follow-up of #3335 (9.0 port of #3611). Fixes a regression introduced by that PR, mirroring upstream #4401.
After the postpone-mask method landed, processIOThreadsReadDone() started postponing READ and returning needs_post_read_update = 1 for every non-ACCEPTING completed read. That second phase (lookupClientByID + processPendingCommandAndInputBuffer + connUpdateState) is only required when update_state may synchronously invoke handlers. For other transports it is per-completion overhead, hitting small payloads with io-threads and shallow pipelines the hardest.
This restores the original gate without bringing struct client into the connection driver: