Dual write vs outbox

A dual write saves the row and then sends the event as a second step, so a failure between the steps loses or delays the event. An outbox saves the event in the same transaction, and a relay sends it. When the read view stops for 5 s, the dual write leaves 39,155 mismatched reads. The outbox passes.

Play the level

An order and its event commit togetherTap to turn the outbox on or off

Outbox · 10 orders · 10 events · 0 lost

Delivered twice, charged onceTap to turn the ID check on or off

13 deliveries · 10 payments applied · 0 charged twice

Case 1

The order database takes 250 commits/s for 40 s. Its read view stops from 0:15 to 0:20. Mismatched reads must stay below 1,000 and update age below 8 s.

Case 1
Measure Goal Dual write Transactional outbox
Data mismatches (Reads) under 1,000 39,155 Fail 599 Pass
Data age under 8 s 79.9 s Fail 5.2 s Pass
Monthly cost 24 USD/mo 24 USD/mo
p99 latency 23 ms 23 ms
Error rate 6.3% 6.3%
SQLHTTP/2gRPCgRPCUsersUsersPostgres2 vCPU · 2 GBSearch index2 vCPU · 2 GBChange capt…2 vCPU · 2 GB
SQLHTTP/2gRPCgRPCUsersUsersPostgresSearch in…Change ca…
Dual write: misses a goal
SQLHTTP/2gRPCgRPCUsersUsersPostgres2 vCPU · 2 GBSearch index2 vCPU · 2 GBChange capt…2 vCPU · 2 GB
SQLHTTP/2gRPCgRPCUsersUsersPostgresSearch in…Change ca…
Transactional outbox: meets the goals