Scaling & Performance
One server takes you surprisingly far. When you outgrow it, Larz scales the boring, reliable way - more workers, caching, and moving the slow work off the request.
Most apps never need exotic scaling - a single well-configured box handles real traffic. But when you do grow, Larz scales predictably: it's a standard WSGI app, so you add workers and machines behind a load balancer, cache the hot paths, and push slow work into background jobs.
Scale out with workers
# more gunicorn workers = more concurrency (Larz is sync/WSGI)
gunicorn -w 8 -c deploy/gunicorn.conf.py app:app
# then run several machines behind a load balancer; keep sessions statelessCache the hot paths, defer the slow ones
@app.cache(ttl=60) # serve read-heavy routes from cache
@app.get('/leaderboard')
def board(req): ...
@app.job # move slow work off the request thread
def render_report(uid): heavy(uid)Takeaways
- One server goes far - measure before you scale, and scale the boring way.
- Larz is WSGI: add workers and machines behind a load balancer; keep state in the DB, not memory.
- Cache read-heavy routes and defer slow work to background jobs.