DynamoDB: How to model data that’s shared and queried by all users

database-designdynamodbnosqlpartitioning

I am very intrigued by DynamoDB, and it works incredibly well when I model the data for my main use case for my application. That being said, there is one specific use case that I can't wrap my head around.

Let's say I have users in a table, with the user id being the primary key. Most information is specific to the user. I want to be able to communicate with my users so I want the ability to make announcements to them. These announcements are shared across all the users. I can store user specific information about announcements in their own attributes like read and unread announcements.

The problem (if it's not clear already) is that there is only one set of announcements but they will be queried by every user frequently, leading to an anti-pattern of DynamoDB and potential throttling.

My initial thoughts are to make k copies of announcements and label the keys announcement_copy_1, announcement_copy_2 … announcement_copy_k, and then on the query to check for new announcements, I would randomly assign an integer 1-k to query the announcements. Each announcement copy would be the partition key and I would have sort keys with the date of the specific announcement, and attributes with the text and type of announcement.

I'm not confident if this is the best approach to this problem, or if I'm missing something. Also I am looking at going serverless with AWS Lambdas if that affects anything.

Thank you in advance for any suggestions or advice!

Best Answer

I'm intrigued as well. :) I have a use in mind that would likewise have userID as the PK.

Sounds like you could put an 'announcements.json' file in an S3 bucket, then have your application read announcements from that file.

S3 can handle 5,500 read requests per second, according to: https://aws.amazon.com/about-aws/whats-new/2018/07/amazon-s3-announces-increased-request-rate-performance/