Repository navigation
Send Bind/Execute/Sync in one write - #1384
Open
sideeffffect wants to merge 2 commits into
Open
sideeffffect wants to merge 2 commits into
sideeffffect wants to merge 2 commits into
Conversation
Every `MessageSocket#send` was its own socket write, so a warm parameterized command (Bind, Execute, Sync) cost three writes and, with TCP_NODELAY, up to three TCP segments. A lone Flush was also written when the statement was already parsed and described. Add `MessageSocket#sendAll`, which encodes the messages and writes them at once, and use it wherever messages go out back to back before a read: Bind+Execute+Sync/Flush, Parse+Describe+Flush, Bind+Flush, Execute+Flush and Close+Flush. Skip the Flush when Parse and Describe are both cached, as nothing is sent and no reply is read. ExchangeCountTest now asserts writes too: one write per exchange for every operation kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JMH benchmark of a warm parameterized query (`unique`) and command (`execute`) on a single session, so each operation is one Bind/Execute/Sync exchange. Needs the docker-compose Postgres. Results, `bench/Jmh/run -i 10 WarmSessionBench` (1 fork, 5x5s warmup, 10x5s measurement), local Postgres 11 in Docker, JDK 21, ops/s: | Benchmark | main (1045d3b) | this branch | change | |-------------|-----------------|-----------------|--------| | warmCommand | 9930 +- 206 | 11977 +- 335 | +21% | | warmQuery | 10623 +- 350 | 13769 +- 343 | +30% | A second branch run gave 11765 +- 510 and 13663 +- 406. Load average was 3 to 6 during the runs quoted. A main run with load average 8 to 11 was too noisy to use (5807 +- 3013 and 9780 +- 1561). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sideeffffect
marked this pull request as ready for review
October 30, 2026 16:35
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new method to send
FrontendMessages in bulk. Enables lowering the number of writes and thus increasing efficiency.