Skip to content

[DESIGN] HTTP transport requirements and options - #4458

Open
thc1006 wants to merge 16 commits into
open-telemetry:mainfrom
thc1006:design/http-transport-4448
Open

thc1006 wants to merge 16 commits into
open-telemetry:mainfrom
thc1006:design/http-transport-4448

Conversation

@thc1006

@thc1006 thc1006 commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

This PR follows #4448 and asks where concurrency belongs in the HTTP export path. lalitb suggested this requirements and options document there, to be reviewed as a pull request before an implementation direction is chosen. It compares the current session/callback model, a backend-neutral request/result interface with concurrency managed above it, and a single-owner curl multi loop if the transport needs to manage concurrency. The curl loop could also implement the request/result interface.

The comparison covers throughput and connection reuse, cancellation and shutdown, admission and retries, and compatibility with installed interfaces and custom clients. Which requirements must the transport itself satisfy, and what evidence would let us choose among these approaches? The section "A recommendation" is my proposal for review, and the checklist under "What this needs decided" lists the questions for maintainers.

@thc1006
thc1006 force-pushed the design/http-transport-4448 branch from 5207f9e to d837491 Compare August 23, 2026 23:29
@codecov

codecov Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.70%. Comparing base (da57137) to head (74b1e29).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4458      +/-   ##
==========================================
+ Coverage   86.70%   86.70%   +0.01%     
==========================================
  Files         530      530              
  Lines       21204    21206       +2     
==========================================
+ Hits        18382    18384       +2     
  Misses       2822     2822              

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thc1006
thc1006 marked this pull request as ready for review August 27, 2026 16:35
@thc1006
thc1006 requested a review from a team as a code owner August 27, 2026 16:35
@thc1006
thc1006 force-pushed the design/http-transport-4448 branch from 0fea657 to 16db2fc Compare September 8, 2026 05:27
Written for the question in open-telemetry#4448: does the HTTP transport need to manage
asynchronous concurrency itself, or is a request and result model enough with
concurrency owned somewhere else.

Sets out what every in-tree consumer actually does, where the current model is
inconsistent with itself, and compares the three shapes named in the discussion:
the current Session and EventHandler model, an implementation neutral request
and result, and a single owner CURLM event loop for the case where transport
level concurrency is wanted.

It deliberately does not decide whether HttpOperation should exist, whether a
Session carries one request, or which layer owns retry. Those are listed as
decisions instead, together with the CMake and Bazel surfaces that disagree
about the concrete curl headers today.

The evidence is the invariant matrix already posted in open-telemetry#4448, linked rather than
repeated, so this stays short enough to read in one sitting.

Signed-off-by: thc1006 <[email protected]>
…ocument

The first draft turned on one fact, that every default consumer blocks, and read
as an argument for dropping the asynchronous machinery. @owent supplied the
other half on open-telemetry#4448: a high volume logging workload with roughly 100 ms of
network latency and batches past 4 MB, where a collector that was not saturated
still dropped data until about four requests were allowed in flight.

That does not contradict the first fact but it does change what follows from it.
Concurrency is a capability the transport has to have; what the blocking callers
want is not to pay for it. So the document now asks for a contract where it is
available, bounded and configurable rather than for one that picks a side, and
option B is an asynchronous one attempt operation with blocking as an adapter
over it, not a blocking call.

Also corrected: the specification's wording differs by transport, and this
document is about HTTP. Concurrent unary calls are a SHOULD for gRPC. For HTTP
the text is that a client MAY use several parallel connections, with the maximum
SHOULD be configurable.

Adds the benchmark matrix the concurrency question needs, because the only OTLP
HTTP benchmark in the tree runs against localhost with a 1 ms timeout, and
records the open question that the option defaults to 64 requests in flight
while the one reported workload needed about four.

Signed-off-by: thc1006 <[email protected]>
…ution holds

@owent's second reply on open-telemetry#4448 says the two options were written around curl and
that a replacement is not bound by them. Reading them says what a replacement
would have to keep, and it is less than the names suggest.

