Skip to content

[Bug]: A single hi turn incurs 200+ SQL operations and ~20 transactions, with seconds of non-model latency on QA #1124

Closed as not planned

Description

@gouhongshen

Is there an existing issue for the same bug?

This report records the current observed behavior and 2026-10-23 baseline measurements only, separately from optimization experiments. It does not report proposed or experimental optimization results.

Version and environment

  • QA Astra deployed revision: 3b97a1e3d571d6eaedfb3554d357ed957c08d16f.
  • Local Astra baseline: main business code at 2238be3246e9959ebd3dff4d2d655b4c4767ea38, with request-span SQL diagnostics. This is not a byte-for-byte unmodified main binary.
  • The exact same frozen baseline binary was used against both databases; SHA256: cc5b698c245563a52b17ed8de8109f19df03c919a3f0818de509526cd9763ea1.
  • QA and local MatrixOne: 4.2.6, revision 71498157cc21f833b8e717f45d50d1f926be3134.
  • Local Astra → QA: isolated test account/database on the dedicated QA CN, connected via kubectl port-forward; no MOI in this benchmark path.
  • Local Astra → local MO: official matrixorigin/matrixone:4.2.6 arm64 image; isolated Colima VM 6 CPU/8 GiB; container limit 6 CPU/7 GiB, GOMEMLIMIT=5GiB, GOMAXPROCS=6. Official quickstart single-process CN/TN/LOG, fresh DISK-V2 local storage and isolated account.
  • Astra pool max: 80. The local host also runs unrelated processes; it is not an otherwise idle benchmark machine.

Actual behavior

1. One greeting requires 200+ SQL operations and roughly 20 transactions

For a fresh 你好 turn with exactly one immediate mock-model call and zero tool calls, the measured baseline has:

Measurement SQL/query-log entries BEGIN count
Warmed measured-request median 208 17
First local-MO warmup request 329 19

“20 transactions” is an order-of-magnitude description: the measured steady-state count is 17, not exactly 20 per turn.

A typical measured request contains 117 SELECT, 38 INSERT, 16 UPDATE, 2 WITH, 1 DELETE, 17 BEGIN and 17 COMMIT = 208 entries.

Counting scope: SQLx query entries associated with that request's spans and completed before terminal receipt. Background operations without that request association are excluded. Counts include transaction-control statements; they are not 208 business DML statements or a complete MySQL wire-command count. Additional PREPARE activity must not be assumed absent.

2. Baseline latency: same local Astra, QA DB versus local MO

Each environment has 2 declared warmups and 10 measured baseline samples, all completed. The model is an immediate deterministic stub; its measured HTTP duration is subtracted individually before calculating non-model percentiles.

Baseline environment Non-model P50 P80 P90 Mean
Local Astra → QA dedicated CN 4.176s 4.519s 4.565s 4.222s
Local Astra → local MO 4.2.6 0.527s 0.550s 0.553s 0.536s
Mean interval Local Astra → QA DB Local Astra → local MO
Request start → mock HTTP starts 2.381s 0.374s
Mock HTTP finishes → run_finished received 1.842s 0.162s
Union of request SQL client elapsed intervals 3.719s 0.197s

SQL intervals are unioned, not summed when overlapping. Their union lies inside the total request and must not be added to the before/after-model rows. SQLx elapsed is client-observed wait, not database CPU execution time.

QA measurements: 2026-10-23 02:25–02:28 UTC. Local-MO measurements: 03:25–03:26 UTC. These are different windows. The baseline samples came from interleaved benchmark cohorts; only baseline results are reported here.

3. Actual QA user-visible “你好” request

2026-10-23 11:31:43–11:31:48 Asia/Shanghai. One successful deepseek-v4.1-flash attempt, zero tool calls, existing conversation, about 10.6k input tokens and 26 output tokens.

Non-overlapping breakdown from MOI logs and Astra provider-attempt records:

