You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
High-concurrency sysbench workloads show very large allocations from the trace/ETL SQLFlusher path. CPU cost is tiny (~0.006%), so this is not a direct CPU hotspot — the concern is allocation pressure and downstream GC overhead under high concurrency.
CPU cost is ~0.006% — the path spends almost no CPU, but allocates heavily for trace/ETL buffers.
read_write 1000vu GC rises to ~16% CPU (scanSpan 7.56% + tryDeferToSpanScan 5.20% + fpTracebackPartialExpand 3.25%), vs point_select's ~10%. The heavy allocation is a contributing factor.
Impact
Large background allocations increase GC pressure.
Consider sampling or high-concurrency degradation.
Verify with alloc_space and GC CPU before/after.
Reproduction
Profiles at mo-srv-129:/data/mo-prof/pprof/1000vu_auto/heap.pprof and mo-srv-129:/data/mo-prof/pprof_rw/1000vu/heap.pprof. Repro scripts /data/mo-prof/run_bench.sh (point_select) and /data/mo-prof/run_rw.sh (read_write). Related profiling task: #25472.
After removing the read_write tombstone pollution from the point_select table, the clean point_select result improved significantly, but the SQLFlusher.FlushBuffer allocation issue still reproduces.
This is a cross-workload trace/ETL allocation issue. It is not specific to point_select, and it is independent of the earlier delete/tombstone pollution in the point_select table. The tombstone issue affects TPS/CPU/read-path attribution, but not this line-level SQLFlusher allocation root cause.
Current fix direction
Use the current batch size to construct the final LOAD DATA INLINE SQL directly, instead of allocating a fixed 10MB intermediate escape buffer per flush. The local candidate patch uses strings.Builder with exact Grow sizing based on:
original CSV length
number of escaped \ and ' bytes
SQL literal/table name overhead
This removes both the fixed 10MB sqlCsv buffer and the extra fmt.Sprintf copy.
Validation plan
Use a clean point_select table/data set to avoid read_write delete tombstone pollution.
Acceptance for the fix:
SQLFlusher.FlushBuffer drops from ~223GB alloc_space to GB-level or disappears from top20.
TPS and CPU do not regress on point_select clean auto 1000vu.
SQL escaping behavior remains unchanged (\ and ' are still escaped correctly).
Validated a local candidate fix on mo-srv-129 with a clean point_select dataset.
Setup
Binary: patched mo-prof-svc with SQLFlusher.FlushBuffer changed to build the final LOAD DATA INLINE SQL directly via strings.Builder instead of allocating a fixed 10MB intermediate escape buffer.
github.com/matrixorigin/matrixone/pkg/util/export/etl.(*SQLFlusher).FlushBuffer
Total heap alloc_space: 506.39GB
FlushBuffer: 0 flat / 30.54MB cum (0.0059%)
content.go:205 loadSQL.Grow(...) 15.87MB
content.go:227 conn.Exec(...) 14.68MB
SQLFlusher.FlushBuffer disappeared from top allocators. The fixed 10MB-per-flush allocation is removed.
Notes
TPS and CPU did not regress; TPS improved in this run. p95 is higher than the previous clean baseline, so it should be watched in PR validation, but the primary allocation acceptance is met.
The large drop in total heap alloc_space also reflects that the previous fixed 10MB SQLFlusher buffer was a major allocation amplifier under high flush frequency.
Fixed by merged PR #25540: #25540. The fixed 10MB-per-flush SQLFlusher allocation was removed, with clean point_select validation showing SQLFlusher allocation dropping from ~223GB to MB-level.
Activity
VioletQwQ-0 commentedon Jul 8, 2026
Follow-up: clean point_select + read_only/insert evidence
After removing the
read_writetombstone pollution from the point_select table, the clean point_select result improved significantly, but theSQLFlusher.FlushBufferallocation issue still reproduces.Clean point_select, 8GB cache
Workload:
oltp_point_select, 1000vu,--db-ps-mode=auto(prepared), SHARED memory cache 8GB.SQLFlusher.FlushBuffer: 223.18GB flat / 225.06GB cum (4.87% cum)Line-level evidence:
This confirms the root cause is the fixed 10MB escape buffer per flush, not the SQL execution or formatting cost.
Additional workloads
SQLFlusher.FlushBufferalso appears consistently in read_only and insert profiles:For read_only/insert 1000vu, the same line accounts for nearly all SQLFlusher flat allocation:
Updated conclusion
This is a cross-workload trace/ETL allocation issue. It is not specific to point_select, and it is independent of the earlier delete/tombstone pollution in the point_select table. The tombstone issue affects TPS/CPU/read-path attribution, but not this line-level SQLFlusher allocation root cause.
Current fix direction
Use the current batch size to construct the final
LOAD DATA INLINESQL directly, instead of allocating a fixed 10MB intermediate escape buffer per flush. The local candidate patch usesstrings.Builderwith exactGrowsizing based on:\and'bytesThis removes both the fixed 10MB
sqlCsvbuffer and the extrafmt.Sprintfcopy.Validation plan
Use a clean point_select table/data set to avoid read_write delete tombstone pollution.
Acceptance for the fix:
SQLFlusher.FlushBufferdrops from ~223GB alloc_space to GB-level or disappears from top20.point_select clean auto 1000vu.\and'are still escaped correctly).VioletQwQ-0 commentedon Jul 8, 2026
Patch validation: clean point_select auto 1000vu
Validated a local candidate fix on mo-srv-129 with a clean point_select dataset.
Setup
mo-prof-svcwithSQLFlusher.FlushBufferchanged to build the finalLOAD DATA INLINESQL directly viastrings.Builderinstead of allocating a fixed 10MB intermediate escape buffer.oltp_point_select, 1000vu,--db-ps-mode=auto,--skip_trx=on,--point_selects=1sysbench_ps_sqlflusher_clean, 10 tables × 1M rows, prepared after service restart to avoid read_write delete/tombstone pollution.mo-srv-129:/data/mo-prof/pprof/sqlflusher_clean_auto_1000vu/Result
SQLFlusher.FlushBufferLine-level after patch
SQLFlusher.FlushBufferdisappeared from top allocators. The fixed 10MB-per-flush allocation is removed.Notes
VioletQwQ-0 commentedon Jul 13, 2026
Fixed by merged PR #25540: #25540. The fixed 10MB-per-flush SQLFlusher allocation was removed, with clean point_select validation showing SQLFlusher allocation dropping from ~223GB to MB-level.