Repository navigation
Conversation
Each session gets a socketpair and a thread that owns the engine's session, so every statement pays one round trip through the kernel, the shape of PostgreSQL's backend per connection. The header gains boundary=in_process|unix_socket|unix_shim so every number says which it is.
8 of 11 tasks
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.
Part of tamnd/rudb#1388 (W5).
rudb runs in the driver's process, and PostgreSQL runs behind a Unix socket. So a comparison between them measures the socket as much as the engine. The OLTP Looking Glass measurement (CIDR 2025) puts about 70% of a point transaction's cycles in that kind of communication.
This adds
--shim unix, the shim of engine-v4 section 13.8 and the YCSB spec's section 4.10:socketpairand a thread on the other end, and that thread owns the engine's session. The client writes a length-prefixed request (the operation, the statement index and its parameters) and blocks on the read. The thread runs the request and writes back the whole result: the row count, then each value, length-prefixed.BEGIN,COMMIT,ROLLBACK, prepare and explain go over the socket too, so the engine's own session overrides still apply.rudbandnull. Thenullrun gives the shim's own cost.boundary=in_process,unix_socket(PostgreSQL) orunix_shim, for both the YCSB and TPC-C modes.On a loaded server2,
nullwith 4 clients doing reads went from about 0.27 µs to about 2.9 µs per operation behind the shim. That gap is the round trip itself.Tests: a unit test runs the same statements on a null session directly and through the shim and compares the values. A second test checks that a frame larger than the socket buffer arrives whole, and that one cut short is an error. Argument parsing tests cover
--shim.cargo testandcargo clippy --all-targets -D warningspass on server2, and a--mode tpcc --backend null --shim unixrun completes end to end.