-
Notifications
You must be signed in to change notification settings - Fork 72
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
soroban-rpc: Add writethrough cache for Config ledger entries #837
Conversation
@2opremio doesn't the cache keep growing indefinitely? I would be worried about the memory consumption because I think the cache would just keep growing as long as soroban rpc is up. The other concern is that the cache is copied whenever a new read transaction is created. So if the cache is already large lots of concurrent requests could spike memory usage even more. |
It doesn't, because we only store the config ledger entries
Valid concern, but the number of possible ledger entries is small (~15) |
6d7f976
to
6c01757
Compare
@tamirms I feel likeI didn't supply enough context. We only cache config ledger entries. The preflight computation needs config parameters from the network and it fetches them (around 10 ledger entries) every time it runs. The number of config ledger entries is limited (around 15 of them, see https://github.com/stellar/stellar-xdr/blob/next/Stellar-contract-config-setting.x#L200-L217 ) so we don't have to worry about eviction. |
@tamirms PTAL |
After #692 I noticed that the DB access to config ledger entries is a big part of the preflight computation.
This PR adds a writethrough cache for config ledger entries.
Before the cache:
After adding the cache:
I am not sure it's worth the extra complexity though, considering it brings us down from
0.43
ms to0.32
ms per (simple) preflight.