Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can SQL Server and Mongo be used together?

We have a large news-oriented site that has high web traffic. The architecture is your often seen DB - Repo Layer - Services Layer - Asp.Net MVC. The problem that we've been seeing is around read performance. It turns out that all this DDD domain object stuff is great, in theory, for business rules, but has made life harder when it comes to optimizing read performance.

As a solution, I'm considering something entirely new (for us): using noSQL. I'd like to use a noSQL database for data being presented on our website. We can't get rid of our SQL Server (at least not anytime soon), but it seems to me that a practical step would be to use Mongo as a query database for all new development.

My question is whether it is possible to use SQL Server as your database of record and Mongo as your query database together and if so, what technology/technique would you use to update updates? I'd like Mongo to be refreshed ever 15 minutes.

like image 688
John Avatar asked Dec 19 '11 18:12

John


People also ask

Can we use SQL and MongoDB together?

Now that SQL Server can understand and shred JSON data, SQL Server and MongoDB can easily cohabit and pass data between them.

Can you use SQL and NoSQL together?

Using a NoSQL database doesn't mean you can't use SQL; SQL is just the query language. In fact, NoSQL and SQL can be complementary. Some NoSQL databases use SQL to search the data.

Which is better MongoDB or SQL Server?

MongoDB is more fast and scalable in comparison to the SQL server. MongoDB doesn't support JOIN and Global transactions but the SQL server supports it. MongoDB supports a big amount of data but the MS SQL server doesn't. MongoDB support Agile practices but MS SQL server doesn't support it.


1 Answers

I suggest to take a look into cqrs (Command Query Responsibility Segregation) pattern that was initially introduced by Greg Young. Also you can read here.

This approach involve to have two databases: read and write. Write database is used as primary write store and read - database for querying. Read database can have denormalized data. For example if you have article you can embed author information in it as well for quick display on ui. And in general nosql database good fit for read storage.

In your case primary normalized database can be in sql and read database can be in mongodb.

In general this approach good fit for high traffic systems. There is open source implementation of it -- ncqrs.

Also this approach in roadmap of microsoft for 2012 year.

from me: I am using this approach more than one year and giving to it my personal vote up.

like image 122
Andrew Orsich Avatar answered Oct 12 '22 11:10

Andrew Orsich