indices.memory.translog_buffer_size translog大小配置好像不生效
Elasticsearch | 作者 code4j | 发布于2018年03月22日 | 阅读数:2984
日志索引按小时创建新的索引,配置信息如下:
因为集群日志中隔三十秒会打印一个日志,内容是这样的:
recalculating shard indexing buffer, total is [1.5gb] with [7] active shards, each shard set to indexing=[222.3mb], translog=[64kb]
translog的阈值为64KB?这个是默认值,并不是我修改的。
看了下源码:
ShardsIndicesStatusChecker类是每隔半个小时做一次检查,然后会校验translog大小,有这么一段:
translog 默认是按百分比分配的,我配置了堆内存的3%,堆16G,也就是说应该是48mb左右,分成8个shard差不多60M一个,但是从上面的日志看,还是64KB。
实际现象也确实证明translog刷新大小阈值不是我配置的大小,translog每秒都在,但是我更新的速度并没有6M这么高。正常情况应该是内存中达到6m后再fsync translog到磁盘上。
不知道这个配置怎么做才能生效呢?
"settings": {
"index": {
"xxx": {
"size": "10mb"
},
"number_of_replicas": "0",
"translog": {
"flush_threshold_ops": "10000000",
"flush_threshold_size": "5120m",
"flush_threshold_period": "30m",
"sync_interval": "30s",
"durability": "async"
},
"search": {
"slowlog": {
"threshold": {
"fetch": {
"warn": "1s"
},
"query": {
"warn": "3s"
}
}
}
},
"merge": {
"policy": {
"merge_factor": "15",
"max_merged_segment": "1g",
"segments_per_tier": "20"
}
},
"indexing": {
"slowlog": {
"threshold": {
"index": {
"warn": "500ms"
}
}
}
},
"indices": {
"store": {
"throttle": {
"max_bytes_per_sec": "100mb"
}
},
"memory": {
"index_buffer_size": "15%",
"max_shard_translog_buffer_size": "128mb",
"translog_buffer_size": "3%"
}
},
"number_of_shards": "8",
"refresh_interval": "-1"
}
}
但是这个配置好像并没有生效:translog_buffer_size因为集群日志中隔三十秒会打印一个日志,内容是这样的:
recalculating shard indexing buffer, total is [1.5gb] with [7] active shards, each shard set to indexing=[222.3mb], translog=[64kb]
translog的阈值为64KB?这个是默认值,并不是我修改的。
看了下源码:
ShardsIndicesStatusChecker类是每隔半个小时做一次检查,然后会校验translog大小,有这么一段:
ByteSizeValue shardIndexingBufferSize = new ByteSizeValue(indexingBuffer.bytes() / activeShardCount);
if (shardIndexingBufferSize.bytes() < minShardIndexBufferSize.bytes()) {
shardIndexingBufferSize = minShardIndexBufferSize;
}
if (shardIndexingBufferSize.bytes() > maxShardIndexBufferSize.bytes()) {
shardIndexingBufferSize = maxShardIndexBufferSize;
}
ByteSizeValue shardTranslogBufferSize = new ByteSizeValue(translogBuffer.bytes() / activeShardCount);
if (shardTranslogBufferSize.bytes() < minShardTranslogBufferSize.bytes()) {
shardTranslogBufferSize = minShardTranslogBufferSize;
}
if (shardTranslogBufferSize.bytes() > maxShardTranslogBufferSize.bytes()) {
shardTranslogBufferSize = maxShardTranslogBufferSize;
}
translog 默认是按百分比分配的,我配置了堆内存的3%,堆16G,也就是说应该是48mb左右,分成8个shard差不多60M一个,但是从上面的日志看,还是64KB。
实际现象也确实证明translog刷新大小阈值不是我配置的大小,translog每秒都在,但是我更新的速度并没有6M这么高。正常情况应该是内存中达到6m后再fsync translog到磁盘上。
不知道这个配置怎么做才能生效呢?
1 个回复
kennywu76 - Wood
赞同来自: