Controlled Livestream Session Simulator (CLSS)
I designed and built the foundation of a QA and load-testing service that runs bounded synthetic sessions against a mock or an authorized test target, with the safety limits enforced in configuration and in the database.
The problem
A client brief in the livestream space needed a way to put controlled, repeatable load on a streaming service and see how it behaves. The same brief also mixed in aims that fall outside testing, such as affecting a public platform's metrics, so the first job was to decide what the product would and would not do.
How I built it
I wrote the boundaries before any code: synthetic sessions only, run against a registered target ID (never a free-form URL), with finite limits on sessions, duration, requests and retries. I then designed a Python modular monolith with a FastAPI control API and a bounded worker, using PostgreSQL as the single source of truth, with a transactional outbox, SKIP LOCKED claiming, short leases and fencing tokens in place of a message broker. What I built is the foundation: typed settings, an immutable safety profile that fails closed at startup, health and readiness endpoints, and a 19-table PostgreSQL schema with migrations, least-privilege database roles and an append-only audit trail.
What got hard
- The brief mixed a legitimate testing need with goals outside testing.
I wrote a system-boundaries document first and turned the limits into configuration that must validate at startup, so the service refuses to start without a complete safety profile. The first profile allows four sessions per run, one worker and no outbound network connections.
- The async PostgreSQL driver does not work with the default Windows event loop.
I added an entrypoint step that selects the supported selector event loop before the server starts, and covered it with its own test.
- Database tests that quietly skip can leave a green build that proves nothing.
The validation script requires the integration tests: with the database removed, the suite reports 22 passed and 58 errors instead of skipping the 58 database tests. The fixtures also refuse any connection string that is not the disposable local database.
- Docker was not available on the development machine.
I built a native local PostgreSQL workflow with PowerShell scripts that create the roles and grants, and included an optional Compose file for the same cluster for machines that have Docker.
The result
The three foundation tickets (project bootstrap, safety profile, database schema) were delivered and committed on 27 September 2026. My validation run recorded 468 passing tests, 80 of them against a real PostgreSQL 18 instance. The worker, target adapter and run endpoints were deliberately not started, so this is a verified foundation, not a finished load-testing product.
The ← and → keys turn the page too.