Skip to content

Commit 52a42ec

Browse files
committed
improved detection and monitoring
1 parent 2db7858 commit 52a42ec

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

core/http/client/src/main/java/org/eclipse/rdf4j/http/client/QueryCircuitBreaker.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ private QueryPressureState refreshState(String reason, Configuration configurati
254254
LOGGER.info(
255255
"Query circuit breaker transition previous={} current={} freeMb={} rollingGcMs={} reason={}",
256256
previous, next, snapshot.getFreeMemoryMb(), snapshot.getRollingGcMs(), reason);
257-
if (currentState == QueryPressureState.HIGH || (currentState == QueryPressureState.WARN && determineFreeMemoryState(configuration, snapshot.getFreeMemoryMb()) == QueryPressureState.WARN)) {
257+
if (currentState == QueryPressureState.HIGH
258+
|| (currentState == QueryPressureState.WARN && determineFreeMemoryState(configuration,
259+
snapshot.getFreeMemoryMb()) == QueryPressureState.WARN)) {
258260
System.gc();
259261
}
260262
}
@@ -678,7 +680,7 @@ static Configuration fromSystemProperties() {
678680
getIntProperty(HIGH_FREE_MB_PROPERTY, 128),
679681
getIntProperty(CRITICAL_FREE_MB_PROPERTY, 96),
680682
getIntProperty(WARN_ADMISSION_DELAY_MS_PROPERTY, 50),
681-
getIntProperty(CHECKPOINT_DELAY_MS_PROPERTY, 10),
683+
getIntProperty(CHECKPOINT_DELAY_MS_PROPERTY, 1),
682684
getIntProperty(CANCEL_COOLDOWN_MS_PROPERTY, 1000),
683685
getIntProperty(RETRY_AFTER_SECONDS_PROPERTY, 3));
684686
}

core/http/client/src/main/java/org/eclipse/rdf4j/http/client/QueryExecutionContext.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public final class QueryExecutionContext {
2727
private static boolean heavyOperatorExecutionEnabled = true;
2828
private static int checkpointCalls;
2929

30-
31-
3230
private QueryExecutionContext() {
3331
}
3432

@@ -65,7 +63,8 @@ public static void markHeavy(String operator) {
6563
}
6664

6765
public static void checkpoint(String operator) throws QueryInterruptedException {
68-
if(!shouldCheckpoint()) return;
66+
if (!shouldCheckpoint())
67+
return;
6968
State state = CURRENT.get();
7069
if (state != null) {
7170
QueryCircuitBreaker.getInstance().checkpoint(state.handle, operator);
@@ -96,7 +95,8 @@ public interface Activation extends AutoCloseable {
9695
}
9796

9897
private static boolean shouldCheckpoint() {
99-
if(ignoreCheckpointStride) return true;
98+
if (ignoreCheckpointStride)
99+
return true;
100100
return ((++checkpointCalls) & CHECKPOINT_MASK) == 0;
101101
}
102102

@@ -109,6 +109,5 @@ private State(QueryCircuitBreakerHandle handle, State previous) {
109109
this.previous = previous;
110110
}
111111

112-
113112
}
114113
}

0 commit comments

Comments
 (0)