Skip to content

fix(backend): make the standard HTTP transport the default - #591

Merged
timtofan merged 1 commit into
masterfrom
atimofieiev/stock-backend-transport-gh
Nov 13, 2026
Merged

timtofan merged 1 commit into
masterfrom
atimofieiev/stock-backend-transport-gh

Conversation

@timtofan

@timtofan timtofan commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Why

What issue is this change attempting to solve?

An unset CARBONAPI_SYNC_BACKEND_HTTP currently enables the custom synchronous connection pool. Make Go's standard HTTP transport the default and require an explicit opt-in for the synchronous implementation. Operators can keep using =0 to select the standard transport across old and new binaries.

Architecture

How does this change solve the problem? Why is this the best approach?

InitBackends still constructs one shared HTTP client for the network backends. A small transport constructor preserves the configured idle pool, idle timeout, connect timeout and keepalive, and makes transport selection directly testable. Backend discovery, queues, request budgets and error handling keep their existing boundaries.

Only the exact value 1 wraps the configured Go transport in SyncTransport. Its HTTPS, proxy and non-GET fallback remains unchanged. The custom implementation is retained for explicit comparisons and diagnosis; this change adds no delta to that implementation. It can be removed once those comparisons no longer need the alternate path.

Before / after

Setting Before After
Unset or empty Synchronous transport Standard Go transport
0 Standard Go transport Standard Go transport
1 Synchronous transport Synchronous transport, explicitly selected
Other values Synchronous transport Standard Go transport
Pool and dial settings Configured per shared client Same configured values

Usage

Normal backend initialization now uses the standard transport without an override:

unset CARBONAPI_SYNC_BACKEND_HTTP

For an explicit synchronous-transport comparison, set CARBONAPI_SYNC_BACKEND_HTTP=1 before starting the process. Keep =0 when rolling back to an older binary if the standard transport should remain selected. Both runtime guides describe this behavior.

Validation

How can we be sure this works as expected?

  • Selection regression tests cover unset, empty, 0, 1, true, another number and whitespace. They were demonstrated to fail against the previous default before applying the behavior change.
  • Configured pool settings are checked, and real backend requests verify connection reuse and expiry with empty, 0 and 1 settings.
  • go test -race ./pkg/app/carbonapi ./pkg/backend/net ./pkg/backend ./pkg/cfg passed.
  • make test passed: the complete Cairo/nativegzip/zlibng race suite and the nativegzip and portable backend decoder variants.
  • git diff --check passed.

@timtofan
timtofan merged commit af30f41 into master Nov 13, 2026
6 checks passed
@timtofan
timtofan deleted the atimofieiev/stock-backend-transport-gh branch November 13, 2026 15:29
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.

2 participants