File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,10 @@ those.
120
120
- ` GRAPH_LOAD_THRESHOLD ` : If wait times for getting database connections go
121
121
above this threshold, throttle queries until the wait times fall below
122
122
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.
124
124
- ` GRAPH_LOAD_JAIL_THRESHOLD ` : When the system is overloaded, any query
125
125
that causes more than this fraction of the effort will be rejected for as
126
126
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.
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ lazy_static! {
28
28
Duration :: from_millis( threshold)
29
29
} ;
30
30
31
+ static ref JAIL_QUERIES : bool = env:: var( "GRAPH_LOAD_JAIL_THRESHOLD" ) . is_ok( ) ;
32
+
31
33
static ref JAIL_THRESHOLD : f64 = {
32
34
env:: var( "GRAPH_LOAD_JAIL_THRESHOLD" )
33
35
. ok( )
@@ -36,7 +38,7 @@ lazy_static! {
36
38
panic!( "GRAPH_LOAD_JAIL_THRESHOLD must be a number, but is `{}`" , s)
37
39
} )
38
40
} )
39
- . unwrap_or( 0.1 )
41
+ . unwrap_or( 1e9 )
40
42
} ;
41
43
42
44
static ref WAIT_STAT_CHECK_INTERVAL : Duration = Duration :: from_secs( 1 ) ;
@@ -322,7 +324,7 @@ impl LoadManager {
322
324
let query_effort = query_effort. unwrap_or_else ( || total_effort) . as_millis ( ) as f64 ;
323
325
let total_effort = total_effort. as_millis ( ) as f64 ;
324
326
325
- if known_query && query_effort / total_effort > * JAIL_THRESHOLD {
327
+ if known_query && * JAIL_QUERIES && query_effort / total_effort > * JAIL_THRESHOLD {
326
328
// Any single query that causes at least JAIL_THRESHOLD of the
327
329
// effort in an overload situation gets killed
328
330
warn ! ( self . logger, "Jailing query" ;
You can’t perform that action at this time.
0 commit comments