Skip to content

Reduce TLS write-path overhead#13202

Open
zwoop wants to merge 1 commit into
apache:masterfrom
zwoop:TLSPerf
Open

Reduce TLS write-path overhead#13202
zwoop wants to merge 1 commit into
apache:masterfrom
zwoop:TLSPerf

Conversation

@zwoop
Copy link
Copy Markdown
Contributor

@zwoop zwoop commented May 26, 2026

Insert a buffer BIO on the write side so multiple TLS records accumulate without syscalls, flushed once after the write loop. This reduces write() calls from one-per-record to one-per-flush, directly addressing the ~15% of CPU spent in write() syscalls. TCP_CORK/NOPUSH wraps the write loop as a secondary optimization for TCP segment batching. Consolidate SSL ex_data from 9 slots to 1 struct pointer, skip handshake buffer allocation when blind-tunnel is not configured, fix sslTotalBytesSent to update inside the write loop for correct dynamic record sizing ramp, batch metric counter increments to reduce cross-thread cache-line contention, and use the cached NetHandler timestamp instead of calling ink_get_hrtime per write event.

Insert a buffer BIO on the write side so multiple TLS records
accumulate without syscalls, flushed once after the write loop.
This reduces write() calls from one-per-record to one-per-flush,
directly addressing the ~15% of CPU spent in write() syscalls.
TCP_CORK/NOPUSH wraps the write loop as a secondary optimization
for TCP segment batching. Consolidate SSL ex_data from 9 slots to
1 struct pointer, skip handshake buffer allocation when blind-tunnel
is not configured, fix sslTotalBytesSent to update inside the write
loop for correct dynamic record sizing ramp, batch metric counter
increments to reduce cross-thread cache-line contention, and use
the cached NetHandler timestamp instead of calling ink_get_hrtime
per write event.
@zwoop zwoop added this to the 11.0.0 milestone May 26, 2026
@zwoop zwoop self-assigned this May 26, 2026
Copilot AI review requested due to automatic review settings May 26, 2026 19:47
@zwoop zwoop added the TLS label May 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants