@@ -284,20 +284,42 @@ interface kept working through an adapter rather than replaced. One owner thread
284284per ` CURLM ` . The two existing options treated as curl compatibility controls
285285rather than as requirements of the replacement.
286286
287+ Four more since, from @owent on #4448 . A ` Session ` is single use: ` SendRequest `
288+ was never meant to be called more than once, so the contract says so rather than
289+ leaving it implicit. A bounded governor needs both dimensions, a count and
290+ retained bytes, rather than either alone. For the curl backend the preferred
291+ default baseline is one shared ` CURLM ` , because a multi handle owns its
292+ connection, DNS and TLS caches and cannot be waited on together with another
293+ one. And the lifetime of everything a request needs should have a single owner,
294+ which is the direction that removes ` HttpOperation ` rather than guarding it.
295+
296+ The last two are preferences with evidence, not settled architecture. The
297+ sharing scope of the ` CURLM ` is a benchmark decision, and a process wide one
298+ couples fault isolation and shutdown ownership across exporters, which is the
299+ cost side of it.
300+
287301** Open.** These are the questions a design cannot avoid, and they are listed
288302rather than answered.
289303
290- - [ ] Is a ` Session ` single use, reusable after completion, or a legacy adapter?
291304- [ ] Does submitting a request snapshot it or take ownership of it?
292305- [ ] Is completion one terminal result, with progress separated out as optional
293306 diagnostics?
294307- [ ] On what thread do callbacks run, and which calls may a callback make?
308+ Not open in one direction: a handler that calls ` SendRequest ` on the
309+ session that dispatched the callback destroys the operation whose member
310+ function is running the dispatch. AddressSanitizer on ` main ` at
311+ ` 58ed80d9 ` , single threaded and on the first attempt. Whatever the answer
312+ is, it has to be enforceable where the call is made, because a ` Session `
313+ that owns its operation by ` unique_ptr ` and swaps it in place cannot
314+ refuse.
295315- [ ] Which layer owns retry, in-flight concurrency and ` Retry-After ` ?
296316- [ ] What should the default number of requests in flight be, given that the
297317 option says 64 today and the one reported workload needed about four?
298- - [ ] Is the budget a count of requests, a number of bytes retained, or both?
299- 64 requests at the 4 MB the reported workload was sending is 256 MB of
300- request payload before responses, retries or compression buffers.
318+ - [ ] What does the count count: export operations, HTTP attempts, attempts
319+ the governor has admitted, or transfers currently running?
320+ - [ ] At what point is capacity taken, and which allocations are charged to the
321+ byte budget: before serialization, after it, at submission, or when the
322+ backend accepts the attempt?
301323- [ ] Do an export operation and an HTTP attempt get separate identities, so
302324 that a retry is one operation and several attempts?
303325- [ ] Is a new contract introduced alongside the current one with an adapter, or
@@ -309,6 +331,44 @@ while Bazel's `//ext:headers` still globs everything under `ext/include`. The
309331two surfaces disagree today, and whichever direction is chosen has to say what
310332happens to a Bazel consumer that includes a concrete header.
311333
334+ ## What one shared ` CURLM ` implies
335+
336+ Sharing the multi handle is what buys connection reuse across exporters and one
337+ polling thread instead of one per client. It also makes four things shared that
338+ are per client today, so the baseline has to name them.
339+
340+ What is shared is a curl runtime, not the logical client. A process global
341+ ` HttpClient ` would share the session namespace, the cancellation scope,
342+ ` FinishAllSessions() ` , the shutdown state and the legacy compatibility settings,
343+ so one exporter's ` Shutdown() ` would reach into another's work. The shape that
344+ keeps both is a reference counted runtime, one owner thread and one ` CURLM ` ,
345+ underneath separate logical clients that each keep their own operation
346+ namespace, admission lane, deadlines, cancellation and flush watermark. The
347+ runtime is torn down when the last logical client releases it, not when the
348+ first one shuts down.
349+
350+ A shared budget then has to be hierarchical, because a per client limit alone
351+ stops bounding the process. Three exporters each allowed 64 attempts at 4 MB is
352+ 768 MB of request payload before responses, retries or compression buffers.
353+
354+ | level | bounds |
355+ | --- | --- |
356+ | per logical client | admitted operations, retained request bytes |
357+ | runtime wide | admitted attempts, retained bytes, pending operations, connections |
358+ | per origin | connections, streams per connection, negotiated protocol |
359+
360+ And it has to say something about fairness, or a log client at the reported 10
361+ to 20K records per second can hold the whole budget while traces and metrics
362+ starve. Which discipline is a later decision; that one client must not be able
363+ to starve another indefinitely is a requirement now.
364+
365+ Failure is shared too. libcurl documents that when ` curl_multi_socket_action `
366+ returns an error the state of every transfer on that multi handle is undefined,
367+ so one multi level failure reaches every exporter at once. The baseline has to
368+ say how the owner thread stops admitting, settles or reschedules what was
369+ attached, rebuilds, and resumes, without one client's shutdown killing
370+ another's.
371+
312372## What a replacement has to hold, whichever shape wins
313373
314374These are requirements rather than questions, because no answer to the open
@@ -378,6 +438,12 @@ Reported per run: acknowledged batches per second, dropped batches, p50 and p99
378438latency, resident memory, thread count, open descriptors, and whether
379439` ForceFlush ` and ` Shutdown ` returned the right answer within their deadlines.
380440
441+ Throughput alone cannot choose the sharing scope, because what sharing costs is
442+ isolation rather than speed. So the run also has to cover: one logical client
443+ shutting down while two keep working; one client exhausting its byte budget; a
444+ log client saturating alongside trace and metric traffic; a multi level failure
445+ and the rebuild after it; and retries still pending when that failure lands.
446+
381447Rates have to name their unit. The reported workload is "roughly 10 to 20K QPS"
382448of log volume, which is not the same number as HTTP requests per second, so the
383449run should report both, along with records and serialized bytes per request.
0 commit comments