Use elastic multiple search for network stats - #1627
Merged
Conversation
|
k6 load testing comparison.
Legend: Avg - Average Response Time, Max - Maximum Response Time, 90 - 90th Percentile, 95 - 95th Percentile |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
claudiulataretu
approved these changes
Aug 28, 2026
popenta
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reasoning
GET /network/statsissued four separate Elastic count requests (blocks, accounts, transactions, scResults), one per count._msearchcan batch all four into a single HTTP request.Proposed Changes
IndexerService.getStatsCounts(), backed by one_msearchinElasticIndexerService, returning all four counts asStatsCounts.NetworkService.getStatsnow makes that single call; the unusedAccountService/TransactionService/SmartContractResultServicedependencies were dropped.postNdjsontoEsCircuitBreakerProxy:ElasticService.postcannot set headers, and axios corrupts an ndjson body when the content type isapplication/json. Requests still go through the circuit breaker.max_concurrent_searches, otherwise_msearchruns the sub-searches less concurrently than four parallel requests would.CacheInfo.StatsCounts(1s TTL) to preserve the caching the individual counts had, and keep honouringnoCache.How to test
GET /network/statsreturns the same values as before; counts verified against the four individual_countqueries on devnet (blocks, accounts, transactions, scResults all matched).GET /network/stats?noCache=truebypasses the cache.npm run test -- circuit.breaker.proxypasses.