Commit 7c44a01
committed
cgen: lower Boehm GC free-space divisor to 1 for the opt modes (fix #27555)
Allocation-heavy multithreaded HTTP servers regressed on the default GC after
thread-local allocation (#27544) removed the allocator-lock bottleneck: with the
fast path no longer serializing on the global lock, the remaining bottleneck is
Boehm's stop-the-world collections, which each pause every worker thread.
The optimized GC modes kept the heap small via GC_set_free_space_divisor(2),
which makes those collections frequent. Lower it to 1 so the heap may grow to
roughly the live set before collecting, cutting stop-the-world pauses ~3x. It is
still emitted before GC_INIT(), so a user GC_FREE_SPACE_DIVISOR env var overrides
it and memory-constrained programs can raise it again.
Measured on a 10-core machine, single-allocation JSON workload:
- multithreaded: +21% throughput (1.79M -> 2.17M rps)
- single-threaded: 3.3x fewer collections (7277 -> 2224 per 2M requests)1 parent 351709f commit 7c44a01
2 files changed
Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
165 | 171 | | |
166 | 172 | | |
167 | 173 | | |
| |||
190 | 196 | | |
191 | 197 | | |
192 | 198 | | |
193 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
194 | 202 | | |
195 | 203 | | |
196 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments