In a world dominated by Oracle and mySQL, we now have quite a few good contenders (Yes, dynamodb too..) challenging the status quo of these database giants. Albeit slow pace, these new players, many riding the cloud waves, have already gulped down sizeable market share from traditional relational databases.
DynamoDB
USP – managed NoSQL service, multi-region database, robust performance, high consistency, ease of use, cloud database, in-memory caching
Not suits – hybrid cloud infrastructure, data masking
Application Domains – mobile, IoT, Scalable low-latency applications, gaming, recommendation engines, microservices and serverless application
Leading the pack is MongoDB, whilst others like Redis, Cassandra, DynamoDB and neo4j are not to far behind. This article is dedicated towards introducing you to Amazon’s DynamoDB and help you in contemplating “if this is what your next project requires”.
Here is what we would be discussing in this article-
- What is DynamoDB? NoSQL vs SQL.
- DynamoDB use cases
- Should you consider DynamoDB for your next project?
- DynamoDB architecture design
- DynamoDB CRUD examples
- Connect with Codewave
What is DynamoDB? No – Brainer introduction for the CXO
Amazon DynamoDB is a cloud-based fully managed proprietary NoSQL database service. Fully managed service means you’ve the much required time to focus on core business concerns rather than IT management chores.
NoSQL databases could be categorised into key-value, columnar, graph and document store DB. DynamoDB, offered under the umbrella of AWS (Amazon Web Services), is a multi-model database as it supports key-value structure as well as document store type.
DB-engines ranks DynamoDB to be the 18th most popular database among enterprises and IT professionals. And why not, afterall DynamoDB can handle more than 10 trillion requests per day and can support peaks of more than 20 million requests per second.
Additionally, it has built-in security features which ensures your data is secure, provides multiregion backup and restore to keep your data safe, and also has in-memory caching to boost performance and scalability for internet-scale applications.
DynamoDB is under use by exponentially growing businesses and startups like Snapchat (snapchat stories), Lyft (ride tracking) and Airbnb, as well as well-established giants like Samsung (mobile app backups) and Toyota.
DynamoDB use cases
Ad Tech
To store marketing data, such as user profiles, user events, clicks, and visited links. In-memory caching could be used to store popular items, a game changing feature for ecommerce and dropshipping businesses.
DynamoDB can be used to store user events, clickstreams, and impressions data stored can be exploited for personalised ad targeting. DynamoDB Accelerator (DAX) adheres to enterprises that need high read volumes or submillisecond read latency.
Gaming
In the gaming industry, DynamoDB use cases could be to store game state, player data, session history, and leaderboards. DynamoDB is a fit for gaming applications because of its scalability and low latency features. So, when your gaming app’s customer base explodes to millions within a day, you would still be focusing on enhancing the game features and gamer’s experience. You would not have any overhead of maintaining the database as it’s fully managed cloud database. You need not worry about latency as it will still be in milliseconds.
Video Streaming & Content Delivery
For media and entertainment companies reliability, throughput, concurrency and latency are critical factors in serving content. With DynamoDB as the database video streaming agencies maximize their time investment in feature development and barely have to worry about database management. When viewers count spike to millions within seconds, DynamoDB scales elastically and maintains low latency with high concurrency.
Retails & Ecommerce
DynamoDB is powering up shopping carts, simplifying inventory management and user management for big as well as rising players in retail and ecommerce. Again, auto scalability, auto down-scaling, low latency, high concurrency of DynamoDB imparts magnitude of competitive advantage to clients. It minimizes the operational overheads and enables the company to save huge on database costs as they only pay for the capacity they use.
Banking, Finance & Insurance
Financial companies have the need to ensure least response time when a customer requests for a service, release new features at a regular interval to keep up with the competition. They need to be highly reliable, highly secure and available round the clock. With time it’s obvious now that legacy mainframe system fails to match up with rising business needs to match customer expectations. DynamoDB is used in these institutions for fraud detection purpose, user transactions, traffic offload by replicating data from the mainframe to the cloud, event-driven transactions etc.
![dynamodb use cases architechture and crud examples](https://res.cloudinary.com/codewavetechnologies/image/upload/q_auto:eco/v1571144938/Lambda_StreamProcessing-min.png)
Should you consider DynamoDB for your next project?
Assessing if DynamoDB ticks all the boxes to be the database for your existing/new application?
DynamoDB is a must consider Database if your application is in active development and/or if following could make your application better –
- high availability
- high data durability
- auto scalability
- auto down-scaling
- OLTP workload
- High-performance read/write
- Low operational overheads
DynamoDB architecture design
![dynamodb architecture and crud examples](https://res.cloudinary.com/codewavetechnologies/image/upload/q_auto:eco/v1571144939/example_game_architecture_using_dynamoDB-min.png)
Image Source – AWS Blog
This is how one of the most popular gaming app company (10M+ downloads) leveraged dynamoDB as database to power their application.
DynamoDB CRUD examples
dynamodb = boto3.resource('dynamodb',aws_access_key_id=AWS_ACCESS_KEY_ID,aws_secret_access_key=AWS_SECRET_ACCESS_KEY,region_name=AWS_DEFAULT_REGION)
table = dynamodb.Table(YOUR_DYNAMODB_EXISTING_TABLE_NAME)
//Insert an Item into DB
insert_Item = table.put_item(
Item={
'primary_key': primary_key_value,
'sort_key': sort_key_value,
'atrribute_1': atrribute_1_value,
'attribute_2': attribute_2_value,
})
//Update an item
update_Item = table.update_item(
Key = {
'primary_key': primary_key_value,
'sort_key': sort_key_value
},
UpdateExpression = "set atrribute_1 = :value1, atrribute_2 = :value2 ",
ExpressionAttributeValues = {
':value1': atrribute_1_updated_value,
':value2': atrribute_2_updated_value,
},
)
//Read an item
read_item = table.get_item(
Key={
'primary_key': primary_key_value,
'sort_key': sort_key_value
},
ProjectionExpression = "attribute_1, attribute_2, attribute_3",
)
//Delete an Item
response = table.delete_item(
Key={
'primary_key': primary_key_value,
'sort_key': sort_key_value
},
ConditionExpression="attribute_1 <= :val",
ExpressionAttributeValues= {
":val": conditional_value
}
)
Stay connected to Codewave for more such insights and feel free to reach us at hello@codewave.in or +91 8971824910. If comfortable you may drop by at 1st Floor, Shree Chambers, #307, Outer Ring Rd, Banashankari 3rd Stage, Bengaluru, Karnataka 560085. Thanks for taking out time to read this article. We hope it enriched your existing knowledge. Do let us know your views, by sending an email to hello@codewave.in.
FAQ
What is DynamoDB
Amazon DynamoDB is a cloud-based fully managed proprietary NoSQL database service. Fully managed service means you’ve the much required time to focus on core business concerns rather than IT management chores.
What are the advantages of DynamoDB?
DynamoDB Benefits include : multi-region database, robust performance, high consistency, ease of use, cloud database and in-memory caching. Dynamodb is a cloud-based fully managed proprietary NoSQL database service availed by AWS.
DynamoDB vs MongoDB – which is better?
Depends on use-case. NoSQL databases could be categorised into key-value, columnar, graph and document store DB. AWS (Amazon Web Services) DynamoDB , is a multi-model database as it supports key-value structure as well as document store type.
Is DynamoDB fast?
AWS Dynamodb database as a service is popular for low latency and high consistency. Dynamodb is fast and can be used for mobile, IoT, Scalable low-latency applications, gaming, recommendation engines, microservices and serverless applications.