针对如下的查询慢日志,怎么优化查询呢 在50并发,单节点配置 8G内存
[2016-08-07 10:43:32,264][WARN ][index.search.slowlog.query] took[193.7ms], took_millis[193], types[mall_item], stats, search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":200,"query":{"bool":{"filter":[{"term":{"isMarketable":true}},{"term":{"isAppSale":true}},{"terms":{"saleType":[0,2]}},{"term":{"categoryId":10}}]}},"explain":false}], extra_source,
[2016-08-07 10:43:32,276][WARN ][index.search.slowlog.fetch] took[212.1ms], took_millis[212], types[mall_item], stats, search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":200,"query":{"bool":{"filter":[{"term":{"isMarketable":true}},{"term":{"isAppSale":true}},{"terms":{"saleType":[0,2]}},{"term":{"categoryId":10}}]}},"explain":false}], extra_source,
查询很简单 但是并发量一高就慢了 这个查询的结果不会超过size的大小,最终的结果集大概是50,索引的总数量级 5W
[2016-08-07 10:43:32,264][WARN ][index.search.slowlog.query] took[193.7ms], took_millis[193], types[mall_item], stats, search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":200,"query":{"bool":{"filter":[{"term":{"isMarketable":true}},{"term":{"isAppSale":true}},{"terms":{"saleType":[0,2]}},{"term":{"categoryId":10}}]}},"explain":false}], extra_source,
[2016-08-07 10:43:32,276][WARN ][index.search.slowlog.fetch] took[212.1ms], took_millis[212], types[mall_item], stats, search_type[DFS_QUERY_THEN_FETCH], total_shards[5], source[{"from":0,"size":200,"query":{"bool":{"filter":[{"term":{"isMarketable":true}},{"term":{"isAppSale":true}},{"terms":{"saleType":[0,2]}},{"term":{"categoryId":10}}]}},"explain":false}], extra_source,
查询很简单 但是并发量一高就慢了 这个查询的结果不会超过size的大小,最终的结果集大概是50,索引的总数量级 5W
1 个回复
martindu - 搜披露创始人
赞同来自:
另外如果并发上来就慢了话可以考虑加几个节点和Replica。Replica会分担查询,提升速度。