悟空,拿我的打狗棒来

es索引为什么高峰期会很大,下午就会变小很多

Elasticsearch | 作者 CurryQin | 发布于2020年12月21日 | 阅读数:1543

最近发现线上的索引,在早上回占用大概有900M,但是在下午看的时候就变成150M,于是对比了下索引的信息,目前猜测是因为,高峰期文档更新比较多,但是es内部不会删除,只会将文档标记成.del,等到translog到阙值或者进行segment合并的时候,触发flush到磁盘会把.del的文档彻底物理删除了,然后内存会降下来,但是也不至于会下降这么多,有没有大佬能指点迷津一下,我截取了两个时间段的时候的索引的状态信息_stat接口
这是索引占用300M的时候状态:
{
"uuid": "YOEJFEcfSm6pHFKMvyZKfg",
"primaries": {
"docs": {
"count": 689756,
"deleted": 578114
},
"store": {
"size_in_bytes": 346432795
},
"indexing": {
"index_total": 1294917,
"index_time_in_millis": 3453717,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 13602,
"time_in_millis": 2139,
"exists_total": 13440,
"exists_time_in_millis": 2125,
"missing_total": 162,
"missing_time_in_millis": 14,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 41,
"query_time_in_millis": 63,
"query_current": 0,
"fetch_total": 41,
"fetch_time_in_millis": 66,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 2479,
"total_time_in_millis": 1514115,
"total_docs": 470989114,
"total_size_in_bytes": 32286052097,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 1155,
"total_auto_throttle_in_bytes": 17331834
},
"refresh": {
"total": 23456,
"total_time_in_millis": 2181194,
"external_total": 23387,
"external_total_time_in_millis": 2215445,
"listeners": 0
},
"flush": {
"total": 59,
"periodic": 42,
"total_time_in_millis": 6987
},
"warmer": {
"current": 0,
"total": 23359,
"total_time_in_millis": 5150
},
"query_cache": {
"memory_size_in_bytes": 39098,
"total_count": 220,
"hit_count": 58,
"miss_count": 162,
"cache_size": 6,
"cache_count": 80,
"evictions": 74
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 7,
"memory_in_bytes": 166330,
"terms_memory_in_bytes": 91168,
"stored_fields_memory_in_bytes": 4392,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 0,
"points_memory_in_bytes": 0,
"doc_values_memory_in_bytes": 70770,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 458592,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 6674,
"size_in_bytes": 129208475,
"uncommitted_operations": 6674,
"uncommitted_size_in_bytes": 129208475,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 0
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 2069268,
"deleted": 1857903
},
"store": {
"size_in_bytes": 1051274643
},
"indexing": {
"index_total": 3884751,
"index_time_in_millis": 10079711,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 13602,
"time_in_millis": 2139,
"exists_total": 13440,
"exists_time_in_millis": 2125,
"missing_total": 162,
"missing_time_in_millis": 14,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 68,
"query_time_in_millis": 97,
"query_current": 0,
"fetch_total": 67,
"fetch_time_in_millis": 102,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 6529,
"total_time_in_millis": 4280853,
"total_docs": 1366533985,
"total_size_in_bytes": 93093023229,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 3092,
"total_auto_throttle_in_bytes": 53728686
},
"refresh": {
"total": 59659,
"total_time_in_millis": 5926009,
"external_total": 59467,
"external_total_time_in_millis": 6017471,
"listeners": 0
},
"flush": {
"total": 177,
"periodic": 126,
"total_time_in_millis": 21747
},
"warmer": {
"current": 0,
"total": 59437,
"total_time_in_millis": 13592
},
"query_cache": {
"memory_size_in_bytes": 95860,
"total_count": 357,
"hit_count": 79,
"miss_count": 278,
"cache_size": 18,
"cache_count": 116,
"evictions": 98
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 30,
"memory_in_bytes": 587564,
"terms_memory_in_bytes": 342960,
"stored_fields_memory_in_bytes": 17856,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 0,
"points_memory_in_bytes": 0,
"doc_values_memory_in_bytes": 226748,
"index_writer_memory_in_bytes": 8562344,
"version_map_memory_in_bytes": 1428,
"fixed_bit_set_memory_in_bytes": 1228504,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 20022,
"size_in_bytes": 387625425,
"uncommitted_operations": 20022,
"uncommitted_size_in_bytes": 387625425,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 0
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
}
这是索引占用100M的时候状态:
{
"uuid": "cX1-NqvRRxO5y82yXsaeYw",
"primaries": {
"docs": {
"count": 702097,
"deleted": 8423
},
"store": {
"size_in_bytes": 51619137
},
"indexing": {
"index_total": 6145,
"index_time_in_millis": 16363,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 136,
"time_in_millis": 25,
"exists_total": 118,
"exists_time_in_millis": 23,
"missing_total": 18,
"missing_time_in_millis": 2,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 0,
"query_time_in_millis": 0,
"query_current": 0,
"fetch_total": 0,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 14,
"total_time_in_millis": 4698,
"total_docs": 1279446,
"total_size_in_bytes": 107763136,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 20971520
},
"refresh": {
"total": 152,
"total_time_in_millis": 4533,
"external_total": 144,
"external_total_time_in_millis": 4649,
"listeners": 0
},
"flush": {
"total": 0,
"periodic": 0,
"total_time_in_millis": 0
},
"warmer": {
"current": 0,
"total": 143,
"total_time_in_millis": 27
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 0,
"hit_count": 0,
"miss_count": 0,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 12,
"memory_in_bytes": 179880,
"terms_memory_in_bytes": 136368,
"stored_fields_memory_in_bytes": 6528,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 0,
"points_memory_in_bytes": 0,
"doc_values_memory_in_bytes": 36984,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 235848,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 6145,
"size_in_bytes": 98967107,
"uncommitted_operations": 6145,
"uncommitted_size_in_bytes": 98967107,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 0
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"docs": {
"count": 2106291,
"deleted": 24555
},
"store": {
"size_in_bytes": 154688896
},
"indexing": {
"index_total": 18435,
"index_time_in_millis": 48242,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
},
"get": {
"total": 136,
"time_in_millis": 25,
"exists_total": 118,
"exists_time_in_millis": 23,
"missing_total": 18,
"missing_time_in_millis": 2,
"current": 0
},
"search": {
"open_contexts": 0,
"query_total": 4,
"query_time_in_millis": 0,
"query_current": 0,
"fetch_total": 4,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 0,
"scroll_time_in_millis": 0,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
},
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 34,
"total_time_in_millis": 13374,
"total_docs": 3823793,
"total_size_in_bytes": 313568924,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 0,
"total_auto_throttle_in_bytes": 62914560
},
"refresh": {
"total": 366,
"total_time_in_millis": 12873,
"external_total": 356,
"external_total_time_in_millis": 13179,
"listeners": 0
},
"flush": {
"total": 0,
"periodic": 0,
"total_time_in_millis": 0
},
"warmer": {
"current": 0,
"total": 353,
"total_time_in_millis": 74
},
"query_cache": {
"memory_size_in_bytes": 0,
"total_count": 12,
"hit_count": 0,
"miss_count": 12,
"cache_size": 0,
"cache_count": 0,
"evictions": 0
},
"fielddata": {
"memory_size_in_bytes": 0,
"evictions": 0
},
"completion": {
"size_in_bytes": 0
},
"segments": {
"count": 33,
"memory_in_bytes": 482732,
"terms_memory_in_bytes": 356352,
"stored_fields_memory_in_bytes": 18312,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 0,
"points_memory_in_bytes": 0,
"doc_values_memory_in_bytes": 108068,
"index_writer_memory_in_bytes": 7475072,
"version_map_memory_in_bytes": 474,
"fixed_bit_set_memory_in_bytes": 705880,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {}
},
"translog": {
"operations": 18435,
"size_in_bytes": 296901321,
"uncommitted_operations": 18435,
"uncommitted_size_in_bytes": 296901321,
"earliest_last_modified_age": 0
},
"request_cache": {
"memory_size_in_bytes": 0,
"evictions": 0,
"hit_count": 0,
"miss_count": 0
},
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
}
已邀请:

medcl - 今晚打老虎。

赞同来自:

猜的没错,translog 过期和定期 merge 后的压缩会降低存储。有删除的话,merge 之后才会生效释放存储。

要回复问题请先登录注册