Monzo Bank reduced costs on TTL from time series index tables in Amazon Keyspaces by using bulk deletes to eliminate the use of TTLs.
Monzo's event index table indexes events on its platform over time with a large volume of events flowing through its platform.
Using the TTL feature for many years proved to be expensive for Monzo as the write throughput increased with the bank's growth.
Monzo used a bucketing mechanism to efficiently distribute rows across multiple tables for dynamic dropping of old tables and creating new tables as needed.
Table management code was needed to be written for creating, dropping and scaling tables and sharding code was written for routing queries.
Amazon Keyspaces recently lowered its TTL cost by 75%, yet this pattern can save even more costs.
Monzo slowly ramped up dual-writing to the new index table in shadow mode to test the suitability and production readiness of the write path.
Finally, all of the rows in the old index table expired because of their Time to Live settings before we could transition to the new index table fully.
The new sharded index table has been running in Monzo's production environment without issue for several months.
Code complexity was introduced as a result of this change, but Monzo believes that the cost savings are worth the added complexity.