Commit b91c821
committed
stream: move serverStream.mu to cache line 2 to eliminate false sharing
serverHeaderBinlogged (written unsynchronised in SendHeader and Send) and
mu shared cache line 3 (192–255) after the initial tail-grouping commit.
Concurrent writes to serverHeaderBinlogged invalidate the cache line before
every mu.Lock(), adding ~5–21× overhead under concurrent load.
Moving mu to immediately before trInfo places it at offset 184 (cache line 2:
128–191). The tail bools remain at offset 240+ (cache line 3), so stressor
writes no longer affect mu.Lock() latency.
Benchmark before this commit (serverHeaderBinlogged stressor):
stressors=0 3.9 ns
stressors=1 20.1 ns (5.2×)
stressors=4 79.9 ns (20.4×)
Benchmark after (different cache lines):
stressors=0 3.7 ns
stressors=1 3.8 ns (~1×)
stressors=4 3.7 ns (~1×)
No size change: serverStream remains 248 B.
Fixes #93491 parent ea29db8 commit b91c821
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1728 | 1728 | | |
1729 | 1729 | | |
1730 | 1730 | | |
1731 | | - | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
1732 | 1735 | | |
1733 | 1736 | | |
1734 | 1737 | | |
1735 | 1738 | | |
1736 | 1739 | | |
1737 | | - | |
1738 | | - | |
1739 | 1740 | | |
1740 | 1741 | | |
1741 | 1742 | | |
1742 | 1743 | | |
1743 | 1744 | | |
1744 | | - | |
1745 | 1745 | | |
1746 | 1746 | | |
1747 | 1747 | | |
| |||
0 commit comments