Feb 02, 2017

Implementing CHAT system with MongoDB Atlas

A CHAT application enables users to send and receive messages from other users. The messages are usually text based but the application should be able to support different media types like Videos, Audio, images etc. In the following article, I will focus on data storage aspects of a real time CHAT application. I will explain the various considerations behind selecting a data store for a real time CHAT application and how we

Choosing A Data Store

These were our main goals & expectations for a data store :

  • 1. To move away from RDBMS.
  • 2. Move towards a NoSQL solution with - 
    • a. Flexible schema.
    • b. Horizontally scalable to meet increased load.
    • c. High performance.
  • 3. Easy maintenance.
  • 4. Resilient and quick recovery.
  • 5. Monitoring.

RDBMS with their normalized storage structure, licensing cost and transactional, locking feature did not seem to fit into our idea of a solution with can support large DB ops/sec with minimum latency. Flexible schema helps with evolving requirements and new features. Data store maintenance like backup, restore , scaling up etc. should not be a ton of work.

What We Choose:

MongoDB
     

MongoDB Atlas - A software-as-a-solution version of the well known popular document based NoSQL database.

Why We Choose MongoDB Atlas:

  • 1. Hosted service. No upfront investment in hardware or need to have a NoSQL DB Administrator to setup the cluster.
  • 2. Flexible schema, document based storage with support for social media features like tags, likes, comments etc.
  • 3. Ability to easily scale up or across by either increasing the machine configuration or by adding additional shards.
  • 4. Data locality supports fast data retrieval and storage.
  • 5. Automated backup, data snapshotting and one click restore.
  • 6. High availability with automated failover and recovery.
  • 7. Automated minor version upgrade of the MonogDB cluster.
  • 8. One click upgrade for major versions.
  • 9. Dashboards visually representing various system and database level metrics. These metrics are automatically archived to provide a historical overview of the sytem health and performance.
  •  
  • 10. Alerting based on host, network and database level metrics.
  • 11. Integration with other third part tools like SLACK and Pagerduty for alerting.
  • 12. Access to MongoDB enterprise support.
  • 13. Cluster security using TLS/SSL Encryption, authentication, authorization, IP whitelisting etc.
  • 14. Pay as you go model.