Skip to content

Secret Connection: Buffer the underlying connection #3198

Closed

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.

Activity

  1. added
    enhancement
    needs-triage
    on Jun 6, 2024
  2. added and removed
    needs-triage
    on Jun 11, 2024
  3. ValarDragon commented on Jun 26, 2024

    @ValarDragon
    ContributorAuthor

    This also matters on the write side, for the same reasons

  4. added a commit that references this issue on Jul 5, 2024
    e1eabe0
  5. moved this from Todo to Done in CometBFTon Jul 5, 2024
  6. added a commit that references this issue on Jul 10, 2024
    fb3b531
  7. added a commit that references this issue on Jul 10, 2024
    f0b8902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementp2p

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions