This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
curl -XGET localhost:8432/a/1AuGvfDfNhbeVNUDzXHjLmEnFnWv3pkjjG/utxos
Response time: ~60 seconds or time out.
Debug:
To get utxos, we searchRange all blocks by addressToScriptID:
If latest block is ~1M6. Split all blocks to n time to hit db by chunkSize.
Example, latest block is ~1M6. / chunkSize(10) = 160k times.
i found that chunkSize too small, hit to leveldb too much.
Reduce n to help reduce response time
Solution:
I tried to increase chunkSize value to 100, 1000, 10_000 and 100_000.
Benchmark show that with chunkSize = 10_000 return good response Time
< 1 seconds on mainnet