Skip to content

proxy: request quickack before frontend reads#1091

Draft
baiyuqing wants to merge 4 commits intoserverlessfrom
feature/frontend-quickack-default
Draft

proxy: request quickack before frontend reads#1091
baiyuqing wants to merge 4 commits intoserverlessfrom
feature/frontend-quickack-default

Conversation

@baiyuqing
Copy link
Collaborator

@baiyuqing baiyuqing commented Mar 9, 2026

What problem does this PR solve?

Issue Number: N/A

Problem Summary:

In the serverless gateway path, the frontend socket can occasionally delay pure ACKs long enough for clients to hit the Linux ~200ms retransmission window. That shows up as sporadic max-latency spikes even when TiDB itself is stable.

What is changed and how it works:

  • Add a frontend-only PacketIO option to request TCP_QUICKACK
  • Enable that option for client-facing connections by default
  • Request quickack before each frontend ReadPacket() so the socket re-enters quickack mode after the kernel leaves it
  • Keep the behavior Linux-only; non-Linux builds are a no-op
  • Leave backend connection behavior unchanged

This keeps the change narrowly scoped to the client -> TiProxy side where delayed ACKs were suspected to amplify tail latency.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Test details:

  • go test ./pkg/proxy/net ./pkg/proxy/client ./pkg/proxy
  • Downstream verification in aws-shared-provider: GOSUMDB=off go test ./pkg/gateway/... ./cmd/tidb-gateway/...

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change
  • Has tiproxyctl change
  • Other user behavior changes

Release note

Reduce frontend tail latency spikes by requesting TCP_QUICKACK before reading client packets.

@ti-chi-bot ti-chi-bot bot requested a review from bb7133 March 9, 2026 09:38
@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 9, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign xhebox for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot requested a review from xhebox March 9, 2026 09:38
@baiyuqing baiyuqing marked this pull request as draft March 9, 2026 09:38
@ti-chi-bot ti-chi-bot bot added size/L and removed size/M labels Mar 9, 2026
@ti-chi-bot ti-chi-bot bot added size/XL and removed size/L labels Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant