Graph
Cases3 cases
1 to 3 of 3
IL-0308Most RevenueCat backend systems failed after cutover to a new Aurora PostgreSQL 14 cluster as queries became very slowRevenueCat2022- Symptoms
At 9:34 UTC on November 23, 2022, RevenueCat started moving traffic from its Aurora PostgreSQL 10.x cluster to a new Aurora PostgreSQL 14.x cluster. By 9:39 UTC all traffic was on the new cluster, latency was bad, and the RevenueCat dashboard and the endpoints used by the RevenueCat SDK stopped working.
- Trigger
At 9:34 UTC production traffic was switched from the Aurora PostgreSQL 10.x cluster to the new Aurora PostgreSQL 14.x cluster, before ANALYZE had run on its largest tables.
- Root cause
- Component
- Contributing factor
- Detection
At 9:39 UTC, with all traffic on the new cluster, latency looked bad and the infrastructure team began to investigate.
- Remediation
- Added a statement timeout to the database user so queries could not hold a connection too long
- Shed 90% of traffic by returning 503s from the load balancer
- Dropped indexes that the planner was using wrongly and that were not needed
- Stopped accepting Apple webhooks for a time
- Rolled out a release without New Relic to stop its EXPLAIN queries
- Ran ANALYZE by hand on the biggest tables
- Raised the values of the affected primary key sequences with a prepared script
- Stopped the integration event dispatcher by hand
- Replayed the webhooks that were dispatched but not recorded
- Restored integration event dispatching, ETLs and other non-web server jobs
- Action items
- Consider change freezes during business-critical periods
- Explain better how the SDK behaves during backend outages
- Tell customers about maintenance and outages in the developer dashboard and by direct email to technical contacts
- Replay a subset of write traffic in migration dry runs to mimic the cutover
- Move costly processes to asynchronous work to keep the API fast and stable
- Re-evaluate table indexes, including unused ones the database may choose for queries
- Show the load of each endpoint and system in the database dashboards
- Involve support and customer communications staff during outages
- Lessons
The new cluster had not been analyzed, and the tests missed it because the test cluster had been up long enough to gather statistics. Dry runs replayed no write traffic, on the belief that writes are simpler than reads, and the team assumed sequence state was replicated with the data. Rolling back at the start would have been better than fixing forward. The migration, timed to finish before Thanksgiving and Black Friday, should have been delayed until the week after, because the US had entered a sensitive period and part of the US support team was already on holiday.
IL-0311BattleMetrics' primary PostgreSQL went read-only at transaction ID wraparound, breaking the website and RCON updatesBattleMetrics2022- Symptoms
At 03:23 UTC on 27 March 2022, BattleMetrics' primary PostgreSQL database, which holds all account, server and player information, went into read-only mode. Users first saw the website fail to load, and soon RCON updates and queries began to fail as well.
- Trigger
A corruption of the index on the player identifiers table, which BattleMetrics' logs place at about 26 February 2022, made every vacuum job fail, so transaction IDs kept climbing until Postgres stopped accepting writes on 27 March.
- Root cause
- Component
- Contributing factor
- Detection
Users failed to load the website and reported it as their API keys expired, then RCON updates and queries began to fail, and the team found that the main database no longer accepted writes.
- Remediation
- Shut the database down and dropped the corrupted player identifiers index in single-user mode
- Ran the vacuum again, which succeeded and let the database accept writes
- Rebuilt the player identifier index, which took about two hours
- Shut down the query workers and gave RCON updates priority
- Pointed services at the new Postgres primary
- Bootstrapped new replicas one after another to take load off the primary
- Restarted queries with throttling, prioritised by server population and rank, after RCON updates had caught up
- Action items
- Monitor errors in the Postgres logs
- Monitor and alert on transaction IDs
- Set up a logical replica in addition to physical replication
- Build a faster network to speed up recovery from failure
- Lessons
BattleMetrics names skipping health checks on transaction ID size as its critical mistake: the index corruption silently broke vacuum for a month, and without monitoring of transaction IDs nobody saw the database approach wraparound. Because the corruption had been replicated to the replicas, failing over did not help, and the backup servers and downloadable backups carried the same corruption. The team also found that, contrary to the error message, a full vacuum on a server in wraparound protection does not need single-user mode, and chose to run a slow, delayed service over no service while replicas were rebuilt.
IL-0456Inflearn went down six times during a January 2022 free-course event as slow queries piled up on Aurora PostgreSQLInflab2022- Symptoms
During a 100% discount event that made 125 courses free, Inflearn received 5 to 20 times its normal traffic, and on four days, 3, 4, 7 and 17 January 2022, the service became unusable around 9 a.m. and 10 p.m. There were six outages in all.
- Trigger
A 100% discount event on 125 courses, from 3 to 17 January and 18 to 24 January 2022, went viral and brought 5 to 20 times the usual traffic.
- Root cause
- Component
- Contributing factor
- Detection
The team followed the outages through hourly transaction counts, RDS metrics, monitoring and slow query alerts.
- Remediation
- Added an index to the interested-companies query on the course page
- Changed how often the cache data stored in the database was reset and regenerated
- Moved the read queries that loaded the writer DB to the reader DBs
- Scaled the database to 8 r5.8xlarge instances, which bought only a few tens of minutes
- Rewrote slow course queries or added indexes so they use indexes, and switched off features whose queries could not be fixed
- Removed the large course description column from the select * course queries
- Split the IDs of the IN clause into batches of 20 run with Promise.all
- Upgraded PostgreSQL from 10.16 to 11.13
- Set a 5-second query timeout
- Raised max connections
- Ran VACUUM by hand on the course table
- Moved the large course description column into a separate table
- Action items
- Change the structure in which one table's failure spreads to the whole service
- Improve the table and cache structures that are hard to tune
- Make the SQL code easier to follow
- Improve code that gives no confidence to change, such as code without types or test code
- Build a stable batch environment
- Keep a monolith of reasonable size and separate the domains through which failures spread most
- Lessons
Because every database bottleneck appeared as slow queries on the reader DBs, watching only the readers hid the root cause on the writer. In PostgreSQL, frequent updates to a table with large columns produce large dead tuples in bulk and slow every query on that table. Before the second event the team could not run a meaningful performance test because the first week showed that almost any page could fail under load. The event exposed high sensitivity to failure in every area, one table's failure spreading to the whole service, hard-to-tune table and cache structures, unintuitive SQL code, code without types or tests, no stable batch environment, and many hidden failure points not yet found.
These 3 cases involve PostgreSQL vacuum and Database. kubegap audits a Kubernetes cluster for gaps like these, read-only, from Claude Code or Codex; its checks cite public reports like the ones in this library.
By root cause3
Breaking change in an upgrade1 case
- Component
- Contributing factor
- Organisation
Data loss or corruption1 case
- Contributing factor
- Organisation
Capacity exhaustion1 case
- Component
- Contributing factor
- Organisation