Stage Duration
MOI receives request → dispatches Astra 0.294s
Astra dispatch → provider attempt started_at 2.021s
Provider attempt started_at → terminal_at 1.446s
Provider attempt terminal → Astra stream ends 1.262s
MOI final response cleanup 0.114s
Backend request start → response end 5.137s
  • Astra stream interval: 4.730s; outside the provider-attempt window: 3.283s.
  • Whole MOI request outside that window: 3.691s.
  • The pre-model interval includes approximately 0.481s fetching MOI's external model catalog; this is not additional to the table.
  • Provider-attempt timestamps include some admission/recording overhead; 1.446s is not pure model computation and is not exactly the same boundary as mock HTTP timing.
  • Backend timing excludes browser network and rendering.
  • The QA request uses an existing session, agent binding and external catalog; the local baseline uses fresh sessions and a static mock offering. The deployed Astra revisions also differ. This is not a strictly identical-path experiment.
  • 208 SQL / 17 BEGIN were measured on the controlled baseline, not independently counted on this production-like QA trace. Do not attribute that exact count to this individual QA request.
  • Internal trace/session identifiers and raw logs are withheld from the public issue; the reporter retains the evidence for correlation.

4. What is established, and what remains unknown

  • The normal greeting path has 200+ synchronous query-log entries and high-teens transaction count without any tools.
  • Seconds of non-model latency occur both in the real QA path and when local Astra connects to QA DB.
  • With the same Astra baseline and MO revision, local single-instance MO completes the non-model path in about half a second.
  • Most of the remote baseline wall interval overlaps client SQL waits. This does not identify those waits as database execution, lock contention, network delay, connection-pool contention or Astra CPU time individually.
  • Local versus QA differs in topology, storage, resource allocation, dataset/cache history, background activity and network path. It is not a network-only ablation and does not prove an MO-engine root cause.
  • This is a measured current-state report, not an optimization-result report or proof of a specific proposed fix.

Expected behavior

A trivial single-round greeting should not accumulate seconds of non-model latency from excessive synchronous persistence round trips. The required durable operations and their critical-path waits should be explainable without compromising normal persistence, billing, ownership, cancellation or replay semantics.

Steps to reproduce

  1. Start the frozen Astra baseline against an isolated MatrixOne account/database. Configure one immediately responding OpenAI-compatible mock offering, with no tool calls.
  2. Send a fresh-session POST /chat/stream request:
{
  "message": "你好",
  "model_selection": {"offering_id": "<mock offering id>"},
  "context": {
    "thinking": {"mode": "model_default"},
    "max_output_tokens": 64
  },
  "explain": false,
  "execution_policy": {
    "turn_intent": "fixed_default",
    "skill_auto_route": "auto"
  }
}
  1. Use 2 warmups followed by 10 measured requests; retain all measured samples, including slow/failing ones. Do not substitute failed samples.
  2. Measure through receipt of completed run_finished, confirm EOF, and correlate exactly one mock HTTP call per request. Subtract that request's model HTTP duration before calculating nearest-rank percentiles.
  3. Correlate SQLx entries through request spans; count transaction controls explicitly and union elapsed intervals rather than adding overlaps.
  4. Repeat with the same Astra binary and request against local official MO 4.2.6 with a new isolated account/database.

Additional information

No QA business data or deployments were changed for these measurements. Full request/SQL/model timings, frozen binary hashes and benchmark configuration are retained by the reporter. Raw credentials, private endpoints, proprietary prompts and customer data are not included here.

Activity

  1. added
    kind/bug
    on Oct 23, 2026
  2. self-assigned this
    on Oct 23, 2026
  3. XuPeng-SH commented on Nov 13, 2026

    @XuPeng-SH
    Collaborator

    Consolidating into #1119. The 2026-10-23 mock-provider SQL/transaction baseline, its topology and its original counting scope are retained in #1119 as historical evidence. Consolidating tracking does not claim that the old measurements still describe current main or that the optimization is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions