Designing for 1,000 TPS Without Building for 1 Million
An interactive architecture whiteboard for engineering leadership and application owners. It shows how an existing Amazon API Gateway + AWS Lambda platform can sustain 1,000 transactions per second when the real constraint is the downstream systems, and why that does not call for blockchain-style sharding or a massive distributed compute layer.
A. Executive overview
"TPS" hides three different numbers. Most throughput incidents happen because a team measured one of them and assumed the other two.
Ingress throughput
How quickly requests can enter the platform: API Gateway, authentication, validation, enqueueing. Managed AWS services usually make this the easiest number to raise.
Processing throughput
How quickly transactions are completed end to end, including every downstream call. It's bounded by the slowest required step, often a legacy system.
Sustainable throughput
The rate the whole system can run at indefinitely while still meeting its latency, availability and data-integrity requirements. This is the number to design and test for.
What 1,000 TPS means in practice
- 86.4 million transactions per day at a sustained rate, or a much shorter peak window.
- With 200 ms average processing time, about 200 transactions are in flight at any moment (Little's law: in-flight = rate × time).
- If the legacy core sustains 300 TPS, no amount of Lambda concurrency completes 1,000 TPS of core-bound work. You must reduce, isolate, batch or partition that work.
The board-level answer
- Keep API Gateway + Lambda for ingress. It is not the bottleneck.
- Add durable queues, capped workers and downstream-specific adapters, so each system receives only what it can absorb.
- Make async the default where the business contract allows it; keep a bounded, protected sync path where it doesn't.
- Invest in idempotency, status tracking and reconciliation. That is where correctness lives.
B. Architecture comparison
Switch between the two architectures. Select any component (click it, or Tab to it and press Enter) to see its purpose, failure modes and operational trade-offs below the diagram.
✓ Verified from the repository README
- Source: github.com/near/one-million-tps, a NEAR Protocol network benchmark whose stated goal is 1 million transactions per second.
- 140 nodes on Google Cloud (Compute Engine,
c4d-highmem-16), spread across us-central1, us-east1 and us-east4. - 70 shards, two chunk producer nodes per shard.
- Workload: native NEAR token transfers only, 1 million accounts, uniform cross-shard traffic.
- Load comes from a transaction generator built into the node software, not from external clients.
- Estimated cost "around $700 per hour" (README estimate; actual pricing varies).
- The README describes the setup; it does not itself publish a measured result. Check NEAR's own announcements for achieved figures.
⚠ Conceptual (this diagram)
- The exact boxes, flows and names are a teaching model of a sharded ledger, not the benchmark's internal topology.
- 8 shards are drawn to show the pattern; the benchmark used 70.
- "Network ingress", "routing" and "consensus" are simplified stand-ins for NEAR's RPC, sharding and block-production mechanisms.
- Not a like-for-like comparison: native token transfers on a system that owns its state are very different from enterprise API calls into legacy systems you can't shard.
Side by side
| Dimension | 1M TPS distributed (sharded) | 1K TPS enterprise AWS (recommended) |
|---|---|---|
| Where throughput comes from | Partitioning state and work across many shards that execute in parallel | Independent ingress scaling + controlled, isolated processing paced to each downstream system |
| Who owns the state | The platform itself (each shard owns its slice) | Existing systems of record you usually can't re-partition |
| Binding constraint | Network, coordination, hot shards | Legacy and partner capacity, connection limits, latency |
| Consistency model | Consensus and finality across shards | Systems of record + idempotency + reconciliation |
| Infrastructure | Hundreds of always-on nodes (140 in the benchmark) | Managed, mostly serverless services that scale with demand |
| Operational complexity | Very high: distributed protocol operations | Moderate: queues, alarms, DLQ runbooks, reconciliation |
| Fits when… | You own a partitionable workload and must scale far beyond a single database | Your target is ~1,000 TPS and the bottleneck is downstream capacity |
C. Animated data flow
Requests are drawn as moving circles. ILLUSTRATIVE ANIMATION: not a live AWS or NEAR simulation. Rates and timings are scaled down so you can follow individual messages; the simulator below does the arithmetic at real scale.
What you're seeing: 1K buffered architecture
- Bursts arrive faster than the API's rate limit, so some requests are throttled with 429 at the edge: backpressure working as designed.
- Accepted requests are buffered in one queue per downstream. Watch queue A grow during bursts and drain afterwards: the queue absorbs the burst, it doesn't speed anything up.
- Each worker pool has a fixed cap (2, 3, 2), so the slow legacy core never sees more than 2 concurrent calls.
- Partner failures retry after a visibility timeout. After 3 attempts the message is dead-lettered instead of blocking the lane.
- Lane C's problems never slow lanes A and B: queue isolation and bulkheads.
What you're seeing: 1M sharded architecture
- A high, uniform stream of transactions is routed to the shard that owns each sender account.
- All six shards execute in parallel, so throughput grows with the number of shards.
- About half the transactions produce a cross-shard receipt that executes on the receiver's shard: the coordination cost of partitioning.
- Results pass through consensus before being finalized.
- Nothing here waits on an external legacy system, which is precisely why this model doesn't transfer to the enterprise case.
Why the difference matters
The 1M design gets throughput by adding parallel owners of state. The 1K design gets safe throughput by pacing work to fixed-capacity owners of state. If you can't partition the system of record, more parallelism just moves the queue into the legacy system, where it shows up as timeouts.
D. Interactive throughput simulator
━ incoming vs ━ completed (TPS)
■ queue depth (messages)
downstream utilization (offered load ÷ capacity)
Model and assumptions (read before quoting any number)
Notation: λ = incoming TPS during the burst, λ₂ = arrival rate after it, T = burst duration, t = average processing time (s), N = worker concurrency, Dᵢ = sustainable capacity of downstream i, mᵢ = traffic share of branch i.
- 1 · Synchronous: each branch completes min(aᵢ, Dᵢ). Excess requests wait up to the timeout before failing, holding concurrency: demand = Σ completedᵢ·t + Σ excessᵢ·timeout. If demand exceeds N, every branch is scaled by N ÷ demand. This is how one slow system starves healthy ones in a shared synchronous pool. Accepted = completed; nothing is buffered.
- 2 · Async, shared queue and workers: work advances in mix proportion, so capacity C = min(W, minᵢ Dᵢ ÷ mᵢ) (head-of-line blocking). Without per-downstream limits, workers offer W × mᵢ to each system while a backlog exists; above 100% that means errors and retries.
- 3 · Per-downstream limits: concurrency is budgeted per system, demand first: baseᵢ = min(Dᵢ, aᵢ) × t (shared in proportion if N is too small). Any spare concurrency goes to systems that can use it to drain backlog, up to Dᵢ × t. Then Wᵢ = budgetᵢ ÷ t and Cᵢ = min(Dᵢ, Wᵢ). Offered load never exceeds Dᵢ.
- 4 · Parallelized: as option 3, with Dᵢ multiplied by the partition count only for systems you mark as partitionable.
- Rates are steady-state averages: no warm-up, cold starts, latency distributions, retries' extra load, or service quotas. Accepting faster than you complete assumes your buffer, message retention and API acceptance contract (202) allow it.
- Charts integrate the same rates over time (240 steps); the time axis is capped at one hour after the burst.
E. Protecting non-scalable downstream systems
Getting to 1,000 TPS safely means making every layer respect the capacity of the slowest system it depends on. These fourteen controls work together. Open a card for where it belongs, when it helps, its limitations, and its effect on latency, throughput and reliability.
1BackpressureStop upstream systems from generating unlimited work
- Problem it solves
- Producers can create work faster than it can be completed, which leads to unbounded queues, rising latency and eventually failure.
- Where it belongs
- At the API edge (429/503 with
Retry-After), in the ingress Lambda (refuse new work when queue age exceeds the acceptance SLA), and between internal stages. - When it is useful
- Whenever acceptance can outrun completion, which is always true for buffered designs.
- Limitations
- It moves the problem to callers, who must honour
Retry-Afterwith backoff and jitter. It needs a reliable saturation signal (queue age is better than depth). - Effect
- Latency: protects p99 of accepted workThroughput: deliberately caps acceptanceReliability: ↑ prevents collapse
2Rate limitingEnforce sustainable rates globally and per downstream
- Problem it solves
- Demand above what a system can sustain, and noisy clients consuming a shared budget.
- Where it belongs
- API Gateway throttling and usage plans (per client and route); a token bucket in each downstream adapter (per system).
- When it is useful
- Always for legacy and partner systems with known or contracted capacity.
- Limitations
- Per-instance limiters multiply as workers scale out, so you need a shared limiter or a concurrency cap. Static limits drift from real capacity, so revisit them after every capacity test.
- Effect
- Latency: ↑ for queued workThroughput: capped at the safe rateReliability: ↑
3Concurrency limitsControl simultaneous calls into legacy systems
- Problem it solves
- Too many parallel calls exhaust connection pools, sessions or threads in the legacy system.
- Where it belongs
- The SQS event source mapping's maximum concurrency per queue, Lambda reserved concurrency, and adapter connection pools.
- When it is useful
- For systems with fixed connection limits. It is self-correcting: if the system slows down, rate = concurrency ÷ latency falls automatically.
- Limitations
- Concurrency isn't rate. Set it too low and you waste capacity; too high and it doesn't protect anything. Size it from Little's law and measured latency.
- Effect
- Latency: more stableThroughput: bounded by designReliability: ↑
4Queue isolationStop one slow system from blocking unrelated work
- Problem it solves
- Head-of-line blocking: with one shared queue, messages for a slow or failing system occupy workers and delay everything else.
- Where it belongs
- One queue (and DLQ) per downstream or per transaction class, routed by the ingress or EventBridge rules.
- When it is useful
- Mixed workloads with different capacities, SLAs or failure rates. Compare options 2 and 3 in the simulator.
- Limitations
- More queues to operate and monitor; no ordering guarantees across queues; routing logic must stay correct.
- Effect
- Latency: ↓ for healthy lanesThroughput: ↑ healthy lanes unaffectedReliability: ↑ failures contained
5BatchingReduce per-transaction overhead where the backend supports it
- Problem it solves
- Per-call overhead (connection, authentication, commit) dominates, so the system spends its capacity on ceremony.
- Where it belongs
- SQS batch receive (batch size and batching window), plus an adapter that aggregates items into the backend's bulk API.
- When it is useful
- Only when the backend genuinely supports bulk operations and the latency budget allows a short wait.
- Limitations
- Partial failures are complex (use
ReportBatchItemFailures). The batching window adds latency, and a failed call affects many transactions. - Effect
- Latency: ↑ by the batch windowThroughput: ↑ often substantiallyReliability: mixed
6IdempotencyPrevent duplicate business operations during retries
- Problem it solves
- At-least-once delivery, client retries and Lambda retries can otherwise post the same payment twice.
- Where it belongs
- The API (
Idempotency-Keyheader); ingress (conditional write of the key); the worker before the downstream call; and the downstream itself when it accepts an idempotency reference. - When it is useful
- Always, for every state-changing operation.
- Limitations
- Needs a durable key store with a TTL and a defined answer for "same key, different payload". It can't make a non-idempotent downstream safe on its own, so you also need reconciliation.
- Effect
- Latency: + one conditional writeThroughput: neutralReliability: ↑↑ correctness
7Dead-letter queuesIsolate repeatedly failing messages
- Problem it solves
- Poison messages retry forever, wasting worker and downstream capacity and hiding real failures.
- Where it belongs
- A redrive policy on every SQS queue (
maxReceiveCount); on-failure destinations for async Lambda invocations. - When it is useful
- Always for asynchronous processing.
- Limitations
- A DLQ is a parking lot, not a fix. It needs alarms, triage runbooks and a redrive process. Dead-lettering breaks ordering, and messages still expire at the retention limit.
- Effect
- Throughput: ↑ stops wasted workReliability: ↑Latency: ↑ for the failed items
8Timeouts & circuit breakersPrevent cascading failures
- Problem it solves
- A slow dependency ties up callers until everything upstream also slows down or fails.
- Where it belongs
- In every adapter call. Keep timeouts nested: downstream call < Lambda timeout < queue visibility timeout. Use one circuit breaker per downstream.
- When it is useful
- On every remote call, and especially on synchronous paths.
- Limitations
- A timeout after the request was sent leaves the outcome unknown (it may have committed), so you need reconciliation. Breaker thresholds need tuning, and breaker state is per instance unless you share it.
- Effect
- Latency: boundedThroughput: protectedReliability: ↑
9BulkheadsSeparate resources and concurrency budgets by dependency
- Problem it solves
- One dependency consumes a shared pool (concurrency, connections, threads), starving everything else. The synchronous model in the simulator shows this.
- Where it belongs
- Separate functions or event source mappings with their own concurrency, separate connection pools, separate API keys and quotas, and separate sync and async capacity.
- When it is useful
- When there are several dependencies with different reliability, and whenever sync and async traffic share infrastructure.
- Limitations
- Reserved capacity can sit idle, and there is more configuration to maintain.
- Effect
- Reliability: ↑Throughput: ↑ for healthy pathsCost: some idle headroom
10CachingOnly where data freshness and business semantics allow
- Problem it solves
- Repeated reads of slowly changing reference data load the legacy system for no benefit.
- Where it belongs
- In the adapter or API layer (in-memory, ElastiCache, DAX, or API Gateway caching for safe GETs).
- When it is useful
- Read-heavy reference data (product catalogues, static entitlements) with an agreed staleness.
- Limitations
- Staleness, invalidation and stampedes. Never cache balances, limits or authorization decisions unless the business explicitly accepts stale answers.
- Effect
- Latency: ↓Throughput: ↑ for readsReliability: mixed (stale data risk)
11PartitioningBy customer, account, transaction type or another valid key
- Problem it solves
- A single serial stream or a single resource limits throughput while ordering must still be preserved.
- Where it belongs
- FIFO message group IDs per account or customer, separate queues per key range, and downstream instances that genuinely own disjoint data.
- When it is useful
- When ordering matters only per key and the downstream can process keys independently (option 4 in the simulator).
- Limitations
- Hot keys and cross-partition transactions remain a problem. Partitioning does not raise the capacity of a single legacy database behind all partitions.
- Effect
- Throughput: ↑ parallel keysOrdering: per keyLatency: ↓ except hot keys
12AutoscalingScale workers on demand and queue age, within downstream limits
- Problem it solves
- Fixed worker counts either waste money or fall behind during peaks.
- Where it belongs
- Lambda scales with the queue via the event source mapping; container consumers scale on backlog per task or age of the oldest message.
- When it is useful
- When demand varies, provided the scaling is capped by each downstream's concurrency budget.
- Limitations
- Scaling consumers past downstream capacity only adds errors and retries. There is also scaling lag and cold starts to account for.
- Effect
- Throughput: ↑ up to the capCost: efficientReliability: ↑ only when capped
13Durable transaction stateAccepted, processing, succeeded, failed, reconciliation-required
- Problem it solves
- Neither clients nor operators can tell what happened to a transaction, and blind retries create duplicates.
- Where it belongs
- A status store keyed by correlation ID, written at ingress and on every transition with conditional updates (no regressions from a late retry).
- When it is useful
- For all asynchronous processing, auditability and customer support.
- Limitations
- Extra writes per transaction, retention and PII governance, and the store itself needs capacity planning.
- Effect
- Latency: + smallThroughput: neutralReliability: ↑↑ traceability
14ReconciliationRecover from ambiguous outcomes
- Problem it solves
- A timeout after sending: the downstream may have succeeded even though you never got the response.
- Where it belongs
- A scheduled or event-driven job that queries the downstream by business reference (or compares statements) and resolves
RECONCILIATION_REQUIREDto succeeded or failed. - When it is useful
- For any non-idempotent downstream, and always for money movement.
- Limitations
- Requires a way to query outcomes (an API, reports or statements). Resolution is delayed, and a human process is needed for the leftovers.
- Effect
- Correctness: ↑↑Latency: ↑ for ambiguous casesThroughput: neutral
F. Queue and worker design
Settings that make or break this design
| Setting | Guidance | Why |
|---|---|---|
| Visibility timeout | ≥ 6× the consumer Lambda timeout (AWS guidance for SQS event sources) | Otherwise a message reappears while it's still being processed, causing duplicate work |
| Timeout nesting | downstream call < Lambda timeout < visibility timeout | Each layer must give up before the layer above assumes failure |
maxReceiveCount | Typically 3–5, with the DLQ alarmed at > 0 messages | Bounded retries; poison messages leave the main flow |
| Event source mapping maximum concurrency | Per queue ≈ downstream sustainable TPS × average call time | This is the knob that protects each legacy system |
| Partial batch responses | Enable ReportBatchItemFailures | Only failed items are retried, not the whole batch |
| Batch size / window | Small for latency-sensitive work; larger only with real bulk benefit | Batching trades latency for throughput |
| Message retention | Longer than your worst realistic backlog + incident recovery time | A backlog that outlives retention silently loses accepted work |
| Reserved concurrency | Reserve for sync and async functions separately | Keeps the regional concurrency pool from becoming a shared single point of failure |
The differences that matter
Accepted ≠ processed ≠ completed
Accepted: durably recorded and queued (HTTP 202). Processed: a worker attempted it. Completed: the downstream confirmed the business effect. Report all three. Ingress dashboards that show only "accepted" hide a growing backlog.
Retries happen at three layers
Clients retry, the SDK retries, and SQS redelivers. Uncoordinated, they multiply load during an incident. Pick one owner for business retries (the queue), cap the others, and make every layer idempotent.
Reserved concurrency vs maximum concurrency
Lambda reserved concurrency guarantees and caps a function's share of the regional pool. Event source mapping maximum concurrency caps how many concurrent invocations one SQS queue drives, so you can protect a downstream without throttling the function itself.
| SQS Standard | SQS FIFO | |
|---|---|---|
| Delivery | At least once; occasional duplicates | Deduplicated within the deduplication window (still make consumers idempotent) |
| Ordering | Best effort | Strict within a message group (e.g. per account) |
| Throughput | Very high | Lower per queue; batching and high-throughput mode raise it (check current quotas) |
| Failure impact | One bad message doesn't block others | A failing message blocks its message group until it succeeds or is dead-lettered |
| Choose when | Order doesn't matter, or can be restored downstream | Per-key ordering is a business requirement (e.g. sequential postings on one account) |
Transaction status state machine
G. Synchronous vs asynchronous API contracts
Not every transaction can be asynchronous. A real-time authorisation, a balance check before a trade, or an instant-payment confirmation needs a definitive answer now, and it stays synchronous unless the business contract changes. Everything else should default to async.
Asynchronous: accept, then complete
202 means "durably recorded and queued", nothing more. Repeating the POST with the same key returns the same correlation ID instead of creating a second payment.
Synchronous: bounded wait, explicit overload
Fail fast with 429/503 rather than letting requests queue until they time out. A 504 after the request was sent is an ambiguous outcome: retry only with the same idempotency key, and reconcile.
| Question | If yes |
|---|---|
| Does the caller need the business outcome before it can continue (and can't proceed on "accepted")? | Synchronous, with a bounded wait and reserved capacity |
| Can the business accept "we have it, the result follows within N seconds"? | Asynchronous: 202 + status endpoint or callback |
| Is the downstream occasionally slower than the caller's timeout? | Prefer async; if it must stay sync, add a circuit breaker and reconciliation |
| Is the operation a bulk or batch submission? | Asynchronous, almost always |
H. Observability and capacity validation
| Question | Signal (CloudWatch metric or custom) | Alarm idea |
|---|---|---|
| Are we accepting what arrives? | API Gateway Count, 4XXError (429s), 5XXError, Latency | 429 rate above the agreed shed level; 5XX > 0.5% |
| Are we completing what we accept? | Accepted vs completed per minute (custom, from the status store or EMF) | Completed < accepted for N consecutive minutes |
| How far behind are we? | SQS ApproximateAgeOfOldestMessage, ApproximateNumberOfMessagesVisible | Oldest message age > completion SLA (age beats depth) |
| Are workers saturated or throttled? | Lambda ConcurrentExecutions, Throttles, Duration, Errors | Throttles > 0 on sync functions; duration approaching timeout |
| Is a downstream struggling? | Per-adapter latency p50/p99, error rate, breaker state (custom) | p99 latency > budget; breaker open |
| Are we losing or parking work? | DLQ ApproximateNumberOfMessagesVisible, RECONCILIATION_REQUIRED count | Any message in a DLQ; reconciliation backlog growing |
How to actually prove 1,000 TPS
- Measure each downstream aloneFind each system's sustainable TPS and latency curve, and the point where latency turns non-linear, in a production-like environment, with the owners' agreement.
- Set budgets from measurementsPer-downstream rate limits and concurrency = measured sustainable capacity minus safety headroom (e.g. 20–30%).
- Check AWS quotasRegional Lambda concurrency, API Gateway throttles, and SQS/FIFO throughput for your exact configuration. Request increases before the test, not during it.
- Load test end to endRamp to 1,000 TPS with a realistic transaction mix, then hold it long enough to see steady state, then run bursts above it.
- Test the failure modesSlow one downstream, fail another, and confirm isolation, DLQ behaviour, alarms and reconciliation.
- Record the result as a measured numberOnly now does "1,000 TPS" stop being a design target.
I. Recommendation and roadmap
| If you observe… | Do this first | Not this |
|---|---|---|
| Ingress 429s while downstreams are idle | Raise API Gateway and Lambda limits; check quotas | Add queues (the bottleneck is elsewhere) |
| Queue age keeps growing | Find the binding downstream; isolate it; batch or partition if it supports that | Add more workers to a saturated legacy system |
| Timeouts on the sync path | Bounded waits, breaker, 429/503 shedding, reserved concurrency, reconciliation | Longer timeouts |
| Duplicate business effects | Idempotency keys end to end + conditional status writes | Switching to FIFO and assuming the problem is solved |
| One partner outage slows everything | Queue per downstream + bulkheads + DLQ | A bigger shared worker pool |
- Phase 1 · Make it observable (weeks 1–2)Accepted vs completed, queue age, per-downstream latency and errors. Baseline each downstream's sustainable capacity.
- Phase 2 · Make it safe (weeks 2–6)Idempotency keys, status store, per-downstream queues + DLQs, worker concurrency caps, adapter rate limits, timeouts and breakers.
- Phase 3 · Make it async where allowed (weeks 4–10)Introduce 202 + status/callback for operations whose contract allows it; keep a protected sync path for the rest.
- Phase 4 · Raise the ceiling (ongoing)Batching, caching of reference data, partitioning where the downstream supports it, and capacity work with system owners. Re-run the load test after each change.
Self-check quiz
Score: 0 / 0 answered