Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event sourced persistence #913

Closed
12 of 13 tasks
ghost opened this issue Jun 8, 2023 · 1 comment · Fixed by #1000 or #999
Closed
12 of 13 tasks

Event sourced persistence #913

ghost opened this issue Jun 8, 2023 · 1 comment · Fixed by #1000 or #999
Labels
green 💚 Low complexity or well understood feature 💬 feature A feature on our roadmap
Milestone

Comments

@ghost
Copy link

ghost commented Jun 8, 2023

Why

We want the hydra-node to be efficient in processing events to yield a high throughput on processing transactions.

Work done on as part of #186 has demonstrated that the primary bottleneck to faster transaction processing inside the node was the state persistence logic which simply overwrites the full state with whatever new state has been produced. While we also persist synchronously the ServerOutputs in the API server, this has a low impact on tx processing as we use an append-only file.

What

  • Architectural changes are documented in an ADR Introduce ADR for event-sourced persistence #940
  • Performance must be better than before
    • Can use hydra-cluster benchmarks to ensure this
  • Retain a means to inspect the internal head state in a human-readable format
  • No semantic changes of the end-to-end or higher level tests in hydra-node (e.g. Behavior)

How

  • Do a spike to validate Introduce ADR for event-sourced persistence #940 and identify definite steps we want to do here
  • Create or make sure tests exist
    • A node can be restored from disk
    • (maybe) The persisted state is not growing too fast
  • Introduce StateChanged - the actual event in this event sourcing - with a single, dummy StateReplaced HeadState constructor
  • Introduce an aggregate :: HeadState -> StateChanged -> HeadState function and change Outcome to return StateChanged instead of NewState
  • Enumerate all the StateChanged cases and move state update from update to aggregate cases incrementally Introduce event-sourcing style in the HeadLogic #999
  • Change persistence to use events Load and save event sourced state #1000
  • Potentially update the ADR to reflect what was actually done + make it accepted
@ghost ghost added the task Subtask of a bigger feature. label Jun 8, 2023
@ghost ghost assigned ghost and pgrange Jun 8, 2023
@ch1bo ch1bo changed the title Persist state incrementally instead of overwriting full state in place Event sourced persistence Jun 13, 2023
@ch1bo ch1bo added 💬 feature A feature on our roadmap and removed task Subtask of a bigger feature. labels Jun 13, 2023
@ch1bo ch1bo unassigned pgrange and ghost Jun 13, 2023
@ch1bo ch1bo added the green 💚 Low complexity or well understood feature label Jun 13, 2023
@ch1bo
Copy link
Member

ch1bo commented Jun 20, 2023

Should regroom this if needed with #940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
green 💚 Low complexity or well understood feature 💬 feature A feature on our roadmap
Projects
None yet
3 participants