Files
ai-engineering/docs/local-server-sse-results.md
T
bquarkz 9a555cb3c6
build / jvm (push) Waiting to run
build / native (macos-15, macos-arm64) (push) Waiting to run
build / native (ubuntu-24.04, linux-x86_64) (push) Waiting to run
build / native (windows-2025, windows-x86_64) (push) Waiting to run
Test / Tests and coverage
Intrepid/AI Engineering/pipeline/head This commit looks good
feat: add per-project native server and SSE command streaming
Keep Spring in a persistent project server with lightweight clients, managed start/stop, bounded SSE subscriptions, cursor recovery and durable mutation outcomes. Preserve SQLite authority and transaction limits, and document reproducible native measurements.

Validation: 269 tests, 11 pipeline scenarios, full native/SSE smoke, native package verification and 17 installer tests passed. Implements WRK-000E / DEC-0001 / DEC-0002.
2026-11-22 23:08:47 +00:00

5.7 KiB

Native SSE results

WRK-000E / DEC-0002 / PLN-0002 measured on 2026-11-22, Apple M2 Pro, 10 logical CPUs, 16 GiB RAM, macOS 27.2.1 arm64. GraalVM CE 25.5.5.0+3 / Java 25, Spring Boot 4.0.9 and SQLite JDBC 3.54.1.0 remain unchanged. No Rust port, DI migration or JDBC pool is part of this change.

Operation Samples Median p95 Maximum
Fresh client, ready server, work show 100 43.92 ms 52.73 ms 99.28 ms
Manual start to readiness 10 284.58 ms 289.95 ms 289.95 ms
Automatic first work show, server stopped 10 114.18 ms 147.84 ms 147.84 ms
Preserved server before SSE, same records 100 50.24 ms 56.97 ms 60.16 ms
Preserved native Spring-per-call baseline 100 248.14 ms 252.23 ms 297.11 ms
Queries with four waiting SSE jobs 100 44.94 ms 55.18 ms 62.78 ms

The <=100 ms ready-server p95 and <=1 second readiness targets passed. These are sequential runs on this machine, not randomized causal comparisons. SSE improves ongoing event delivery; it does not itself establish a bootstrap speedup.

The pure-query dataset remains 100 synthetic Works and 1,000 notes, SQLite, without Git, providers or external network. It is copied from the stopped fixture originally created through public CLI commands; operational server state is excluded. Ten warmups precede 100 independent native clients. Python's monotonic clock includes launch, transport, queue, command execution and captured output, excluding terminal rendering. p95 uses nearest rank. Process-cold starts leave OS file caches intact. Manual management commands still construct their full help-capable parser.

The stream workload adds four surveys with ten questions each to WRK-0001 in a separate copy of the same dataset. All four jobs subscribe before 100 fresh-client queries of WRK-0064; they are waiting for input during those queries. The jobs then answer concurrently, producing 40 input-to-next-output observations:

Stream workload Result
Responses verified 40 / 40
Input POST start to next output/event, median 471.07 ms
Input POST start to next output/event, p95 537.23 ms
Input POST start to next output/event, maximum 543.80 ms
Resident memory with four waiting streams, after setup 63.70 MiB

That timing includes the control request, survey/history validation, publication and writer contention. It is not isolated SSE transport latency. Unicode output matches durable results, terminal snapshots after reconnect match, and a separate native job verifies cooperative cancellation. Client tests count one submit and zero periodic job GETs during ordinary reconnection. Ambiguous input responses use one recovery lookup and preserve the buffered line/sequence.

The first concurrent workload failed with Project publication is busy; local writer wait exceeded 2000 ms. EXP-0001 retained partial evidence; EXP-0002 retained the actual terminal error. The fix reuses only the validated bootstrap/backend choice within each SQLite transaction, reducing repeated decoding while the publication fence is held. It does not cache records across transactions, weaken domain/history validation, infer SQLite from an existing database, change schema or enlarge timeouts. EXP-0003 repeated the identical four-survey/40-answer workload successfully.

After a fresh start and one work show per server, summed RSS was:

Project servers Total process RSS
1 48.61 MiB
5 242.62 MiB
10 485.33 MiB

The first project has the nominal dataset; the rest have one Work each. These are idle snapshots, not peak memory or proportional memory; shared pages can be counted repeatedly. The four-stream RSS also includes mutation/setup allocations and job state, so its difference cannot be attributed exclusively to SSE. Fixtures are stopped and temporary stream projects removed afterward.

Raw samples, environment/load, fixture provenance and component hashes are retained: nominal run, stream run, and failed stream run. The measured build ID is c891da8913045080a02d7b977a259d097e30864a5487e230d0ec7d5d4e78daff; native binary SHA-256 is 2fa0f168bfb8e1ba11edbcd5cdda2a6b150726f86d9c11e77ee26c21ce7fc887.

python3 scripts/server-benchmark.py \
  --binary build/native/package/ai-engineering \
  --baseline /path/to/native-per-call-package/ai-engineering \
  --server-baseline /path/to/pre-sse-package/ai-engineering \
  --directory /tmp/aie-sse-benchmark-new --output /tmp/aie-sse-benchmark-new.json \
  --samples 100 --starts 10

python3 scripts/native-sse-smoke.py \
  --binary build/native/package/ai-engineering \
  --fixture /tmp/aie-sse-benchmark-new/nominal \
  --samples 100 --questions 10 --streams 4 --output /tmp/aie-sse-events-new.json

Fixture generation is outside timing; --fixture can reuse a previously generated, stopped synthetic dataset. The probe retains a failure diagnostic if a job fails, cancels unfinished fixture jobs and attempts bounded shutdown during cleanup.

Final verification: ./gradlew check passed 269 tests without failures, errors or skips and all 11 Jenkins pipeline fixture scenarios. The complete native smoke passed on the final binary, including forced native SSE client execution, SQLite, legacy formats, provider fixtures, authority, recovery and cancellation. The 17 installer fixture tests, Work/project integrity, syntax, documentation links and diff checks passed. Fixture servers were closed. The measured binary/build hashes match the candidate; documentation synchronization changes package component hashes without changing that executable. No active installation or consumer project was changed.