max_concurrent_requests is a watermark applied after the request has been built
and handed to the client, not an admission limit. max_requests_per_connection
counts nothing per connection: every Nth session by global id sets
CURLOPT_FRESH_CONNECT and CURLOPT_FORBID_REUSE, which is a rotation rather than
a quota. Neither shapes what is on the wire, because the client sets none of
CURLMOPT_MAX_HOST_CONNECTIONS, CURLMOPT_MAX_TOTAL_CONNECTIONS,
CURLMOPT_MAX_CONCURRENT_STREAMS, CURLMOPT_PIPELINING or CURLOPT_HTTP_VERSION.

The same reply says requests added to one CURLM without disabling reuse can look
concurrent while running serially. That holds on one connection that cannot
multiplex, which is the HTTP/1.1 case, and not on several connections or on
HTTP/2 and HTTP/3 streams. The document now says which, because it decides how
many numbers the replacement needs rather than one.

Also adds a byte budget and a separate export operation and attempt identity to
the decision list, and makes the benchmark name its rate units and read back the
negotiated protocol and connection count rather than trusting the option values.

Signed-off-by: thc1006 <[email protected]>
The comparison table said option C keeps retry and concurrency inside the
backend while the recommendation put a scheduler above the transport owning
exactly those. One row cannot answer for both, so it is now two: admission and
retry above, connection and stream scheduling below.

max_concurrent_requests currently stands for a record rate, an attempt count and
a connection count depending on who is reading it, so the document now names
those apart before comparing anything. The reported workload is a record rate;
"about four" is an attempt count.

The byte bound, the separation of export operations from attempts, and
exactly-once settlement move out of the open questions and into requirements,
since no answer to the remaining questions makes them optional.

The decision list splits into what open-telemetry#4448 has settled and what is still open, so
a reviewer can object to one line rather than re-read the thread.

Signed-off-by: thc1006 <[email protected]>
18231989 settles two things the open list still asked. The existing options are
legacy curl compatibility controls rather than requirements of a replacement, and
a bounded governor needs both a count and a retained-byte dimension rather than
either alone. It also states a preference for one shared CURLM while leaving the
sharing scope to the benchmark.

18233325 settles a third. Session::SendRequest was never meant to be called more
than once, which is the contract the use after free measured on main violates, so
the document states it instead of asking it.

What sharing a multi handle costs now has its own section: a reference counted
runtime under separate logical clients rather than a global HttpClient, a
hierarchical budget because one per-client limit stops bounding the process once
three exporters share it, a fairness requirement, and a failure domain, since
libcurl leaves every transfer on a multi handle undefined when socket_action
fails. The benchmark grows the cases that measure isolation rather than speed.

Signed-off-by: thc1006 <[email protected]>
The vocabulary table already named an export operation and an attempt as
different things without saying that they move through different states.
They do, and today they share one set of fields, which is where several of
the reports come from: a retried operation gets a second attempt with its
own deadline, handle and result, and if those live on the operation the
second overwrites the first. Each boundary in the attempt sequence is a
report already filed, from a rejected curl_multi_add_handle that never
runs to CURLOPT_PRIVATE naming a Session rather than the attempt whose
completion is arriving.

The second section names three accepted issues the rewrite does not fix,
so the scope is not read wider than it is. Processor batching decides the
request geometry the transport is handed, and open-telemetry#4498 measured 2,332 export
calls for 50,000 records with one batch at or above 2,048, so a benchmark
run before that is settled reports the processor. open-telemetry#4532 shows an untimed
join above the exporter, so a deadline honoured by every attempt still
does not bound Shutdown. open-telemetry#4534 is a throw crossing a noexcept callback,
which the completion contract has to answer for, including where there
are no exceptions to catch.

One word elsewhere: an export operation is accepted, not admitted, since
the table reserves admitted for attempts the governor has let start.

