Skip to content

Run SaveABCIResponses and Commit in parallel #3290

Open

Description

@ValarDragon

Feature Request

Summary

Currently both SaveABCIResponses and Commit are ran in sequence during ApplyBlock. I think we should run these in parallel, as they both have I/O and CPU logic. Especially as SaveABCIResponses can increase in time.

Problem Definition

Certain things like large event loads or Beginblock/Endblock loads, can make the SaveABCIResponses time quite expensive. So we want to lower the amount of time spent on this in the critical path.

Proposal

Start SaveABCIResponses and app.Commit in parallel in blockexecutor.ApplyBlock

Activity

  1. added
    enhancement
    needs-triage
    on Jun 17, 2024
  2. cason commented on Jun 19, 2024

    @cason

    How would this impact on recovery?

    What the node crashes after Commit was executed but the ABCI responses were not yet persisted?

  3. ValarDragon commented on Jun 19, 2024

    @ValarDragon
    ContributorAuthor

    This may be my naiveness, I thought this call (after Commit completes) is what handles crash recovery (makes us not re-run commit), which is here:
    blockExec.store.Save(state)

  4. cason commented on Jun 21, 2024

    @cason

    I sincerely don't know why we write ABCI responses in a different DB/schema. We would need to check whether this is used during recovery or not.

  5. sergio-mena commented on Jul 22, 2024

    @sergio-mena
    Collaborator

    Before touching "delicate" parts of the code, we would like to see evidence, via profiling, that the (big?) performance improvement is worth the risk of changing this part of the code, just as we did with many other improvements that @ValarDragon initiated. One important risk being on the crash-recovery mechanism pointed out by @cason, which isn't easy to test exhaustively, and -- to this day -- isn't well specified either.

  6. sergio-mena commented on Jul 22, 2024

    @sergio-mena
    Collaborator

    We would need to check whether this is used during recovery or not.

    It is, and we are planning to refactor that part of the code (now that the SDK accepted to return the app hash in FinalizeBlock rather than in Commit). The current logic there is in quite a messy state TBH. Once that code gets cleaner, we can re-evaluate the change proposed in this issue (or even get rid of saving ABCI responses altogether).

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

    enhancementneeds-triagestate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions