Streaming documents from ES to Discover? #170062
Labels
Feature:Discover
Discover Application
Feature:Search
Querying infrastructure in Kibana
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
loe:x-large
Extra Large Level of Effort
Team:DataDiscovery
Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.
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:The text was updated successfully, but these errors were encountered: