Skip to content

Use a sidecar connection per PHP thread#3770

Merged
bwoebi merged 2 commits intomasterfrom
bob/thread-sidecar
Apr 17, 2026
Merged

Use a sidecar connection per PHP thread#3770
bwoebi merged 2 commits intomasterfrom
bob/thread-sidecar

Conversation

@bwoebi
Copy link
Copy Markdown
Collaborator

@bwoebi bwoebi commented Apr 2, 2026

While the sidecar has been a process global for the longest time, it's also unfair with respect to limits and not compatible with the newly introduced outbox.

Having a connection per thread ensures that every thread can have up to 100 queued items. It also reduces contention on the SidecarTransport, which was indeed adding quite a bit of latency due to threads accumulating in futex_wait for very short requests under moderate load.

Moving the background sender stats to its own thread in preparation of dropping the Mutex on the SidecarTransport fully.

@bwoebi bwoebi requested review from a team as code owners April 2, 2026 12:49
@bwoebi bwoebi force-pushed the bob/thread-sidecar branch from 1efe005 to e673db0 Compare April 2, 2026 12:50
@datadog-official
Copy link
Copy Markdown

datadog-official bot commented Apr 2, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.64% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 472579b | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@bwoebi bwoebi force-pushed the bob/thread-sidecar branch from e673db0 to 1b4b37f Compare April 2, 2026 13:24
Comment thread ext/signals.c
Comment thread ext/sidecar.c
Comment thread ext/sidecar.c
@bwoebi bwoebi force-pushed the bob/batch-endpoint branch from 8ecdabc to 3503499 Compare April 2, 2026 18:36
@bwoebi bwoebi requested review from a team as code owners April 2, 2026 18:36
@bwoebi bwoebi force-pushed the bob/batch-endpoint branch 2 times, most recently from 0db877a to 83d3af1 Compare April 2, 2026 20:56
@bwoebi bwoebi force-pushed the bob/thread-sidecar branch from d58b820 to 7b5db07 Compare April 2, 2026 20:59
@bwoebi bwoebi force-pushed the bob/batch-endpoint branch 2 times, most recently from 9b92ee4 to 5cf8ebb Compare April 3, 2026 16:22
Base automatically changed from bob/batch-endpoint to master April 3, 2026 17:29
While the sidecar has been a process global for the longest time, it's also unfair with respect to limits and not compatible with the newly introduced outbox.

Having a connection per thread ensures that every thread can have up to 100 queued items.
It also reduces contention on the SidecarTransport, which was indeed adding quite a bit of latency due to threads accumulating in futex_wait for very short requests under moderate load.

Moving the background sender stats to its own thread in preparation of dropping the Mutex on the SidecarTransport fully.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
@bwoebi bwoebi force-pushed the bob/thread-sidecar branch 2 times, most recently from 7a5104a to fd34daf Compare April 17, 2026 12:23
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 17, 2026

Benchmarks [ tracer ]

Benchmark execution time: 2026-04-17 13:42:19

Comparing candidate commit fd34daf in PR branch bob/thread-sidecar with baseline commit 217c346 in branch master.

Found 1 performance improvements and 1 performance regressions! Performance is the same for 191 metrics, 1 unstable metrics.

scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache

  • 🟩 execution_time [-3.363µs; -2.217µs] or [-3.175%; -2.093%]

scenario:PHPRedisBench/benchRedisOverhead

  • 🟥 execution_time [+25.359µs; +61.125µs] or [+2.733%; +6.588%]

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
@bwoebi bwoebi force-pushed the bob/thread-sidecar branch from fd34daf to 472579b Compare April 17, 2026 14:20
@bwoebi bwoebi merged commit 6b55c3e into master Apr 17, 2026
1911 of 1931 checks passed
@bwoebi bwoebi deleted the bob/thread-sidecar branch April 17, 2026 14:58
@github-actions github-actions bot added this to the 1.19.0 milestone Apr 17, 2026
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