-
Notifications
You must be signed in to change notification settings - Fork 976
Comparing changes
Open a pull request
base repository: bytebase/bytebase
base: main
head repository: bytebase/bytebase
compare: p0ny/sample-instance-loadtest
- 10 commits
- 14 files changed
- 1 contributor
Commits on Aug 13, 2026
-
feat(loadtest): add sample-instance capacity load-test harness
Add a DSN-driven harness that provisions isolated sample databases and roles, seeds the Bytebase sample HR schema, replays Bytebase-like sync, DDL, and interactive workloads, records measurements, and removes everything it created. Phase 1 runs the matrix against local Postgres via testcontainers; a CLI entrypoint is included for the Cloud SQL leg. Includes the agreed workload assumptions and pass/fail thresholds in the README.
Configuration menu - View commit details
-
Copy full SHA for e65c523 - Browse repository at this point
Copy the full SHA e65c523View commit details -
fix(loadtest): make sample-instance harness Cloud SQL compatible
Cloud SQL's postgres user is a restricted superuser that cannot SET ROLE, transfer database ownership, or drop databases it does not own. Provisioning with CREATE DATABASE ... OWNER therefore fails. Change the model to: the admin owns each database and the workspace role is a least-privilege CONNECT + SELECT role (provision/seed/sync/DDL as admin, interactive queries as the role). Also harden the harness for re-runs and flaky networks: connect_timeout on all DSNs, a best-effort pre-run cleanup of the name prefix, an empty-tenants guard in the orchestrator, a -verbose flag, and PGPASSWORD env fallback so the password is not exposed in argv.
Configuration menu - View commit details
-
Copy full SHA for 3297cde - Browse repository at this point
Copy the full SHA 3297cdeView commit details -
fix(loadtest): redact credentials and seed SQL from the JSON report
The report marshaled Config and Tenant verbatim, leaking the admin password, per-tenant passwords, and the 570 KB seed SQL into the report and serial console. Exclude AdminPassword, SeedSQL, and Tenant.Password from JSON.
Configuration menu - View commit details
-
Copy full SHA for 0f85084 - Browse repository at this point
Copy the full SHA 0f85084View commit details -
feat(loadtest): add full-overlap worst-case workload
Run sync, interactive, and DDL simultaneously, each with one worker or session per database, instead of the capped/sequential phases. This models the worst case where every workspace is syncing, querying, and applying DDL at the same time, exposing the instance's CPU/RAM ceiling rather than the connection limit.
Configuration menu - View commit details
-
Copy full SHA for 1940aba - Browse repository at this point
Copy the full SHA 1940abaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7c8dc37 - Browse repository at this point
Copy the full SHA 7c8dc37View commit details -
Configuration menu - View commit details
-
Copy full SHA for bd52552 - Browse repository at this point
Copy the full SHA bd52552View commit details
Commits on Aug 14, 2026
-
feat(loadtest): model per-workspace sync/DDL with per-database role
Sync and change-ticket DDL now connect as each workspace's per-database role and are capped at a modest realistic overlap (default 10 and 5 concurrent) instead of an N-wide pool that treated sync as one coordination point syncing every database as admin. Interactive concurrency is held fixed (10 steady / 50 burst) while database count varies. Seed transfers ownership of the public schema and its objects to the tenant role so role-scoped DDL works; serial-owned sequences follow their table. Also rename loadSampleData to loadSampleDataFromFS to silence the revive confusing-naming lint.
Configuration menu - View commit details
-
Copy full SHA for 543997b - Browse repository at this point
Copy the full SHA 543997bView commit details -
fix(loadtest): seed as the workspace role and terminate its backends …
…before drop Cloud SQL's postgres user is not a superuser (rolsuper=false) and cannot SET ROLE or transfer ownership of objects it creates, so a role can only own what it creates itself. Seed each tenant database as the tenant role (after the control plane grants CREATE ON DATABASE and ON SCHEMA public) instead of seeding as admin and trying to transfer ownership, which fails with 'must be able to SET ROLE'. Cleanup now connects as the tenant role to terminate its lingering backends before DROP DATABASE WITH (FORCE), modeling the 7-day expiry: postgres cannot terminate another role's processes, so FORCE alone races with session teardown at scale and leaves orphaned databases and roles.
Configuration menu - View commit details
-
Copy full SHA for 9306860 - Browse repository at this point
Copy the full SHA 9306860View commit details -
fix(loadtest): drain lingering backends before dropping tenant databases
Backend termination is asynchronous: a backend can linger for a moment after its client socket closes, and dropping the database in that window fails because Cloud SQL's postgres user cannot terminate another role's processes. After terminating the role's backends, poll pg_stat_activity until the database has no backends, then drop with a bounded retry. The retry also covers a backend that appears between the drain check and the drop. Validated on Cloud SQL: the 70/500/1000 matrix completes with zero cleanup failures and no orphaned databases or roles.
Configuration menu - View commit details
-
Copy full SHA for 0f67f85 - Browse repository at this point
Copy the full SHA 0f67f85View commit details -
fix(loadtest): sync one worker per database, all concurrent
The per-workspace sync model spawns one worker per database and runs all workers concurrently, each syncing its own database as its own per-database role (the worst case where every workspace syncs at once). The previous 10-concurrent cap was a misreading of the handoff and understated sync load. Drop the now-dead SyncConcurrency knob; DDL (5) and interactive (10/50) concurrency are unchanged.
Configuration menu - View commit details
-
Copy full SHA for 5fa6b51 - Browse repository at this point
Copy the full SHA 5fa6b51View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...p0ny/sample-instance-loadtest