Skip to content

Secret Connection: Buffer the underlying connection #3198

@ValarDragon

Description

@ValarDragon

Feature Request

Summary

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:

  1. sc.Read(10kb)
  2. Syscall read 1048 bytes (encrypted data frame)
  3. SecretConn decrypt
  4. Return 1024 bytes (data-component of a data frame)
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions