Skip to content

http3: a request allocates about 1.7 KB of objects that could be reused per connection, 1 KiB of it a new arena #488

Closed

Description

@MDA2AV

Each buffered request in ioxide.http3, the managed HTTP/3, allocates about 1.85 KB:

Measured on main eb5f515 (paths under src/protocols/ioxide.http3/ unless named):

  • App: Playground/Http3/ManagedBuffered, path /.
  • Setup: 1 reactor pinned to one core, and h2load --alpn-list=h3 -c 32 -m 16 -t 1 pinned to another physical core: 616K req/s.
  • Method: a 10 s dotnet-trace --profile gc-verbose window, allocations grouped by type and first ioxide frame.
Allocated B per request Where
Request arena byte[1024] 1,053 Http3Request.Append (Http3Request.cs:76): Array.Resize from empty on the first field, through Qpack.TryDecodeFieldSection
Http3Request 190 ReqStream.Request (Http3Connection.cs:77)
Header array (ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)[] 153 Http3Request.Freeze (Http3Request.cs:94)
Field-range array (int, int, int, int)[] 89 Http3Request.AddField (Http3Request.cs:55)
ReqStream 74 Http3Connection.cs:297
ReqStream.Carry, a byte[16] 41 Http3Connection.cs:81
The request's two Lists 32 + 30 Http3Request.cs:20 and :34
OutStream, its Queue and the queue's array 55 + 39 + 89 QuicEngineConnection.SendStream, see #487

The streamed sample (Playground/Http3/ManagedStreamedBoth, 8 chunks of 1 KiB) allocates 2.78 KB per request:

Its flushes allocate nothing measurable. They wait only when the QUIC send queue is full, and this load never fills it.

Possible fix: the one #486 applies to ioxide.http2.

In ioxide.http2, the same change took a request from 793 B to 89 B, and server CPU per request down by 17%. An HTTP/3 request costs more CPU (QUIC crypto and packets), so the share here needs measuring.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions