storage.elasticsearch.bulkActions
文档:
Async bulk size of the record data batch execution.
源码:
// org.apache.skywalking.library.elasticsearch.bulk.BulkProcessor
public CompletableFuture<Void> add(UpdateRequest request) {
return internalAdd(request);
}
@SneakyThrows
private CompletableFuture<Void> internalAdd(Object request) {
requireNonNull(request, "request");
final CompletableFuture<Void> f = new CompletableFuture<>();
requests.put(new Holder(f, request));
flushIfNeeded();
return f;
}
@SneakyThrows
private void flushIfNeeded() {
if (requests.size() >= bulkActions) {
flush();
}
}
就是多少个update请求会作为一批,一块flush.
storage.elasticsearch.flushInterval
文档:
Period of flush (in seconds). Does not matter whether bulkActions is reached or not. INT(flushInterval * 2/3) is used for index refresh period.
源码1:
BulkProcessor(
final AtomicReference<ElasticSearch> es, final int bulkActions,
final Duration flushInterval, final int concurrentRequests) {
。。。
scheduler.scheduleWithFixedDelay(
this::flush, 0, flushInterval.getSeconds(), TimeUnit.SECONDS);
}
就是每隔多少秒flush一次。
源码2:org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.StorageEsInstaller#createSetting
protected Map<String, Object> createSetting(Model model) throws StorageException {
Map<String, Object> setting = new HashMap<>();
// Set the index refresh period as INT(flushInterval * 2/3). At the edge case,
// in low traffic(traffic < bulkActions in the whole period), there is a possible case, 2 period bulks are included in
// one index refresh rebuild operation, which could cause version conflicts. And this case can't be fixed
// through `core/persistentPeriod` as the bulk fresh is not controlled by the persistent timer anymore.
int indexRefreshInterval = config.getFlushInterval() * 2 / 3;
if (indexRefreshInterval < 5) {
// The refresh interval should not be less than 5 seconds (the recommended default value = 10s),
// and the bulk flush interval should not be set less than 8s (the recommended default value = 15s).
// This is a precaution case which makes ElasticSearch server has reasonable refresh interval,
// even this value is set too small by end user manually.
indexRefreshInterval = 5;
}
setting.put("index.refresh_interval", indexRefreshInterval + "s");
return setting;
}
就是设置index.refresh_interval的值。
因此,storage.elasticsearch.flushInterval这参数实际是有2个作用的。
storage.elasticsearch.concurrentRequests
文档:
The number of concurrent requests allowed to be executed.
源码:
//org.apache.skywalking.library.elasticsearch.bulk.BulkProcessor#BulkProcessor
BulkProcessor(
this.bulkActions = bulkActions;
this.semaphore = new Semaphore(concurrentRequests > 0 ? concurrentRequests : 1);
}
// org.apache.skywalking.library.elasticsearch.bulk.BulkProcessor#flush
void flush() {
if (requests.isEmpty()) {
return;
}
try {
semaphore.acquire();
} catch (InterruptedException e) {
log.error("Interrupted when trying to get semaphore to execute bulk requests", e);
return;
}
}
就是允许多少个线程并发的执行flush。文章来源:https://www.toymoban.com/news/detail-425703.html
ps:文档在这里文章来源地址https://www.toymoban.com/news/detail-425703.html
到了这里,关于skywalking的那些配置参数的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!