Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[EVE-35] Caching aggregates to avoid repeated loads

See original GitHub issue


  • Place the loaded aggregate instance in a cache
  • When getting a command for that instance, get it from the cache instead of loading it from the stream
  • Check the stream revision
  • If it’s higher, read the stream tail

It can be done in a composable version of the AggregateStore.


Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

ugumbacommented, May 13, 2023

#218 , #219 and #220 together add implicit support for IMemoryCache (if injected). I’ve only been able to run the basic tests, but the changes are also very basic… 😃

Tests in my own application indicate that more than 10 times as many (basic) commands can be processed in 1 second than without caching. With longer intervals, the difference should be exponentially better.

I’ve ignored composability, but I’ll look into it next - use of IMemoryCache must at least be optional.

alexeyzimarevcommented, May 11, 2023

As I am currently working on subscriptions (split of physical subscription and consumer pipeline), it is now up for grabs. It’s relatively straightforward, and I think the good first step would be to add it at the lowest level (read of stream in the event reader). Composition would work there nicely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · Eventuous/eventuous
Npgsql.PostgresException: 23505: duplicate key value violates unique ... [EVE-35] Caching aggregates to avoid repeated loads linear Sync the issue to Linear ...
Read more >
Optimizing Aggregate Loading - Axon Reference Guide
For true optimization, caches should keep data in-memory (and preferably on-heap) for best performance. This prevents the need to (re)serialize aggregates when ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found