To learn more about Hadoop and Big Data visit free tutorials website -
Wednesday, 4 December 2013
Big Data Mind Map
Sunday, 17 February 2013
AWS Quick Facts (Amazon Web Services Best Practices)- DynamoDB Best Practices
To learn more about Hadoop and Big Data visit free tutorials website -
What is the difference between Hash Key and Range Key?
AWS supports two types of primary keys. Hash Key and Range Key. DynamoDB creates unordered hash index on Hash primary key while it creates sorted range index on range primary keys.
Hash Keys as the name suggests must be unique and can be used efficiently.
While range keys does not need to be unique. But combination of Hash and Range key has to be unique.
So while doing your database design, you have to be very careful with the selection of Hash and Range Keys.
Sample Data Model of DynamoDB
What all Data Types are supported by DynamoDB?
DynamoDB Supports scalar(Number, String , Binary) and multivalued(String sets , Number sets and Binary sets) data types.
Does DynamoDB Supports cross table joins?
NO.
What are conditional writes?
In multi user environment it likely possible that a certain field is updated by multiple users at same time. In order to avoid this, DynamoDB Supports conditional writes, means it updates a particular field only if its value is unchanged in the DB since the time it was read.
What is Provisioned Throughput in DynamoDB?
While creating a Table in DynamoDB you are supposed to give some numbers about the maximum read and maximum write throughput. These are nothing but the resources allocated by DynamoDB for your operations.
Capacity Units required for writes = Number writes per second * Size of each write
Capacity Units required for eventually consistent reads = Number reads per second * Size of each read
To get approx requirement for your application read and write throughput, you should calculate these number while doing load testing of your application.
How to manage ProvisionedThroughputExceededException?
Sometimes if the traffic on dynamodb increases and if it exceeds the maximum set read and write throughput then dynamodb throws ProvisionedThroughputExceededException.
AWS SDK provides auto-retry on such events when configured through client configuration.
Sample code to set max auto-retries.
// Client configurations
final ClientConfiguration cfg = new ClientConfiguration();
// Using AWS SDK for error retries and exponential back-off
cfg.setMaxErrorRetry(3);
client.setConfiguration(cfg);
To learn more Read AWS SDK code for AmazonHttpClient and DynamoDB Backoff Strategy
It is also recommended to implement such exponential backoff strategy in case customized for your application.
What is the difference between Scan and Query Operation?
Query operation only searches on primary key while scan operation searches on complete table. There is a limit of 1MB for scan operation.
For more details, you can check out book Mastering DynamoDB by Tanmay Deshpande.
Subscribe to:
Posts (Atom)