Signed-off-by: thc1006 <[email protected]>
@thc1006
thc1006 force-pushed the design/http-transport-4448 branch from 16db2fc to 76fb5e3 Compare September 8, 2026 07:33
The option is `OTELCPP_WITH_ASYNC_EXPORT_PREVIEW`. The old spelling still
works but is deprecated, and the document was citing it.

"The configuration almost everyone builds" was a claim about how many
people build what, which I cannot observe. What is checkable is that the
option is off by default, so the sentence now says the default
configuration and nothing more.

"Each boundary in the second sequence is a report" was not true of the
sequence I had just written. It has seven boundaries and four bullets
follow it, one of which is not a boundary at all. Four of the open
reports are about that sequence, so it says that instead.

Signed-off-by: thc1006 <[email protected]>
Seven passages promised more than the evidence carries.

Immutability was written as removing the borrowed request lifetime. It closes
the mutation half; a const view of freed storage still dangles, and open-telemetry#4433 has a
case for each.

Shutdown was "bounded by construction" for two of the three options. A single
owner reduces concurrent access and does not bound a wait, because the owner can
be inside a resolver or a callback with no deadline of its own.

The agreed list was headed "Settled, unless someone objects". Nothing here has
been reviewed yet, so it is my reading of the thread rather than a decision.

Two multi handles were written as unable to be waited on together. That is
curl_multi_poll; curl_multi_socket_action hands sockets and timers back, so one
event loop could drive several. It stays a benchmark question either way.

Retained bytes were charged to attempts. An operation in RetryWait has no
attempt running and still holds its serialized body, so the bound belongs to the
operation, and 256 MB is the bodies rather than the exporter.

Exactly one settlement did not say that a reported failure is also a settlement,
which is not the backend having accepted the data.

The benchmark was gated on batching as a whole. Only the end to end half depends
on it; a transport run with a fixed payload and arrival rate can go first.

The eighth item raised, that the document over-reads the ABI policy, is not in
it: the document makes no ABI claim, so nothing changed for that one.

Signed-off-by: thc1006 <[email protected]>
@thc1006

thc1006 commented Sep 22, 2026 •

Copy link
Copy Markdown
Member Author

Pushed a correction pass. Nothing new was added; seven passages promised more than the evidence carries, and this takes those back.

  • Immutability was written as removing the borrowed request lifetime. It closes the mutation half only. A const view of freed storage still dangles, so the operation has to own the bytes until the backend is done with them. [BUG] HttpOperation holds references to constructor arguments that its own default arguments do not outlive #4433 has a case for each: its body is the lifetime half, a member reference bound to a constructor temporary, and a comment on it reports the mutation half, ThreadSanitizer on the write in Request::SetBody against the read of the same vector in the read callback. The document now says which evidence each half has, since that second one has no reproduction published with it.
  • Shutdown was "bounded by construction" for two of the three options. A single owner reduces concurrent access; it does not bound a wait, because the owner can be inside a resolver or a callback that has no deadline of its own.
  • The agreed list was headed "Settled, unless someone objects". This document has had no review, so it is my reading of the thread and is labelled that way now.
  • Two multi handles were written as unable to be waited on together. That is curl_multi_poll. curl_multi_socket_action reports readiness through CURLMOPT_SOCKETFUNCTION and CURLMOPT_TIMERFUNCTION instead, which leaves the waiting to the caller. The documentation does not say whether one loop can drive several multi handles, so the document calls that an inference to test rather than a fact.
  • Retained bytes were charged to attempts. An operation in RetryWait has no attempt running and still holds its serialized body, so the bound belongs to the operation. The 256 MB figure is the bodies, not the exporter.
  • Exactly one settlement did not say that a reported failure is also a settlement, which is not the backend having accepted the data.
  • The benchmark was gated on batching as a whole. Only the end to end half depends on it.

One item raised against the document is not in it. It makes no ABI claim, so there was nothing to correct there, and #4625 is where the exposed surface question actually lives.

