Skip to content

fix(router): make HTTP pool idle timeout configurable#24329

Merged
Kangyan-Zhou merged 2 commits into
sgl-project:mainfrom
revanthreddy-hai:fix/smg-pool-idle-timeout-config
May 7, 2026
Merged

fix(router): make HTTP pool idle timeout configurable#24329
Kangyan-Zhou merged 2 commits into
sgl-project:mainfrom
revanthreddy-hai:fix/smg-pool-idle-timeout-config

Conversation

@revanthreddy-hai
Copy link
Copy Markdown
Contributor

Make SGLang Model Gateway's upstream HTTP connection pool idle timeout configurable while preserving the existing 50s default.

This gives operators a way to align SMG's upstream connection pool behavior with the keep-alive / idle-timeout settings used by their deployment, such as sglang workers, ingress-nginx, Envoy/Istio/K-gateway, ALB, or other gateways.

Changes:

  • Add `--pool-idle-timeout-secs`
  • Add `SMG_POOL_IDLE_TIMEOUT_SECS`
  • Thread the value through `RouterConfig` into the reqwest client builder
  • Keep config deserialization backward-compatible when the field is omitted
  • Document the new option

Tests

  • Added test coverage for the `RouterConfig` deserialization default
  • `git diff --check`"

@github-actions github-actions Bot added documentation Improvements or additions to documentation model-gateway labels May 4, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a configurable idle timeout for the upstream HTTP connection pool, defaulting to 50 seconds. Changes include adding the --pool-idle-timeout-secs CLI argument (and corresponding environment variable), updating the RouterConfig and AppContext to handle this new parameter, and providing documentation in the README and feature guides. The review feedback suggests defining a shared constant for the default timeout value to avoid magic numbers and ensure consistency between the configuration defaults and the CLI argument definition.

Comment thread sgl-model-gateway/src/config/types.rs Outdated
Comment thread sgl-model-gateway/src/main.rs Outdated
Signed-off-by: Revanth Reddy Airre <revanthreddy@hippocraticai.com>
@Kangyan-Zhou
Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@Kangyan-Zhou Kangyan-Zhou merged commit d363315 into sgl-project:main May 7, 2026
55 checks passed
LLThomas pushed a commit to LLThomas/sglang that referenced this pull request May 8, 2026
)

Signed-off-by: Revanth Reddy Airre <revanthreddy@hippocraticai.com>
LucQueen pushed a commit to LucQueen/sglang that referenced this pull request May 12, 2026
)

Signed-off-by: Revanth Reddy Airre <revanthreddy@hippocraticai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation model-gateway run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants