-
Notifications
You must be signed in to change notification settings - Fork 318
docs: clarify timeout hierarchy in traffic shaping documentation #8203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Clarify timeout hierarchy for traffic shaping ([PR #8203](https://github.com/apollographql/router/pull/8203)) | ||
|
||
The documentation reflects more clearly that subgraph timeouts should not be higher than the router timeout or the router timeout will initiate prior to the subgraph. | ||
|
||
By [@abernix](https://github.com/abernix) in https://github.com/apollographql/router/pull/8203 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,23 @@ | |
timeout: 50s # If subgraph requests take more than 50 seconds, cancel the request (30 seconds by default) | ||
``` | ||
|
||
When configuring timeouts, you should set your router timeout to be greater than or equal to your subgraph timeouts. This allows the router to properly handle subgraph timeouts and return appropriate error responses to clients. Ideally, subgraph timeouts should be slightly lower than the router timeout to provide a buffer for the router to process the timeout response. | ||
Check warning on line 83 in docs/source/routing/performance/traffic-shaping.mdx
|
||
|
||
For example, a well-configured timeout hierarchy might look like: | ||
|
||
```yaml title="router.yaml" | ||
traffic_shaping: | ||
router: | ||
timeout: 60s # Router: 60 seconds | ||
all: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we say "Default for all subgraphs except the ones below" in the comment? The field name "all" is the one that confused me in the first place. |
||
timeout: 30s # Default subgraph: 30 seconds (lower than router) | ||
subgraphs: | ||
products: | ||
timeout: 45s # Products subgraph: 45 seconds (still lower than router) | ||
inventory: | ||
timeout: 20s # Inventory subgraph: 20 seconds | ||
``` | ||
|
||
<Note> | ||
|
||
Since [deferred](/router/executing-operations/defer-support/#what-is-defer) fragments are separate requests, each fragment's request is individually subject to timeouts. | ||
|
Uh oh!
There was an error while loading. Please reload this page.