The Architecture Decisions That Actually Matter
Most Laravel performance articles focus on obvious wins: eager loading, caching, database indexing. Those matter. But the architectural decisions that determine whether your Laravel application scales gracefully — or grinds to a halt at 50,000 daily active users — are made much earlier in the project lifecycle.
1. Queue Everything That Can Be Deferred
Synchronous processing is the enemy of response time. Any operation that is not strictly required to render the HTTP response — sending emails, generating PDFs, syncing to third-party APIs, processing file uploads, sending webhooks — must be dispatched to a queue. With Laravel Horizon and Redis-backed queues, a well-architected application can handle bursts of tens of thousands of queued jobs without user-facing latency impact.
Anti-pattern: calling Mail::send() synchronously in a controller. Pattern: Mail::to()->queue() with a dedicated mail worker that auto-scales on ECS or Forge.
2. Multi-Tenancy: Separate Database vs Row-Level Security
If you are building a SaaS with multiple clients, the tenancy model you choose at the start is almost impossible to change later. Separate databases per tenant offer the strongest isolation and simplest data-partitioning, but add operational overhead. Row-level security (scoping all queries through a tenant_id) is simpler to operate but requires rigorous enforcement — one missing where clause leaks data across tenants. We use the spatie/laravel-multitenancy package with automatic tenant resolution from subdomain or JWT claim, and enforce tenancy at the model scope level so a missing where clause results in a 0-result query rather than a data leak.
3. Read Replicas for Analytics Queries
OLTP databases are optimised for transactional reads and writes. Complex analytics queries — dashboard aggregations, report generation, export jobs — lock rows, consume connection pool slots, and degrade application performance for other users. Route analytics queries explicitly to a read replica using Laravel's database read/write connection configuration. For applications processing millions of rows, consider offloading analytics to ClickHouse or a dedicated data warehouse.
4. Event Sourcing for Audit-Critical Domains
For domains where you need a complete, immutable history of what happened — financial transactions, healthcare records, contract changes — event sourcing is worth the added complexity. We use spatie/laravel-event-sourcing on two production systems. The primary benefit is not just audit trails — it is the ability to rebuild any read model from scratch and to replay events to debug production issues in a safe environment.
5. The Strangler Fig: When to NOT Start With Microservices
Every year, clients come to us wanting to build their new SaaS as microservices because "that is how big companies do it." For 95% of products below $10M ARR, a well-structured Laravel monolith will outperform a microservices architecture on every dimension: development velocity, operational simplicity, debugging ease, and team cognitive overhead. Build a modular monolith first. Extract services only when you have a specific, measured problem that a service extraction solves.