Skip to content

Add configurable server header read timeout#7262

Merged
gwardwell merged 8 commits intodevfrom
gwardwell/add-headers-timeout-config
Apr 17, 2025
Merged

Add configurable server header read timeout#7262
gwardwell merged 8 commits intodevfrom
gwardwell/add-headers-timeout-config

Conversation

@gwardwell
Copy link
Contributor

@gwardwell gwardwell commented Apr 14, 2025

This change exposes the server's header read timeout as the server.http.header_read_timeout configuration option.

By default, the server.http.header_read_timeout is set to previously hard-coded 10 seconds. A longer timeout can be configured using the server.http.header_read_timeout option.

server:
  http:
    header_read_timeout: 30s

Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Tests added and passing3
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

@gwardwell gwardwell requested a review from a team April 14, 2025 20:54
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Apr 14, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/(latest)/configuration.mdx

Build ID: b2627a81ee8c875f8d033c6c

URL: https://www.apollographql.com/docs/deploy-preview/b2627a81ee8c875f8d033c6c

@github-actions

This comment has been minimized.

@router-perf
Copy link

router-perf bot commented Apr 14, 2025

CI performance tests

  • connectors-const - Connectors stress test that runs with a constant number of users
  • const - Basic stress test that runs with a constant number of users
  • demand-control-instrumented - A copy of the step test, but with demand control monitoring and metrics enabled
  • demand-control-uninstrumented - A copy of the step test, but with demand control monitoring enabled
  • enhanced-signature - Enhanced signature enabled
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
  • events_big_cap_high_rate_callback - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity using callback mode
  • events_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
  • extended-reference-mode - Extended reference mode enabled
  • large-request - Stress test with a 1 MB request payload
  • no-tracing - Basic stress test, no tracing
  • reload - Reload test over a long period of time at a constant rate of users
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • step-local-metrics - Field stats that are generated from the router rather than FTV1
  • step-with-prometheus - A copy of the step test with the Prometheus metrics exporter enabled
  • step - Basic stress test that steps up the number of users over time
  • xlarge-request - Stress test with 10 MB request payload
  • xxlarge-request - Stress test with 100 MB request payload

@gwardwell gwardwell force-pushed the gwardwell/add-headers-timeout-config branch 2 times, most recently from 3a0f10b to c41fdbd Compare April 14, 2025 21:17
Copy link
Member

@glasser glasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave full review up to Router experts, but this looks reasonable from a high level, modulo lint/changelog/docs/etc.

I think we should do better than Hyper and actually define the term "header read timeout" in our docs. Our understanding is that this a timeout applied to any incoming connection when it is in any state other than "request headers have been read", setting an amount of time for headers to be read; it applies both when the connection is fully idle and when a request has been started but the headers have not been completed.

@gwardwell gwardwell force-pushed the gwardwell/add-headers-timeout-config branch 5 times, most recently from 7f1fbd2 to 48c6473 Compare April 15, 2025 12:41
Copy link
Member

@goto-bus-stop goto-bus-stop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to put this in the existing supergraph configuration rather than introducing a new server group. supergraph.listen, supergraph.connection_shutdown_timeout, supergraph.early_cancel and supergraph.experimental_log_on_broken_pipe are on a similar "level" as header_read_timeout. I don't feel that strongly though, maybe @BrynCooke has some input around that.

The implementation looks good to me, but it does require a changeset and documentation (at least in docs/source/routing/configuration.mdx).

@gwardwell
Copy link
Contributor Author

@goto-bus-stop I discussed where to put it with @BrynCooke and we landed on server.http.header_read_timeout, but I'm good with changing it to supergraph.header_read_timeout if your team would prefer. I'm definitely not opinionated about config location.

I'll definitely add a changeset and documentation. I just wanted to land on code-complete (in case of changes like we're discussing) before I did.

@goto-bus-stop
Copy link
Member

If it's already been discussed then I don't mind keeping it as it is :)

@BrynCooke
Copy link
Contributor

@goto-bus-stop We need to start moving stuff out of the supergraph section, it's a dumping ground at the moment.
I think we should take a stand and start putting stuff where it should be and then move the existing config items.

@gwardwell gwardwell requested a review from a team as a code owner April 17, 2025 12:51
@gwardwell gwardwell force-pushed the gwardwell/add-headers-timeout-config branch from 2cac368 to 54ae7c5 Compare April 17, 2025 12:52
@gwardwell gwardwell changed the title Add headers timeout config Expose Headers Read Timeout as a configurable value Apr 17, 2025
@gwardwell gwardwell changed the title Expose Headers Read Timeout as a configurable value Expose the server header read timeout as a configurable value Apr 17, 2025
@gwardwell gwardwell force-pushed the gwardwell/add-headers-timeout-config branch 2 times, most recently from 7ccb988 to fd6480b Compare April 17, 2025 13:04
@gwardwell gwardwell changed the title Expose the server header read timeout as a configurable value Add configurable server header read timeout Apr 17, 2025
@gwardwell gwardwell force-pushed the gwardwell/add-headers-timeout-config branch from fb8295b to 8e22896 Compare April 17, 2025 13:14
@gwardwell gwardwell requested a review from goto-bus-stop April 17, 2025 13:14
@gwardwell gwardwell requested a review from goto-bus-stop April 17, 2025 13:20
@gwardwell gwardwell merged commit ea0eb91 into dev Apr 17, 2025
15 checks passed
@gwardwell gwardwell deleted the gwardwell/add-headers-timeout-config branch April 17, 2025 14:39
@gwardwell gwardwell added the backport-1.x Backport this PR to 1.x label Apr 28, 2025
@abernix abernix mentioned this pull request Apr 29, 2025
@abernix abernix mentioned this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-1.x Backport this PR to 1.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants