I am new to Couchbase, I would like to understand how to model storing billions of chat messages originating from a typical IM app in Couchbase. What would be the correct way to model this in Couchbase? Assume 10000 new messages/sec inserts and 40000 updates on these 10000 messages/sec. Assume, one to one chat as the primary use case, although each person would have many buddies - pretty much like Whatsapp
Thanks, appreciate all feedback.
**Update: **
Thanks for your reply, here is my database design:
Sample data store on Couchbase (document store):
document User:
123_user => {"id" : 123, "friend_ids" : [456, 789, ...], "session": "123asdcas123123qsd"}
document History Message (channel_name = userId1 + "-to-" + userId2)
123-to-456_history => {"channel_name": "123-to-456", "message_ids" => ["545_message, 999_message, ...."]}
document Message:
545_message => {"id" : 545, client_id : 4143413, from_uid : 123, "to_uid" : 456, "body" : "Hello world", "create_time" : 1243124124, "state" : 1}
there is problem here, when message_ids field on History Message store million or a billion message ids, this is really a big problem when reading and writing messages history. Can anyone give me a solution to this problem?