jeudi 24 septembre 2015

Amazon Dynamodb data modeling improvement

I am creating a simple messaging app to learn dynamodb. I am trying to create the most efficient model for my needs so I am trying to avoid global secondary indexes (extra throughput plus a 10gb limit on table sizes so I am avoiding these). As a result I have "denormalized a lot of the model". These are the apps functions and below is the data model I have created. I am trying to understand if there are better practices/more efficient ways to do what I am trying to do? Is there any problems I might face with my model? Are there any watch outs I need to be aware of? Is there a more efficient way to model this?

Register a user - A user will have to register providing a username, email, fullname, and password.

Login - A user will login using there username a password. This will generate a token and be sent back to the user (the token will also be stored on the database so it can be checked against requests to make sure it is the proper user).

Friends - Users can add friends and be add as a friend. Similar to Facebook, a user can send a friend request to a user, that user can then accept. The application needs to be able then to show to a user all of their friends and the status of their friendship, as well as show which users have tried to become friends with them. Users will be able to search for friends by username/email.

Messages - A user can send a message to one of their friends. The user can see all of the messages they have sent. As well, that user can receive messages from friends, and of course view a list of all their messages. I need to be able to distinguish a message which message is new and which are not:

Users
   Username (PK)
   Email
   Password
   Token
   FullName

FriendsFrom
    From (PK)
    To
    Status

FriendsTo
    To (PK)
    From
    Status

MessagesFrom
   From (PK)
   To
   DateCreated (Range)
   Message

MessagesTo
   To (PK)
   From
   DateCreated (Range)
   Message

EmailSearch
   Email (PK)
   Username
   FullName

Cheers




Aucun commentaire:

Enregistrer un commentaire