File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
This example has a few mechanisms to prevent your GraphQL server from dealing with expensive queries sent by abusive clients
4
4
(or maybe legitimate clients that running expensive queries unaware of the negative impacts they might cause).
5
+ Also, it has a couple of timeout strategies that, although won't help ease the burden on the server (since the expensive
6
+ operations are already under way), will provide a better experience to the consumer that won't have to wait forever for
7
+ their requests to return.
5
8
6
9
Here we introduce 4 mechanisms to help with that task. 3 of them are based on GraphQL Java instrumentation capabilities,
7
10
and the forth one is a bit out GraphQL Java jurisdiction and more related to web servers.
@@ -11,6 +14,9 @@ and the forth one is a bit out GraphQL Java jurisdiction and more related to web
11
14
3 . A custom Instrumentation that sets a timeout period of 3 seconds for DataFetchers
12
15
4 . A hard request timeout of 10 seconds, specified in the web server level (Spring)
13
16
17
+ The first 2 items will actually prevent server overload, since they act before the request reach the DataFetchers, which
18
+ perform the expensive operations. Number 3 and 4 are timeouts that force long running executions to return early to customers.
19
+
14
20
# The schema
15
21
The schema we're using is quite simple:
16
22
You can’t perform that action at this time.
0 commit comments