You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Secret Connection: Buffer the underlying connection #3198
A secret connection read call, no matter how many bytes its serving, is only reading 1024 bytes from disk as a syscall. Many packets are much larger, so we end up doing something like:
sc.Read(10kb)
Syscall read 1048 bytes (encrypted data frame)
SecretConn decrypt
Return 1024 bytes (data-component of a data frame)
sc.Read(9kb)
So we will net do 10 syscalls for a 10kb read. Note that things like a full block part are (encoded) > 64kb, and therefore require 64 syscalls!
Proposal
Use a bufferred reader over the connection within secret connection. I tested it out on osmosis mainnet with this code: osmosis-labs@3e2254f and saw a 10% speedup to secret connection file open times. (There were relatively small blocks on osmosis at this time) TBH I was expecting a higher speedup than 10%
I'd make a PR, but the evil secret connection tests are really messy and will take some time to fix.
Activity
ValarDragon commentedon Jun 26, 2024
This also matters on the write side, for the same reasons
perf(p2p/conn): Buffer secret connection writes (#3346)
perf(p2p/conn): Use a read buffer on the secret connection (#3419)
perf(p2p/conn): Buffer secret connection writes (#3346)
perf(p2p/conn): Buffer secret connection writes (backport #3346) (#3485)
perf(p2p/conn): Use a read buffer on the secret connection (#3419)
perf(p2p/conn): Use a read buffer on the secret connection (backport #…
perf(p2p/conn): Buffer secret connection writes (backport cometbft#3346…
perf(p2p/conn): Buffer secret connection writes (#3346)
perf(p2p/conn): Use a read buffer on the secret connection (#3419)
perf(p2p/conn): Buffer secret connection writes (#3346)
perf(p2p/conn): Use a read buffer on the secret connection (#3419)