How samithathiyagarajan/ticket-stampede works
Ticket Stampede is a ticket-selling backend designed to preserve sale invariants under concurrent purchase requests and database failures. The main workflow resets a sale, submits purchases through the service, and verifies responses against a final status snapshot. The README documents the multi-seller/nginx deployment, load generation, failure experiments, and offline evidence viewer. Source excerpts show the seller’s transaction and status behavior plus buyer request and verification flow; some deployment and diagnostic wiring is based on README documentation rather than sampled implementation.
Main entry points: app.py Seller API · buyer.py Load Generator · analyze_commit_drop.py Commit Drop Analysis · replay_check.py Recovery Replay Check
Components 15
Ticket Service
- Seller API
seller/app.py - Safe Constraints
seller/schema_safe.sql - Naive Schema
seller/schema_naive.sql - Load Balancer
lb/nginx.conf - PostgreSQL
Load and Verify
- Load Generator
buyer/buyer.py - Invariant Verifier
buyer/buyer.py
Failure Diagnostics
- DB Sampler
buyer/pgsample.py - Fault Injector
scripts/inject_db_fault.sh - Commit Drop Proxy
diag/commit_drop_proxy.py - Commit Drop Analysis
diag/analyze_commit_drop.py - Recovery Replay Check
scripts/replay_check.py - Network Reset Analysis
diag/analyze_resets.py
Evidence Viewer
- Offline Evidence Viewer
viewer/index.html
Other components
- Buyer / Operator
Connections 20
- Buyer / Operator → Load Generator: starts run
- Load Generator → Load Balancer: sends purchases
- Load Generator → Seller API: calls reset
- Load Balancer → Seller API: routes requests
- Seller API → PostgreSQL: reads and writes
- Seller API → Safe Constraints: loads schema
- Seller API → Naive Schema: loads schema
- Load Generator → Seller API: reads status
- Load Generator → Invariant Verifier: passes raw results
- Invariant Verifier → PostgreSQL: checks final state
- DB Sampler → PostgreSQL: samples sessions
- Fault Injector → PostgreSQL: injects faults
- Seller API → Commit Drop Proxy: connects through
- Commit Drop Proxy → PostgreSQL: forwards traffic
- Commit Drop Analysis → PostgreSQL: audits rows
- Commit Drop Analysis → Seller API: replays purchases
- Recovery Replay Check → Seller API: replays requests
- Recovery Replay Check → PostgreSQL: audits constraints
- Network Reset Analysis → Load Generator: matches reset events
- Buyer / Operator → Offline Evidence Viewer: views evidence