-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add benchmark to test xcontent parser filter performance #80069
add benchmark to test xcontent parser filter performance #80069
Conversation
@nik9000 I separate the improve and the benchmark. |
@elasticmachine, test this please |
👍 |
benchmarks/src/main/java/org/elasticsearch/benchmark/xcontent/FilterContentBenchmark.java
Outdated
Show resolved
Hide resolved
benchmarks/src/main/java/org/elasticsearch/benchmark/xcontent/FilterContentBenchmark.java
Outdated
Show resolved
Hide resolved
benchmarks/src/main/java/org/elasticsearch/benchmark/xcontent/FilterContentBenchmark.java
Outdated
Show resolved
Hide resolved
benchmarks/src/main/java/org/elasticsearch/benchmark/xcontent/FilterContentBenchmark.java
Outdated
Show resolved
Hide resolved
benchmarks/src/main/java/org/elasticsearch/benchmark/xcontent/FilterContentBenchmark.java
Outdated
Show resolved
Hide resolved
benchmarks/src/main/java/org/elasticsearch/benchmark/xcontent/FilterContentBenchmark.java
Outdated
Show resolved
Hide resolved
@Param({ "10_field", "half_field", "all_field", "wildcard_field", "10_wildcard_field" }) | ||
private String fieldCount; | ||
|
||
@Param({ "true", "false" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the short term you should set this to just "true"
. Because of the jackson bug. I feel bad about having this known issue but we have a fix in flight. It's just tangled in something else which is tangled in some other thing and all stuck....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, done
Awesome. Code looks right to me. I'm going to run it locally because jenkins doesn't do that. |
@elasticmachine test this please |
Pinging @elastic/es-analytics-geo (Team:Analytics) |
@weizijun it looks like precommit is failing. Could you fix it? I think it's just an unused import. |
@elasticmhachine, test this please |
FilterPathBasedFilter is used for filter XContent. Old FilterPath is implemented with a linked list. When it has many patterns. The filter performance is lower. I implement a new FilterPath. It use a Tree to filter XContent. The FilterPath Tree has two kind of children. - One is a hashmap for term pattern. It can find the match field in O(1). - Another is a hashmap for wildcard pattern.It will check all node of hashmap. The benchmark I added in #80069 shows runtime halved in the non-wildcard cases. The wildcardcases have pretty similar runtime. There is an increase in runtime when newly building the filter each time. This is acceptable because the cases where we have to be as fast as possible we're already reusing the filter. ``` Benchmark (fieldCount) (data) Mode Cnt Before ns/op After ns/op NewParserConfig 10_field cluster_stats avgt 3 120303.585 120724.363 NewParserConfig 10_field index_stats avgt 3 22163.350 25700.478 NewParserConfig 10_field node_stats avgt 3 25838.040 25455.610 NewParserConfig half_field cluster_stats avgt 3 1052058.673 551504.323 NewParserConfig half_field index_stats avgt 3 99443.623 64639.860 NewParserConfig half_field node_stats avgt 3 119383.384 78739.087 NewParserConfig all_field cluster_stats avgt 3 1850317.142 949238.665 NewParserConfig all_field index_stats avgt 3 135923.737 102391.586 NewParserConfig all_field node_stats avgt 3 177303.659 134091.199 NewParserConfig wildcard_field cluster_stats avgt 3 242419.000 158402.969 NewParserConfig wildcard_field index_stats avgt 3 19677.926 16604.226 NewParserConfig wildcard_field node_stats avgt 3 21932.954 20135.669 NewParserConfig 10_wildcard_field cluster_stats avgt 3 217022.657 186846.661 NewParserConfig 10_wildcard_field index_stats avgt 3 33292.234 27895.644 NewParserConfig 10_wildcard_field node_stats avgt 3 41748.139 31325.693 ParserConfigReused 10_field cluster_stats avgt 3 120882.036 94980.708 ParserConfigReused 10_field index_stats avgt 3 16474.120 12325.762 ParserConfigReused 10_field node_stats avgt 3 20947.328 14945.972 ParserConfigReused half_field cluster_stats avgt 3 393069.494 182547.734 ParserConfigReused half_field index_stats avgt 3 28891.619 17536.035 ParserConfigReused half_field node_stats avgt 3 32433.385 22170.274 ParserConfigReused all_field cluster_stats avgt 3 551217.667 210148.246 ParserConfigReused all_field index_stats avgt 3 45367.850 20630.002 ParserConfigReused all_field node_stats avgt 3 55899.647 24953.435 ParserConfigReused wildcard_field cluster_stats avgt 3 159949.383 173188.846 ParserConfigReused wildcard_field index_stats avgt 3 15713.951 17187.918 ParserConfigReused wildcard_field node_stats avgt 3 19171.149 19932.483 ParserConfigReused 10_wildcard_field cluster_stats avgt 3 172137.559 173138.035 ParserConfigReused 10_wildcard_field index_stats avgt 3 24635.608 21296.013 ParserConfigReused 10_wildcard_field node_stats avgt 3 28866.104 26567.965 ```
add a benchmark to test xcontent parser filter performance.
First add the PR.Then it will use to benchmark the performance before and after the improvement.
Here is the benchmark result: