Found two sneaky costs in @gumroad's AWS bill:
1. Since Rails 8.1, a worker in every preview app was stuck in an OOM-kill loop, burning CPU credits
2. Our Elasticsearch client logged every request and response body: half our log volume
With cleanup: ~$1.4k/mo, ~$17k/yr saved
We recently migrated ~1B email analytics records at @gumroad from MongoDB to DynamoDB. Zero downtime.
Query time: 861ms → 7ms
Cost: $1,378 → $207/mo (~$14k/yr saved)
The trick: single-table design with precomputed counters. A stats page is one read, not a count per email.
Canon abandoned my ~10-year-old LBP2900 printer on modern Macs. Claude compiled an open-source driver, inspected raw USB bytes, tracked down a one-line memory bug, fixed it, and got the printer working again.
One of AI's best tricks: bringing old hardware back to life.
Saved the next person some trouble:
https://t.co/OlnVILxKQk
@KuntashTweets@gumroad No GSI. All our reads are by post ID, which is already the partition key. We update the counters in the same transaction as each open/click, so they work like a materialized view.
We recently migrated ~1B email analytics records at @gumroad from MongoDB to DynamoDB. Zero downtime.
Query time: 861ms → 7ms
Cost: $1,378 → $207/mo (~$14k/yr saved)
The trick: single-table design with precomputed counters. A stats page is one read, not a count per email.
Found a cost leak in @gumroad's CDN. It kept a copy of every static asset per seller domain, keyed on the Origin header, and an edge function patched CORS per request.
Fixed the cache key, swapped the function for a free header rule.
Hit rate 5% → 95%. ~$11k/year saved.
@jpchidera@gumroad The counters could work in MongoDB too. The switch got us the rest:
Cost: we pay per request instead of running a 3-node cluster.
Latency: it sits next to our EC2 servers, reached over a private VPC endpoint. ~2ms reads.
Ops: no cluster to patch, upgrade or fail over.
We recently migrated ~1B email analytics records at @gumroad from MongoDB to DynamoDB. Zero downtime.
Query time: 861ms → 7ms
Cost: $1,378 → $207/mo (~$14k/yr saved)
The trick: single-table design with precomputed counters. A stats page is one read, not a count per email.
@shahidcodes@gumroad We dedupe per recipient. We only show unique counts, so each increment goes in the same transaction as a conditional put of a per-recipient marker. If a retry comes in after the first write went through, the condition fails, the transaction is cancelled, and nothing counts twice.
@jpchidera@gumroad The counters could work in MongoDB too. The switch got us the rest:
Cost: we pay per request instead of running a 3-node cluster.
Latency: it sits next to our EC2 servers, reached over a private VPC endpoint. ~2ms reads.
Ops: no cluster to patch, upgrade or fail over.
@shvfee@gumroad A Worker in front of S3 still pays S3 egress on every fetch, since Cloudflare is outside AWS. Avoiding that means moving the files to R2: petabytes, used by an app that runs on AWS.
S3 to CloudFront is free, so this was a small change instead of a huge migration.
Our video transcoder at @gumroad runs on Hetzner, so every video pulled from S3 was billed as internet egress: $935 last month.
Now it pulls via a signed CloudFront URL. S3 to CloudFront is free, and our private CloudFront pricing is far cheaper.
~$860/month saved, ~$10k/year.
We just moved all of @gumroad's Redis to Valkey and cut our ElastiCache bill by 69%: about $2.2k a month, or ~$27k a year.
Valkey is a drop-in fork of Redis that AWS prices 20% lower, and our app needed no code changes. Right-sizing and reserved nodes did the rest.
@jpchidera@gumroad The counters could work in MongoDB too. The switch got us the rest:
Cost: we pay per request instead of running a 3-node cluster.
Latency: it sits next to our EC2 servers, reached over a private VPC endpoint. ~2ms reads.
Ops: no cluster to patch, upgrade or fail over.
@dCodes03@gumroad We are mostly Rails, so the main app uses the standard redis gem (and Sidekiq). The Go part is just one small webhook service, on go-redis v9 built with CGO_ENABLED=0.
We just moved all of @gumroad's Redis to Valkey and cut our ElastiCache bill by 69%: about $2.2k a month, or ~$27k a year.
Valkey is a drop-in fork of Redis that AWS prices 20% lower, and our app needed no code changes. Right-sizing and reserved nodes did the rest.
Inspired by @dhh, we moved a high-traffic @gumroad endpoint from Rails to Go.
It only checks an email webhook's signature and queues a job, yet ran our full Rails app on 12 servers.
Go runs it on 3 smaller ones, in 11 MB of memory. 86% cheaper, saving about $14k a year.
Found a cost leak in @gumroad's CDN. It kept a copy of every static asset per seller domain, keyed on the Origin header, and an edge function patched CORS per request.
Fixed the cache key, swapped the function for a free header rule.
Hit rate 5% → 95%. ~$11k/year saved.
Our video transcoder at @gumroad runs on Hetzner, so every video pulled from S3 was billed as internet egress: $935 last month.
Now it pulls via a signed CloudFront URL. S3 to CloudFront is free, and our private CloudFront pricing is far cheaper.
~$860/month saved, ~$10k/year.
Inspired by @dhh, we moved a high-traffic @gumroad endpoint from Rails to Go.
It only checks an email webhook's signature and queues a job, yet ran our full Rails app on 12 servers.
Go runs it on 3 smaller ones, in 11 MB of memory. 86% cheaper, saving about $14k a year.
Over the last two weeks, we cut about $8.4k a month (~$100k a year) from @gumroad's AWS bill.
Several of the changes made things faster, not just cheaper. Here's what we changed. 🧵
@goncaloptomas@dhh@gumroad Yes, Sidekiq. Go only receives the webhook and pushes a Sidekiq-format job straight into Redis. Our Rails Sidekiq workers still process it, so nothing changed on the job side.