Skip to content

Commit 8943669

Browse files
committed
graph: Turn jailing of queries off by default
1 parent a892a66 commit 8943669

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/environment-variables.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ those.
120120
- `GRAPH_LOAD_THRESHOLD`: If wait times for getting database connections go
121121
above this threshold, throttle queries until the wait times fall below
122122
the threshold. Value is in milliseconds, and defaults to 0 which
123-
turns throttling off and any associated statistics collection off.
123+
turns throttling and any associated statistics collection off.
124124
- `GRAPH_LOAD_JAIL_THRESHOLD`: When the system is overloaded, any query
125125
that causes more than this fraction of the effort will be rejected for as
126126
long as the process is running (i.e., even after the overload situation
127-
is resolved) Defaults to 0.1
127+
is resolved) If this variable is not set, no queries will ever be jailed,
128+
but they will still be subject to normal load management when the system
129+
is overloaded.

graph/src/data/graphql/effort.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ lazy_static! {
2828
Duration::from_millis(threshold)
2929
};
3030

31+
static ref JAIL_QUERIES: bool = env::var("GRAPH_LOAD_JAIL_THRESHOLD").is_ok();
32+
3133
static ref JAIL_THRESHOLD: f64 = {
3234
env::var("GRAPH_LOAD_JAIL_THRESHOLD")
3335
.ok()
@@ -36,7 +38,7 @@ lazy_static! {
3638
panic!("GRAPH_LOAD_JAIL_THRESHOLD must be a number, but is `{}`", s)
3739
})
3840
})
39-
.unwrap_or(0.1)
41+
.unwrap_or(1e9)
4042
};
4143

4244
static ref WAIT_STAT_CHECK_INTERVAL: Duration = Duration::from_secs(1);
@@ -322,7 +324,7 @@ impl LoadManager {
322324
let query_effort = query_effort.unwrap_or_else(|| total_effort).as_millis() as f64;
323325
let total_effort = total_effort.as_millis() as f64;
324326

325-
if known_query && query_effort / total_effort > *JAIL_THRESHOLD {
327+
if known_query && *JAIL_QUERIES && query_effort / total_effort > *JAIL_THRESHOLD {
326328
// Any single query that causes at least JAIL_THRESHOLD of the
327329
// effort in an overload situation gets killed
328330
warn!(self.logger, "Jailing query";

0 commit comments

Comments
 (0)