markdownlint is clean and the comparison table is intact; I split it by accident while editing and caught it in the diff.

Edited. One item in this list was wrong in the other direction. I had taken the request mutation half of #4433 out of the document after a search for it came back empty, and the report is there, in a comment on the issue, measured with ThreadSanitizer rather than reasoned. 8b18cd09 puts it back, and the first bullet says what evidence each half carries.

open-telemetry#4433 was cited as having a case for both halves of the lifetime problem. It has
one: a member reference bound to a constructor temporary, which is the ownership
half. No open report covers mutating a request after submission, so the document
should not point at one.

The curl_multi_socket_action sentence asserted that one event loop could drive
several multi handles. The documentation describes the socket and timer
callbacks and says nothing about that, so it is written as an inference to test.

Signed-off-by: thc1006 <[email protected]>
An earlier edit removed it on the strength of a grep that returned zero. The
grep was wrong. A comment on open-telemetry#4433 reports ThreadSanitizer on the write in
Request::SetBody against the read of the same vector in the read callback, so
the issue carries both halves of the lifetime problem rather than one. The
document now names each half and says what evidence each has, since the
mutation report has no published reproduction attached to it.

Signed-off-by: thc1006 <[email protected]>
Two more places that claimed more than the evidence carries.

The memory bound was written against operations that have not settled, but
settling is not releasing. An operation that reaches its deadline reports an
outcome while the backend may still hold its body, so a quota returned at
settlement can be spent again while those bytes are still allocated. The bound
now follows the storage, and whatever waits to be reclaimed needs a bound of
its own.

The comparison also said a blocking interface cannot serve the reported
workload. A blocking one attempt contract behind a bounded worker pool, under
the same governor, reaches the same concurrency with one request and result
model. The case for submitting asynchronously is the thread cost and the
cancellation story, not that the other shape cannot get there.

Signed-off-by: thc1006 <[email protected]>
Checked against main at 489cd82:

open-telemetry#4403 closed 2026-10-02 by open-telemetry#4452. NextRetryTime() returns a stored
next_retry_time_point_ and only computes when it is unset, so the retry time is
no longer redrawn on every read.

open-telemetry#4425 closed 2026-09-10 by open-telemetry#4453. ReadError, WriteError and Destroyed are in
the terminal group in otlp_http_client.cc rather than in default.

open-telemetry#4396 closed 2026-09-24 by open-telemetry#4431. CURLOPT_PRIVATE still names the session, so
that half of the bullet stands; what closed was a session holding more than one
operation.

The criteria table claimed four open reports against Shutdown and the document
never named which four. It now names the two that are open and are about a
shutdown deadline reaching the transport.

Signed-off-by: thc1006 <[email protected]>
Two reports filed against the background loop in http_client_curl.cc today are
not instances of the five things that section lists. Those are about an
operation's identity, ownership, publication, completion and backend resources.
These are about the loop itself: who owns the thread, what it does when a
libcurl call refuses, and what becomes of a send that arrives while it is
winding down.

Signed-off-by: thc1006 <[email protected]>
open-telemetry#4449 and open-telemetry#4466 closed on 17 October 2026 and open-telemetry#4498 on 30 October. The
paragraph still said open-telemetry#4466 was open against open-telemetry#4449 and read as if the
transport benchmark were waiting on all three. It is not: the batching on
main today is what a benchmark would measure against.

The figures open-telemetry#4498 reported are kept, since they are what the paragraph is
for, and they are now attributed to the closed report rather than to an
open one.

Signed-off-by: thc1006 <[email protected]>
Add a decision summary at the top. Describe operation identity, the
callback reentrancy question and the admission row as they stand after
open-telemetry#4431, and state the workload's need for concurrency without ruling out a
bounded pool of blocking attempts. The batching changes are on main, so
the measurement section now asks each run to record its batching, and it
reports the transport-only loopback run on d642609.

Signed-off-by: thc1006 <[email protected]>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant