Skip to content

Commit

Permalink
Update dropwizard.metrics to 4.2.12
Browse files Browse the repository at this point in the history
Part of #3069

Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
  • Loading branch information
farodin91 committed Sep 21, 2022
1 parent 817a0fb commit bba5d62
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -160,6 +161,8 @@ public class Backend implements LockerProvider, AutoCloseable {

private static final long ETERNAL_CACHE_EXPIRATION = 1000L *3600*24*365*200; //200 years

private static final AtomicLong NAME_COUNTER = new AtomicLong();

//############ Registered Storage Managers ##############

private static final Map<StandardStoreManager, ConfigOption<?>> STORE_SHORTHAND_OPTIONS = Collections.unmodifiableMap(new HashMap<StandardStoreManager, ConfigOption<?>>() {{
Expand Down Expand Up @@ -697,14 +700,14 @@ static ExecutorService buildExecutorService(Configuration configuration){

ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Backend[%02d]").build();
if (configuration.get(BASIC_METRICS)) {
threadFactory = ExecutorServiceInstrumentation.instrument(configuration.get(METRICS_PREFIX), "backend", threadFactory);
threadFactory = ExecutorServiceInstrumentation.instrument(configuration.get(METRICS_PREFIX), "backend-" + NAME_COUNTER.incrementAndGet(), threadFactory);
}

ExecutorServiceConfiguration executorServiceConfiguration =
new ExecutorServiceConfiguration(executorServiceClass, corePoolSize, maxPoolSize, keepAliveTime, threadFactory);
ExecutorService executorService = ExecutorServiceBuilder.build(executorServiceConfiguration);
if (configuration.get(BASIC_METRICS)) {
executorService = ExecutorServiceInstrumentation.instrument(configuration.get(METRICS_PREFIX), "backend", executorService);
executorService = ExecutorServiceInstrumentation.instrument(configuration.get(METRICS_PREFIX), "backend-" + NAME_COUNTER.incrementAndGet(), executorService);
}
return executorService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;

import static org.janusgraph.diskstorage.cql.CQLConfigOptions.ATOMIC_BATCH_MUTATE;
import static org.janusgraph.diskstorage.cql.CQLConfigOptions.BATCH_STATEMENT_SIZE;
Expand All @@ -46,34 +47,36 @@

public class CQLMutateManyFunctionBuilder {

private static final AtomicLong NAME_COUNTER = new AtomicLong();

public CQLMutateManyFunctionWrapper build(final CqlSession session, final Configuration configuration,
final TimestampProvider times, final boolean assignTimestamp,
final Map<String, CQLKeyColumnValueStore> openStores,
ConsumerWithBackendException<DistributedStoreManager.MaskedTimestamp> sleepAfterWriteFunction){
final TimestampProvider times, final boolean assignTimestamp,
final Map<String, CQLKeyColumnValueStore> openStores,
ConsumerWithBackendException<DistributedStoreManager.MaskedTimestamp> sleepAfterWriteFunction) {

ExecutorService executorService;
CQLMutateManyFunction mutateManyFunction;

int batchSize = configuration.get(BATCH_STATEMENT_SIZE);
boolean atomicBatch = configuration.get(ATOMIC_BATCH_MUTATE);

if(configuration.get(EXECUTOR_SERVICE_ENABLED)){
if (configuration.get(EXECUTOR_SERVICE_ENABLED)) {
executorService = buildExecutorService(configuration);
try{
if(atomicBatch){
try {
if (atomicBatch) {
mutateManyFunction = new CQLExecutorServiceMutateManyLoggedFunction(times,
assignTimestamp, openStores, session, executorService, sleepAfterWriteFunction);
} else {
mutateManyFunction = new CQLExecutorServiceMutateManyUnloggedFunction(batchSize,
session, openStores, times, executorService, assignTimestamp, sleepAfterWriteFunction);
}
} catch (RuntimeException e){
} catch (RuntimeException e) {
executorService.shutdown();
throw e;
}
} else {
executorService = null;
if(atomicBatch){
if (atomicBatch) {
mutateManyFunction = new CQLSimpleMutateManyLoggedFunction(times,
assignTimestamp, openStores, session, sleepAfterWriteFunction);
} else {
Expand All @@ -95,14 +98,20 @@ private ExecutorService buildExecutorService(Configuration configuration) {
.setNameFormat("CQLStoreManager[%02d]")
.build();
if (configuration.get(BASIC_METRICS)) {
threadFactory = ExecutorServiceInstrumentation.instrument(configuration.get(METRICS_PREFIX), "CqlStoreManager", threadFactory);
threadFactory = ExecutorServiceInstrumentation.instrument(
configuration.get(METRICS_PREFIX),
"CqlStoreManager-" + NAME_COUNTER.incrementAndGet(),
threadFactory);
}

ExecutorServiceConfiguration executorServiceConfiguration =
new ExecutorServiceConfiguration(executorServiceClass, corePoolSize, maxPoolSize, keepAliveTime, threadFactory);
ExecutorService executorService = ExecutorServiceBuilder.build(executorServiceConfiguration);
if (configuration.get(BASIC_METRICS)) {
executorService = ExecutorServiceInstrumentation.instrument(configuration.get(METRICS_PREFIX), "CqlStoreManager", executorService);
executorService = ExecutorServiceInstrumentation.instrument(
configuration.get(METRICS_PREFIX),
"CqlStoreManager-" + NAME_COUNTER.incrementAndGet(),
executorService);
}
return executorService;
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<junit.version>5.8.2</junit.version>
<mockito.version>4.6.1</mockito.version>
<jamm.version>0.3.0</jamm.version>
<metrics.version>4.1.32</metrics.version>
<metrics.version>4.2.12</metrics.version>
<slf4j.version>1.7.36</slf4j.version>
<logback.version>1.2.11</logback.version>
<httpcomponents.httpclient.version>4.5.13</httpcomponents.httpclient.version>
Expand Down

1 comment on commit bba5d62

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: bba5d62 Previous: 1f346c6 Ratio
org.janusgraph.MgmtOlapJobBenchmark.runRemoveIndex 114.14041148737374 ms/op 113.86522786767678 ms/op 1.00
org.janusgraph.JanusGraphSpeedBenchmark.basicAddAndDelete 13840.614882872222 ms/op 14210.490652253462 ms/op 0.97
org.janusgraph.GraphCentricQueryBenchmark.getVertices 1629.618671963441 ms/op 1614.7703067868752 ms/op 1.01
org.janusgraph.MgmtOlapJobBenchmark.runReindex 360.9549205033333 ms/op 348.8847743432692 ms/op 1.03
org.janusgraph.JanusGraphSpeedBenchmark.basicCount 303.4707297943842 ms/op 309.59681476645744 ms/op 0.98
org.janusgraph.CQLMultiQueryBenchmark.getNeighborNames 42130.77351274 ms/op 36299.238607600004 ms/op 1.16
org.janusgraph.CQLMultiQueryBenchmark.getNames 42675.22684624 ms/op 36834.29389678999 ms/op 1.16

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.