Email systems fail under load in ways that functional tests never reveal. A password-reset flow that works for ten users a minute can stall at ten thousand; a queue that drains comfortably overnight can lag for hours during a flash sale; a webhook endpoint that handles ordinary traffic can collapse when a campaign's bounces arrive together. The temptation is to test by sending real mail to real addresses, which is exactly the wrong thing to do: it damages reputation, annoys recipients and may violate your provider's terms. This guide explains how to load test an email pipeline safely, using sandboxes, sinks and simulated events, which measurements to take, how to find bottlenecks in your own application and in the path to the provider, and how to turn the results into a capacity plan and a go or no-go decision before a high-volume event. See also peak season planning and staging and sandbox testing.
What you are testing
| Component | Typical limits | What to observe |
|---|---|---|
| Application and job queue | Worker count, database locks, template rendering time | Jobs per second, queue depth, retry storms |
| Template and personalization | CPU for rendering, data lookups per message | Render time per message at scale |
| Connection to the provider | Concurrent connections, messages per connection, API rate limits. See connection pooling | Connection errors, 4xx throttling responses, latency |
| Provider acceptance | Per-account sending limits and queue policies | Acceptance rate, time to accept |
| Webhook receiver | Request rate, database writes, signature checks. See webhooks vs polling | Response times, failures, backlog |
| Downstream systems | CRM, analytics, suppression sync | Lag and error counts |
| Outbound to recipients | Throttling by receiving providers. See throttling | Deferral rates; cannot be load tested without real delivery |
The last row is the one you cannot test safely: receiving servers decide how fast they accept your mail based on reputation, and that is measured only on real campaigns. Test your own half of the pipeline thoroughly, then ramp real sends gradually. See warm-up.
Safe test targets
- A mail sink. A server that accepts mail on SMTP and discards it or stores it for inspection. Tools such as MailHog, Mailpit, Smtp4dev or a simple Postfix sink with a catch-all route do this. Run it in your own network.
- Provider sandbox mode. Many sending platforms offer a mode that validates and queues requests without delivery. Check your provider's documentation and limits.
- Provider-supplied test addresses that simulate delivery, bounce and complaint outcomes. Use only those documented for the purpose.
- Your own domain with a test MX that points to the sink. Keep it clearly separate from production domains and do not send to third-party addresses.
- Mocked provider endpoints in your application, which let you test your code at much higher rates than any real provider would accept.
Never use made-up addresses at real domains, and never "test" with purchased or old lists. Bounces and spam traps from such tests harm your domain and IP reputation. See spam traps.
Designing the test
- Define the goal as a number: for example "send 500,000 messages within 30 minutes with the 95th-percentile queue-to-accept time under 60 seconds".
- Model realistic traffic: message sizes with typical templates and attachments, personalization variables, a mix of transactional and campaign sends and recipients spread across domains.
- Ramp in steps: 10, 25, 50, 100 per cent of the target, then 150 per cent for headroom. Hold each step long enough for queues to reach a steady state.
- Inject failures: slow responses, 4xx throttling, connection resets and provider timeouts. Observe retries and backoff. See rate limits and backoff.
- Simulate events: replay realistic volumes of delivery, bounce, complaint, open and click events to your webhook receiver, including bursts and duplicates.
- Run long enough to expose memory growth, connection leaks and database bloat: at least an hour for key steps, and an overnight soak for important systems.
- Capture everything: metrics, logs and traces with timestamps, so you can find the first bottleneck.
Metrics to record
| Metric | Why it matters | Warning sign |
|---|---|---|
| Enqueue rate and dequeue rate | Shows whether workers keep up | Queue depth rises steadily |
| Queue-to-accept latency (p50, p95, p99) | What users experience for time-sensitive mail | p99 grows far above p50 |
| Provider response codes | Throttling and errors | Rising 4xx or 5xx rates |
| Connection count and reuse | Efficiency of pooling | Many short connections |
| Worker CPU and memory | Resource limits | Saturation or growth over time |
| Database load and lock waits | Frequent bottleneck for status updates | Slow queries, deadlocks |
| Webhook response time and backlog | Event pipeline health | Timeouts and retries |
| Error and retry counts | Hidden amplification | Retries multiplying load |
| Duplicate sends | Correctness under retry | Any duplicate. See idempotency patterns |
Typical bottlenecks
- Database writes for every message status, which can be batched or moved to a queue.
- Template rendering that fetches data per message; pre-load or cache shared data.
- Opening a new connection per message; reuse connections or use the API in batches.
- Retry storms: failures trigger immediate retries that add load. Use exponential backoff with jitter.
- Priority inversion: a large campaign delaying password resets. Use separate queues and priorities for transactional mail. See separate streams.
- Webhook bursts arriving with the campaign's bounces, overwhelming a synchronous handler.
- Single points of failure, such as one worker pool or one provider region.
Tools and approaches
Generic load tools such as k6, Locust or JMeter can generate the application-level traffic that triggers sends, while a mail sink records what arrives. For SMTP-level tests, scripts using a mail library can open many connections and submit messages to the sink. Use realistic message bodies, because very small test messages hide the cost of rendering and encoding. Run tests from the same network position as production if possible, since latency to the provider affects throughput. Record the exact configuration of each run, including worker counts and connection limits, so that results are comparable and repeatable when you test again after changes.
From results to a capacity plan
Record the highest rate sustained with acceptable latency, then apply headroom: plan to operate at no more than about 60 to 70 per cent of that figure at the expected peak. Write down the scaling levers (more workers, more connections, higher provider limits), the time each takes and who can pull them. Ask your provider in advance to raise sending limits for the event, and confirm reputation and warm-up status for any new IPs. Prepare a rollback and a degraded mode, such as delaying low-priority campaigns to protect transactional mail. See reliable sending queues.
Readiness checklist for a big send
- Authentication, reputation and suppression lists checked. See deliverability checklist.
- Load test results documented, with the bottleneck fixes deployed.
- Dashboards and alerts for queue depth, latency, errors, bounces and complaints. See delivery monitoring.
- Staged ramp-up plan with stop conditions, such as a bounce or complaint threshold.
- On-call staff and escalation contacts, including the provider's support.
- Communication plan if delivery is delayed.
- Post-send review to compare predictions with results.
Load testing an email pipeline is mostly about everything that happens before mail leaves your control. Test that half hard and safely, ramp the real sending carefully, and the day of the big send becomes a routine operation.
Plan for peak volume Talk to us about capacity, limits and warm-up.
References and further reading
Frequently asked questions
Can I load test by sending to real addresses?
No. It harms reputation and may breach terms. Use a sink, sandbox or documented test addresses.
What should I measure in an email load test?
Queue depth, queue-to-accept latency, provider response codes, resource use and webhook backlog.
How much headroom should I plan?
Operate at about 60 to 70 per cent of the proven maximum at expected peak.
Can I test receiving-provider throttling?
Not safely. It depends on reputation and appears only in real sends, so ramp real campaigns gradually.
How do I protect transactional mail during a campaign?
Use separate queues, priorities or streams so campaign load cannot delay password resets and receipts.