Skip to content

Conversation

@ipochi
Copy link
Contributor

@ipochi ipochi commented Oct 29, 2025

Introduce a sync.Pool to reuse read buffers in the ServeHTTP handler for the http-connect mode.

Previously, a new 32KB buffer was allocated for every hijacked connection, causing high GC pressure in high-throughput scenarios. By pooling and reusing these buffers, we significantly reduce the number of memory allocations, which improves CPU usage and lowers request latency by decreasing the impact of garbage collection.

Introduce a `sync.Pool` to reuse read buffers in the `ServeHTTP` handler
for the http-connect mode.

Previously, a new 32KB buffer was allocated for every hijacked
connection, causing high GC pressure in high-throughput scenarios.  By
pooling and reusing these buffers, we significantly reduce the number of
memory allocations, which improves CPU usage and lowers request latency
by decreasing the impact of garbage collection.

Signed-off-by: Imran Pochi <[email protected]>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 29, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ipochi

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants