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

Constant memory API server history using StateEvents #1618

Open
2 of 3 tasks
ch1bo opened this issue Sep 10, 2024 · 2 comments · Fixed by #1808
Open
2 of 3 tasks

Constant memory API server history using StateEvents #1618

ch1bo opened this issue Sep 10, 2024 · 2 comments · Fixed by #1808
Assignees
Labels
💬 feature A feature on our roadmap

Comments

@ch1bo
Copy link
Member

ch1bo commented Sep 10, 2024

Why

While working on the hydra-doom project, we noticed that the in memory state grew without bound (see #1572). This meant that, at the sustained load that the hydra doom demo was producing, nodes became inoperable after just a few hours.

One of the culprits was the ?history of the hydra-node websocket API. That feature sends clients the whole history by default (can be turned off, see documentation https://hydra.family/head-protocol/docs/api-behavior#replay-of-past-server-outputs)

We want to make Hydra heads be operable for long times even with sustained load, which requires us to bound any memory usage (and even disk usage, see #1581).

What

  • The default behavior of the websocket API is to not send the whole history, but only the Greetings message.
    • This breaking change is to be communicated properly
  • The API server history, if requested by ?history=true, is loaded on-demand from disk.

How

@ch1bo
Copy link
Member Author

ch1bo commented Sep 16, 2024

Related ADR which also proposes to implement projections on top of the main event stream:https://hydra.family/head-protocol/adr/25

@noonio noonio mentioned this issue Sep 25, 2024
12 tasks
@noonio noonio moved this from Later to Todo 📋 in ☕ Hydra Team Work Sep 30, 2024
@noonio noonio added this to the 0.20.0 milestone Oct 15, 2024
@noonio noonio added 💬 feature A feature on our roadmap amber ⚠️ Medium complexity or partly unclear feature labels Nov 11, 2024
@ch1bo ch1bo mentioned this issue Jan 28, 2025
4 tasks
@noonio noonio removed this from the 0.20.0 milestone Jan 29, 2025
@noonio noonio linked a pull request Feb 4, 2025 that will close this issue
4 tasks
@ch1bo ch1bo removed the 💭 idea An idea or feature request label Feb 4, 2025
@noonio noonio removed the amber ⚠️ Medium complexity or partly unclear feature label Feb 4, 2025
github-merge-queue bot pushed a commit that referenced this issue Feb 6, 2025
Changes I made originally for the `hydra-doom` project to load all
events in `state` (12GB+ in that use case) with constant memory using
`conduit` streams.

~~There is a big TODO on this: `IOSim s` does not have a `MonadUnliftIO`
instance and its not impossible to have one. We need to change the
interface further such that we can compose `createHydraNode` and
`hydrate` functions with in-memory `EventSource` variants.~~

~~A bit of a wart: The `mkProjection` does run the conduit for each
projection, instead we should run the conduit once and build the
projected in-memory read/query model once.~~

Also, the change here is not constant-memory as the `ServerOutput`
history is still kept fully in memory. But this is a different story and
should be covered by #1618

---

* [x] CHANGELOG updated or not needed
* [x] Documentation updated or not needed
* [x] Haddocks updated or not needed
* [x] No new TODOs introduced or explained herafter
@github-project-automation github-project-automation bot moved this from Todo 📋 to Done ✔ in ☕ Hydra Team Work Feb 6, 2025
@ch1bo ch1bo reopened this Feb 6, 2025
@github-project-automation github-project-automation bot moved this from Done ✔ to Triage 🏥 in ☕ Hydra Team Work Feb 6, 2025
@ch1bo
Copy link
Member Author

ch1bo commented Feb 6, 2025

Not fully done yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💬 feature A feature on our roadmap
Projects
Status: Triage 🏥
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants