I have been using esrally and search profiler to test the performance of search queries processed by the existing cluster. I turned off request cache and the query cache for the index.
Test result
After running the search query 100 times with the search profiler, I found that it almost always took about 60 ms.
The service time from esrally was 10 ms. (client: 1, throughput: 1, iterations: 100)
Questions
Q1. Why is there such a big gap between the two test results?
I think this result odd because I think esrally's latency should be higher than the search profiler's cumulative time. As I understand it, the cumulative time from the search profiler is just the query processing time, while esrally's latency includes both the processing time and the network time.
Q2. Does esrally show no difference in latency time whether the test query includes a sort clause or not? The search-query used in the tests has a pretty complex sorting clause. The search profiler showed a big difference in cumulative time when the sorting was included versus when it wasn't, but esrally showed almost the same service time in both cases.
Here is my esrally track:
{
"description": "Benchmarking for product index",
"schedule": [
{
"operation": {
"name": "category-query",
"operation-type": "search",
"param-source": "category-search-query-source"
},
"clients": 1,
"warmup-iterations": 10,
"iterations": 110,
"target-throughput": 1
}
]
}
Here is my track.py:
def category_search(track, params, **kwargs):
return {
"cache": False,
"detailed-results": True,
"index": "product",
"body": {
"track_total_hits": True,
"from": 1,
"size": 80,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"term": {
"product_hidden_status": {
"value": 0
}
}
},
{
"terms": {
"platform_type": parameters.terms_random_platforms()
}
},
{
"terms": {
"product_state": parameters.terms_random_product_state()
}
},
{
"bool": {
"should": [
{
"term": {
"category_seq1": {
"value": parameters.term_random_category_seq(level=1)
}
}
}
]
}
}
],
"filter": [
{
"range": {
"sort_date": parameters.range_random_sort_date()
}
},
{
"range": {
"product_price": parameters.range_random_price()
}
}
],
"must_not": [
{
"exists": {
"field": "excluding_search"
}
},
{
"terms": {
"product_state": [
2,
4,
7
]
}
}
]
}
}
]
}
},
"sort": [
{
"image_detect": {
"order": "asc",
"unmapped_type": "integer"
}
},
{
"_score": {
"order": "desc"
}
},
{
"platform_type": {
"order": "asc"
}
},
{
"wish_cnt": {
"order": "desc",
"unmapped_type": "long"
}
},
{
"pay_flag": {
"order": "desc",
"unmapped_type": "long"
}
},
{
"sort_date": {
"order": "desc"
}
}
]
}
}
def register(registry):
registry.register_param_source("category-search-query-source", category_search)
Thank you for your time.