Open afharo opened 1 year ago
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)
thx @afharo , this applies to docs in Discover, but imho would be equally favorable for agg-responses for dashboard visualizations
I believe https://github.com/elastic/elasticsearch/issues/109576 is blocking this. Async-search requires reading some metadata about the response, and this cannot be done without unpacking the ES-response on the server at this point.
cc @lukasolson @ppisljar
I found an issue for
/internal/bsearch
that I think only affects Discover because we retrieve the full JSON documents: Elasticsearch's response size is dependent on the users' data model, so large avg-sized documents could cause Kibana to struggle when/internal/bsearch
holds 500 documents in memory (to compress them and return it to the client).For context: I recently ran some tests simulating the requests made by Discover in an index populated via
makelogs
. The average size of the documents is 9kB, and Discover fetches 500 docs via/internal/bsearch
. This results in Kibana using 4.4MB only to handle that request. When we multiply this by multiple concurrent users performing the same request, that can quickly add up (50 users can cause a spike in memory usage of 220MB).Since Discover is fetching the data (mostly) as-is from ES, we may want to stream the response to avoid overusing the server's resources.
I managed to replicate it locally on
main
:yarn es snapshot
NODE_OPTIONS="--max-old-space-size=550" yarn start --no-base-path
source request.sh 200
)yarn makelogs --auth="system_indices_superuser:changeme" --host 127.0.0.1:9200 -d 90/1 -c 10000
source request.sh 1
)source request.sh 5
)The content of
request.sh
is below: