2

Actually, I am developing a messaging app and use cassandra as a database and kafka as a message broker.

My question is: Do I need to store the messages between users in cassandra? If I do so, then size of my database will grow really fast.

As I am using a messaging queue, the messages are stored as long as these were not delievered. I have heard, that messaging apps (such as Facebook Messanger, WhatsApp) does not store the message content between users in a database, but only use a queuing system (XMPP, MQTT) which deletes messages as soon as they are delieverd. So no need for storing in external database. Am I right?

What is best practice? Besides, do I need to store the messaging content from the legal perspective (government or the like) for a period of time (for example, 2 years)?

Looking at http://www.planetcassandra.org/apache-cassandra-use-cases/, there are a lot using cassandra as a database backend for messaging apps. However, it is a antipattern to use cassandra as a message-queue (see cassandra docs).

nimo23
  • 5,170
  • 10
  • 46
  • 75

1 Answers1

2

Using Cassandra as a queue is clearly an anti pattern

However Cassandra is a good fit to store messages, read my blog post on KillrChat: http://www.doanduyhai.com/blog/?p=1859 for a possible data model for message storage

doanduyhai
  • 8,712
  • 27
  • 26
  • I know that storing messages in cassandra is good. However, do I really have to store the messages? For what? Am I forced to store the messages (for government or the like). Can anyone tell me uses cases for what I need to store the messages? I dont want to waste money for what I dont really need. – nimo23 Mar 10 '16 at 13:39
  • If you need a **queue**, Cassandra is not a good fit. If you need to store messages and keep them for a determined period of time ( a month, a year, ...) Cassandra can do the job. Just decide based on your business usage – doanduyhai Mar 12 '16 at 22:28