Amazon DynamoDB On Demand
aws.amazon.com
aws.amazon.com
- easier setup (a single setting instead of configuring auto scaling rules and policies for the table and all its indicies)
- possibly cheaper (depends on the not yet published details of the per-request pricing)
Does it mean auto scaling is no longer needed, or it won't happen in this mode (some hidden fixed capacity?)
Capacity planning is hard.
Quick math (us-east-1 North Virginia, reads, strong consistency):
1. Provisioned:
$0.00013 per RCU
1 RCU provides 3,600 reads per hour
0.00013 * 1000000 / 3600 ~= $0.036 per mln reads
https://aws.amazon.com/dynamodb/pricing/provisioned/
2. On-demand:
$0.25 per million read request units
https://aws.amazon.com/dynamodb/pricing/on-demand/
So AWS on-demand is more expensive if your read utilisation is higher than 14.4%. Not that exciting for any serious use-case.
Plus you can reserve DynamoDB capacity for a year and save ~56%: (30 + 0.0025 * 24 * 365) / (100* 0.00013 * 365 * 24 )
The great thing about it is that it helps with spiky and sporadic workloads. In my current work I have a bunch of unit tests that hit a set of dynamodb tables. I have those tables provisioned at a 5 RCU and 5 WCU each. Multiply this by ten tables and I'm paying $25 per month. In the grand scheme of costs, this isn't much, but it's annoying and adds up. (One can argue that unit tests should be hitting a mock or a dynamodb local. That's true, but you also want some tests that actually hit the service.)
On demand can be great for sporadic tests, for prototypes, for small personal projects, and for just messing around.
There are also spiky non-customer-facing production scenarios that can benefit from On demand.
Provisioned: $0.00065 per WCU. One WCU is 1 write per second for an hour = 3600 writes. So 277 WCU is 1 million writes in an hour. Cost is $0.18 per million write requests. (If you reserve this for a year it's $0.08 per million write requests.)
We generally run our tables with autoscaling set to 70% of capacity, so at $0.18 per million write requests our effective cost is $0.25 per million write requests. A good deal cheaper than on demand.
We have a few tables where we run closer to 30% of target capacity because of hot shards. There our effective cost is $0.60 per million write requests, which is still cheaper than on demand (assuming on demand doesn't have the hot shard problem).
I'm having trouble understanding when this would be beneficial.
In some cases I've seen, autoscaling can manage going from ~500 to 10k WCU without heavy throttling (as the burst capacity can handle the five~ten minutes before autoscaling kicks in), but not with a smaller baseline. On tables with hot shards, the baseline usually has to be higher.
Probably also useful for multi-tenant apps like web analytics. One cannot possibly predict the workload.
But I feel the on-demand mode should be best accompanied with the provisioned mode, which is the hybrid mode. So instead of using the laggy autoscaling to handle the burst traffic, using the on-demand capacity to serve that.
Disclosure: I work for Alibaba Cloud and use Alibaba Cloud Table Store which provides the hybrid mode ( https://www.alibabacloud.com/help/doc-detail/27291.htm )