3 questions to ask when deciding between a relational DB and DynamoDB for your project
To DynamoDB or not to DynamoDB. That is the question. Here's 3 more questions to ask (and make a decision).
Choice of persistence stores has an outsized impact on project design.
Having architected many projects for the cloud, I've wrestled with “which persistence” too many times to count. But it is a decision that needs to be made early and thoughtfully.
Applying these 3 questions quickly narrows down the choices.
1. Is the domain model highly normalized and relational?
While most developers will automatically say yes, they're wrong.
In my experience, this is very rare. These designs are usually because of a team's existing relational experience and mental models. Not actually because the domain needs it.
But, if your domain really is highly normalized data, don't think twice. Go relational.
2. Is it cloud native?
If your project isn't already taking advantage of cloud native features, forcing in Dynamo might bring more pain than value. Think traditional web frameworks with built-in ORMs, apps on steady EC2 servers, and similar designs.
On the flip side, if you're already living with fine-grained IAM permissions, async processors off SQS, or highly variable connections (like Lambdas spinning up and down), Dynamo will fit right in.
3. How well do you know the access patterns?
DynamoDB shines when you use access-patterns-first design.
Always start with access patterns. If you don't know them, figure them out. If you can't, because they are truly unknowns, choose a relational DB.
Starting with access patterns will lead to a very different design than data model first.
And often times forcing a decision about the access patterns leads to changes in the application design. That's a good thing.
Notice, I didn't talk about cost, scaling, or high-availability requirements. More often than not, the prior three questions bring an answer before bridging these topics. But if you're still on the fence, those are the next design decisions to make.
Drop a comment if you've struggled with the decision or have different criteria for picking persistence.
This was the Day 21 #ship30for30 #atomicEssay.
#crossPost #dynamodb #aws #serverless
Thanks for reading. If you enjoyed the article subscribe via RSS feed or enter your email in the box below 👇