go-oversync

Performance

The current sync path is bundle-based. Performance tuning should focus on bundle capture, bundle replay, and snapshot rebuilds.

Server hotspots

The server storage layout keeps hot row-bearing tables compact: registered tables are represented by table_id, row keys by key_bytes, users by user_pk, and operations by op_code. Tune the runtime around those access paths rather than repeated wire-facing schema/table/key JSON strings.

Client hotspots

Device-load simulation

Parallel mobile_flow runs use one process per simulated user by default. The --concurrency setting bounds active child processes. Each child runs the entire scenario with the existing SDK settings and owns one PostgreSQL verification connection; the parent verifies each user’s final state and collects the report.

For example, start nethttp_server, then run mobile_flow --scenario=complex-multi-batch --parallel=100 --concurrency=50 with verification enabled. Use --parallel-mode=goroutine for the retained SDK stress mode, where all users share one process and its SQLite allocator. These modes measure different deployment shapes; keep their timings and results separate. Caller cancellation stops further child launches and joins owned workers.

Sizing snapshot rebuilds

Snapshot limits are application configuration, not fixed framework capacity. On the server, ServiceConfig exposes the session caps MaxRowsPerSnapshotSession and MaxBytesPerSnapshotSession, the maximum rows and bytes per chunk, and the build and chunk concurrency permits (see Sizing and Deployment). The largest single row is derived from the bundle, pull, and chunk byte limits; materialization and cleanup batch sizes are internal. The server publishes the effective transfer limits through generation discovery.

Clients request both a row limit and a byte limit for every chunk and then clamp those requests to the advertised server limits. Go applications tune Config.SnapshotChunkRows and Config.SnapshotChunkBytes; KMP and Dart expose the equivalent snapshot chunk and apply-page settings. Keep the row and byte controls together: a row-only limit does not bound a single large row or a compressed response after decoding.

Size Go client workspace as well as transport chunks. MaxSyncWorkspaceEntries defaults to 131,072 and MaxSyncWorkspaceBytes to 256 MiB. The client can reject a snapshot after reading session metadata and before fetching chunks if its minimum entry requirement cannot fit. A 100,000-row snapshot exceeds the default entry quota even without local rows or dependency edges. Measure the local workload before raising either limit.

Go pull starts at 16 bundles and adapts requests toward a 4 MiB decoded multi-bundle page, within the configured and advertised limits. An individual bundle still needs to fit the hard response ceiling.

Use measured application data to choose limits. The project validation matrix uses these roles:

The matrix also uses approximately 256-byte and 1 KiB encoded rows. These are test shapes, not protocol requirements or universal application ceilings. The one-million-row case proves bounded memory, atomic rollback, cleanup, and resource safety on a recorded reference host; it is not a mobile latency SLO.

The 100,000-row, one-million-row, measured-memory, high-concurrency, and heavy real-server lanes are local-only. They require explicit opt-in, fresh test-owned PostgreSQL and SQLite databases, and GITHUB_ACTIONS unset. Normal CI should retain deterministic correctness, fixture, analyzer, and structural boundedness tests without enabling these workloads.

Guardrails