Skip to content

[Performance Regression]: TPCC throughput drops ~77% after 43d361ff (#27713) #27807

Description

@XuPeng-SH

Description

Commit 43d361ff7710f1d5d9af7c86638a9307f1f3f67e (fix(frontend): specialize direct prepared result metadata, #27713) introduces a severe TPCC throughput regression compared with its direct parent c1fe7b4e596c81a023d5cebd1953f388b5bd8500.

Both runs use the same nightly TPCC configuration:

  • 100 warehouses
  • 100 terminals
  • 5-minute measurement window
  • fixed terminal warehouse assignment
  • successful job completion

Direct comparison

Revision tpmC tpmTOTAL Job
c1fe7b4e596c81a023d5cebd1953f388b5bd8500 30,098.46 66,735.13 https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33166455405/job/98834333792
43d361ff7710f1d5d9af7c86638a9307f1f3f67e 7,007.01 15,522.74 https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33167546643/job/98837888099

Regression introduced by 43d361ff:

  • tpmC: -76.72%
  • tpmTOTAL: -76.74%

The workload completes without functional test failure, so this presents as a throughput/CPU-allocation regression rather than a correctness failure.

Suspected root cause

High-confidence code inspection points to execute-time prepared-plan specialization work added to the TPCC hot path:

  1. Before 43d361ff, the PREPARE-generation decision needsRuntimeSpecialization was cached and passed to specializePreparedExecutionPlan.
  2. 43d361ff repurposes that argument as directResultSpecialization and unconditionally calls PreparedPlanNeedsRuntimeSpecialization(executionPlan) for each execution.
  3. PreparedPlanNeedsRuntimeSpecialization performs DeepCopyPlan plus a full plan/expression walk.
  4. The subsequent parameter-fill path still performs another plan copy/rebind, and replaceParamVals now also calls PreparedPlanDirectResultParamPositions(plan0) during execution.
  5. TPCC repeatedly executes arithmetic prepared DML statements, amplifying these plan copies, walks, allocations, rebinding, compile work, and GC pressure.

The direct-result metadata feature is orthogonal to ordinary TPCC DML. Its admission/tracing should not add per-execution work to that path.

A CPU/alloc pprof from the same nightly environment is still needed to quantify the exact contribution of each new scan/copy, but the direct parent/child benchmark and code-path change establish a strong regression boundary.

Expected behavior

  • Direct prepared-result metadata specialization must not change the ordinary prepared DML fast path.
  • Static runtime-specialization eligibility must be computed at most once per prepared-plan generation.
  • Direct-result parameter positions must be discovered during PREPARE/rebuild and reused, not rediscovered for every execution.
  • Stable-type repeated prepared DML must reuse its cached plan/compile whenever semantics permit.

Proposed fix direction

  • Split the cached needsRuntimeSpecialization decision and execute-specific directResultSpecialization into separate explicit inputs; do not overload a boolean with two meanings.
  • Avoid calling PreparedPlanNeedsRuntimeSpecialization during every execute when the generation-cached result is available.
  • Keep direct-result propagation/tracing out of generic DML parameter replacement when the prepared plan has no direct result parameters.
  • Add allocation/CPU benchmarks for repeated TPCC-shaped prepared arithmetic UPDATE statements.
  • Preserve fix(frontend): specialize direct prepared result metadata #27713 direct SELECT ? metadata correctness, including DECIMAL and binary-protocol unhappy paths.

Acceptance criteria

  • On the same TPCC 100/100/5-minute environment, throughput returns to within 5% of the direct-parent result: tpmC >= 28,593 and tpmTOTAL >= 63,398.
  • Repeated stable-domain prepared arithmetic DML does not perform a full plan deep-copy/static-specialization scan on every execution.
  • Direct prepared-result metadata tests from fix(frontend): specialize direct prepared result metadata #27713 continue to pass.
  • Type changes, NULL, invalid/oversized DECIMAL, compile retry, and prepared-plan rebuild paths remain correct.

Note: the parent revision itself is already below the earlier healthy TPCC baseline. This issue isolates the additional ~77% regression introduced specifically by 43d361ff; removing it does not by itself resolve the earlier regression.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions