a1vin-tian commented on a change in pull request #7153:
URL: https://github.com/apache/skywalking/pull/7153#discussion_r657571935
##########
File path:
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/PersistenceTimer.java
##########
@@ -77,9 +83,16 @@ public void start(ModuleManager moduleManager,
CoreModuleConfig moduleConfig) {
"persistence_timer_bulk_execute_latency", "Latency of the execute
stage in persistence timer",
MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE
);
+ allLatency = metricsCreator.createHistogramMetric(
+ "persistence_timer_bulk_all_latency", "Latency of the all stage in
persistence timer",
+ MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE
+ );
+
syncOperationThreadsNum = moduleConfig.getSyncThreads();
maxSyncoperationNum = moduleConfig.getMaxSyncOperationNum();
+ batchExecutorService = Executors.newSingleThreadExecutor();
Review comment:
Yes. We can avoid this thread by just use multi-consumer. It will bring
some competition, but it is ok.
```
List<Future<?>> batchFutures = new ArrayList<>();
for (int i = 0; i < syncOperationThreadsNum; i++) {
Future<?> batchFuture = executorService.submit(() -> {
// consume the metrics
while (!stop.get()) {
List<PrepareRequest> partition =
prepareQueue.popMany();
if (partition.isEmpty()) {
break;
}
HistogramMetrics.Timer executeLatencyTimer =
executeLatency.createTimer();
try {
if (CollectionUtils.isNotEmpty(partition)) {
batchDAO.synchronous(partition);
}
} catch (Throwable e) {
log.error(e.getMessage(), e);
} finally {
executeLatencyTimer.finish();
}
}
return null;
});
batchFutures.add(batchFuture);
}
```
for (Future<?> result : batchFutures) {
result.get();
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]