Closed Bug 1954724 Opened 11 months ago Closed 11 months ago

Pathological SSLBuffer Performance

Categories

(NSS :: Libraries, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: djackson, Assigned: djackson)

Details

Attachments

(1 file)

sslBuffers are widely used in libssl. These buffers are dynamically resizable with sslBuffer_Grow which can be invoked explicitly, or via calls to functions like sslBuffer_Append, sslBuffer_AppendNumber, sslBuffer_AppendVariable which always invoke sslBuffer_Grow. Unfortunately, every sslBuffer_Grow invocation grows the buffer by at least 1024 bytes via realloc, even if the buffer already had the requested space available.

In a benchmark of 1000 connections using an optimized build of tstclnt, we spend ~600ms inside realloc out of 14 CPU seconds total. Heaptrack shows ~102 reallocs per handshake from sslBuffer_Grow, which is roughly 20% of the total allocations made during a handshake.

Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: