I was thinking in a very simple Twitter-like app, I was considering support just twits and the time line.
But my head, pretty much used to relational models… cannot come up with an reasonable model in Azure tables or noSql. Basically, I was thinking in:
- A user can add other users as
friends. - A user can write messages (up to 200
characters). - Messages are always shown ordered by
time, the newest the first. - The user page shows his last 20
messages. - The main page (time line) shows the
last 20 messages from him and his
friends.
Pretty simple 😀
If I put all messages in a single table, and I put the userId as partition key… everything is easy, BUT … I don’t think that that solution scales very well. But other solutions make the time line page very complex or very unefficient, because it’s not about get the latest 20 messages from every of your friends, it’s about get the latest 20 from all together… and that is blowing my mind. It could be that you have a very annoying friend and the latest 20 messages are from him 😀
What could be a scalable and efficient way to store this information in a Azure tables fashion?
Thanks in advance.
I’d say using Azure Table Storage alone isn’t enough. You should use Azure Queues as well.
When a message comes in it gets put in the queue. A worker takes the messages from the queue and processes them.
It seems like this might be a wasteful method but you’re optimizing for read performance with eventual consistency on the writes. Removing joins from the read side simplifies things.