How to implement chat application in C# MVC?

Is MongoDB good for chat implementation?

  • I'm trying to implement a chat application. Is it optimal to use MongoDB? Should I use MySQL or other database systems? Do I get any performance benefit in my chat application if I use MongoDB?

  • Answer:

    (via a2a) There are chat clients, and there are chat servers. In both cases, depending on your requirements, MongoDB would be ok, but would likely be a poor choice out of the alternatives available. The ideal solution for a database is one that stores the data that the application needs to store, provides the -ilities (scalability, reliability, availability, serviceability, etc.) that the system requires, and does a good job providing easy answers to the questions that the application has to ask in order to get the data it needs. For that last question, whether the database can answer those questions, and does a good job at it, you're probably better off (for most applications) with a structured database, e.g. MySQL (or MariaDB if you don't like Oracle). MongoDB is intended for largely unstructured data, or data whose structure morphs often; neither appears to be true for chat applications. For the sake of full disclosure, I work at Oracle. The opinions and views expressed in this post are my own, and do not necessarily reflect the opinions or views of my employer.

Cameron Purdy at Quora Visit the source

Was this solution helpful to you?

Other answers

Big question here is "why are you writing your own chat application?" There are dozens of large-scale chat applications, many have APIs. There's always IRC. This is really a "solved" problem, so I want to be really clear about your motivation for building your own chat. Do I get any performance benefit in my chat application if I use MongoDB? Probably not. One of the key features of Chat is being able to quickly commit to the DB and then cascade that write to other listeners. MongoDB and MySQL are actually both kind of weak at this. If you're looking for good chat features, take a look at what Firebase does, they even have a 30-line chat example: https://github.com/firebase/firechat. Also Redis has a Pub/Sub model that makes this easier as well. (just Google for example, there are dozens)

Gaëtan Voyer-Perrault

Since you've already explained that you can't use third party products for security reasons, I'd probably look to Redis first and Mongo second if I found that Redis didn't meet my needs. Redis will be quicker to work with, but mongo will give you more powerful query features down the road if searching chat history is something you're after.

Ryan Quinn

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.