Nest performance issue
See original GitHub issueNEST/Elasticsearch.Net version: 2.3.1
Elasticsearch version: 2.3.1
Description of the problem including expected versus actual behavior:
0 down vote favorite I’m upgrading elasticsearch from 1.6 to 2.3.1 (includes Nest upgrade from 1.6.1 to 2.3.1).
I’m facing a severe performance degradation in aggregation requests. In order to verify it, i have created a console application to compare between the versions.
The performance of Nest 2.3.1 (elastic 2.3.1) is slower by about 100% than 1.6.1 (elastic 1.6). (30 sec to 59 sec)
Then, I have tested the same query directly on elastic 1.6 and 2.3.1 (with Sense) - the performance was similar.
Therefore, as i see it - there is a severe performance issue in Nest (i have tested the most of 2.X Nest versions)
Steps to reproduce:
- Create a console application
- Create aggregation with many fields, you can see code example:
Provide DebugInformation
(if relevant):
Interesting insight:
When I change query from the lambda syntax to string syntax the performance is much better (1 seconds instead of 12 seconds).
(instead of Terms('hi', x=> x.Field(f => f.ProductName))
I do Terms('hi', x=> x.Field("ProductName"))
)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top GitHub Comments
Hey,
Sorry for the late response. I have found the root cause for the performance degradation. In Nest 1.6 the method of creation newtonsoft serializer is a static method, in since NEST 2.0 this method is not static.
In our codebase, we create the elastic client connection in every request (we have an abstraction on elastic). The garbage collector cleans newtonsoft cache and serialization time increase significantly.
We fixed it, thanks!
Yes see also: https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/lifetimes.html