3

I am building a website with Asp.Net MVC 4 and C#, hosted in VPS. The site has lots of sharing comments/replies features (I need to store a lot of comments). I was planning to use MongoDB as its free and also very suitable for storing blogs/comments, but got a little hesitant after I read this article.

So now I am thinking of using MongoDb for storing comments and replies and SQL Server Express version with 10GB limitation for storing user accounts and other user profile data.

Is it okay to use 2 different databases like this in one web app? Or is there any other stable documents database similar to MongoDb that I can use and don't have to use SQL server ? Is RavenDb an option ? Thanks in advance !

1
  • @Jonathan that question is about Rails and Ruby gems. I don't think it applies here (to a question about ASP.NET MVC). The answers there won't help OP. Commented Jun 6, 2016 at 20:43

1 Answer 1

2

Yes, it is okay to use two different databases in one web app. Even more - it's very good to do so, as every type of database has it cons and pros and they are never fit to do every job. You've probably chosen MongoDB because you've heard it's quite good for storing lots of data and heavy quering. This is mostly true but there are some caveats. On the other hand, SQL Server can be much slower (depends on exact workflow), and can be easily overloaded with heavy writes.
First of all - it does work well. Mostly. It tries as hard as it can, when on heavy load. But it's not as write efficient with parallel writes (because of heavy use of locking) as some others and it's not "very-safe" if you have to keep some collections or documents synchronised - e.g. SQL transaction, that does lots of stuff in different tables, as mongo does not give you anything more than document-level transactions (every change on single document is atomic).
There are other stable documents database, e.g. look at CouchDB - it's more write-oriented and has some funny possibilities thanks to Multi-Version Concurrency Control.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks ! i am thinking of storing posts/comments on NoSql Database.Do i need to store a copy in Sql database as well , for backup? i was looking at RavenDB but they are not free :( . I am looking into redis now.Has anyone has any experience using redis with .Net in a large volume scenario ? Thanks !
You don't need to - you may. It just depends on your workflow, still - that way you would just use the NoSQL DB for caching, which kinda asks for using cache instead of NoSQL DB. Because you want to do some edits on the final data (like: posts), I wouldn't recommend keeping backup in MySQL, rather use NoSQL DBs backup facility. It would have cleaner design, then.
Thanks, one last thing,i was hoping to use nosql for first and last name look ups ,do you think using cache is a better idea ? I wonder if i have thousands of users, do you think that would be a problem ?
Or when you said cache, you meant something like memcache ?
Depends on the data ;) if you'd like to query them and edit them, it's just much better to do this in one place, instead of two DBs. For lookups of names and last names? It depends, probably - a dictionary DB or something with full text search? (depending on your exact needs) - Mongo does not give you FTS. Yes, I was referring to something like memcached (but not exclusively).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.