-
Notifications
You must be signed in to change notification settings - Fork 23
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
Optimise db performance of GetLedgerRange
#256
Conversation
LatestLedger
key from meta
tableLatestLedger
key from meta
table
LatestLedger
key from meta
tableLatestLedger
key from meta
table
@2opremio I will include caching the ledger range in another PR since I am testing things with it and this PR can be merged without it. |
Caching the latest ledger is pretty fundamental for performance, so I would rather wait to have caching in main. |
@2opremio The |
Ah ok, then the PR description and title are outdated. Can you update them? |
Or do you mean that everything is cached and working except to the oldest ledger and the oldest ledger close time? |
OK, I've taken a look at the code
As I recall, this places it into the downstream cache, but doesn't really use the cache (as you can see in the code the code doesn't check the cache for the value it just writes to it). We need to be careful about using One option is to actually read from the cache there but I think there were some subtleties preventing from doing so. Can you take a look? |
db7c584
to
3928831
Compare
LatestLedger
key from meta
tableGetLedgerRange
This reverts commit f7ebe3e.
I am missing a migration to remove the entry from the meta table. |
…-range-cache # Conflicts: # cmd/soroban-rpc/internal/db/db.go # cmd/soroban-rpc/internal/ingest/mock_db_test.go # cmd/soroban-rpc/internal/ingest/service_test.go
What
Fixes #233
LatestLedger
key frommeta
table. UseGetLedgerRange
function since it already contains information about the latest ledger.GetLedgerRange
faster by cachinglatestLedgerSeq
andlatestLedgerCloseTime
. This leads to a single query to get the oldest ledger and its close time.Why
The
latestLedgerSeq
key can be removed since we already get that info from ledger range function. TheGetLedgerRange
is used a lot now so it is important to make it faster by caching the values.Known limitations
NA