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 JanusGraph#3069

Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
  • Loading branch information
farodin91 committed Sep 19, 2022
1 parent 1f346c6 commit 968e0b7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
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
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
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 968e0b7

@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: 968e0b7 Previous: 00f2fed Ratio
org.janusgraph.MgmtOlapJobBenchmark.runRemoveIndex 114.18440202414142 ms/op 113.99796555636365 ms/op 1.00
org.janusgraph.JanusGraphSpeedBenchmark.basicAddAndDelete 14391.019074541451 ms/op 14127.08404175576 ms/op 1.02
org.janusgraph.GraphCentricQueryBenchmark.getVertices 1547.9890948378631 ms/op 1504.4969043682668 ms/op 1.03
org.janusgraph.MgmtOlapJobBenchmark.runReindex 348.4806117349359 ms/op 343.03597473115383 ms/op 1.02
org.janusgraph.JanusGraphSpeedBenchmark.basicCount 255.44461913963016 ms/op 267.75250772623696 ms/op 0.95
org.janusgraph.CQLMultiQueryBenchmark.getNeighborNames 35426.13429540001 ms/op 35644.15542384 ms/op 0.99
org.janusgraph.CQLMultiQueryBenchmark.getNames 35529.81305332667 ms/op 36384.22757156666 ms/op 0.98

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

Please sign in to comment.