A customer was considering leaving #dynamodb due to costs.
@pj_naylor and I helped them save half a million dollars per year with one simple, magical, optimization.
Want to save DynamoDB costs like a pro? Let’s start with some background…
1\ DynamoDB writes are 20x more expensive than reads. If you have 5 GSIs, you may be doing 6 writes every time you write a single item into a DynamoDB table.
The 20x is not a typo. More on that soon.
2\ The read & write request units are a bit complex. Let’s simplify, @momentohq style.
DynamoDB writes are charged in 1KB increments.
If you write 100 bytes, you pay for 1KB. 1.1KB => 2KB.
#DynamoDB strongly consistent reads are magical, but not for the reason most of us think.
SC reads have higher latencies, lower availability, and cost more - but worth it if you use them for the right reasons.
🧵👇explains what they are & how to unlock their real power!
0\ Primer: Doug Terry does a phenomenal job explaining the various consistency models through an illustrative exercise: microsoft.com/en-us/research…
Read this first to become a consistency ninja!
1\ The most common mistake I see with DynamoDB SC reads is assuming it’s fresher than it is. Suppose you want to increment a counter: an SC Read tells you X=2 - you *cannot* set X=3 because another thread may have already changed it in the meantime. Use Conditional Puts instead!