Is MongoDB + Socket.io better than MySQL + Socket.io for a real time app?
I am building a real-time app & am wondering if I should bother moving from MySQL to MongoDB. My app has a ton of writes happening, though the read cases are higher still. Am currently using XHR on the client-server side but am almost done moving to Socket.io too.
My research does make me want to move to MongoDB + Socket.io, but wanted to get some thoughts from the community.
update I am currently defining 'better' by a faster app, if that makes any sense. I am sort 开发者_如何转开发of able to live without sql, I 'think'. Currently using 0 JOINs etc. But I was trying to see if anybody out there had any experience moving from MySQL to MongoDB for a 'generic' real-time app.
Thank you.
It depends on how you define "better".
If the relational model and sets are more important to you, MySQL is "better" than MongoDB.
If you can give up ACID, and your data is more document based, MongoDB is "better" than MySQL.
It's difficult to answer in any case, but especially so without knowing more about your use cases.
Maybe late to add this, but I've had some experience with a real time analytics application moving from mySQL to mongodb. In my experience mySQL was much faster and responsive because my app was so WRITE HEAVY. By using innodb I was able to get row level locks, whereas when I was using mongodb I had to deal with a global lock. Not sure if they've since resolved the "global" lock thing.
My final solution was to use innodb and the Percona release of mySQL.
MongoDB isn't a relational database management system. Saying MongoDB is better than any RDBMS without first specifying the data shows a real lack of knowledge.
Key constraints don't exists in MongoDB. There are no referential integrity checks. We use MongoDB for blob storage and store the MongoDB keys in SQL Server. It's great for that but I would never outright replace a normalized SQL Server or a MySQL RDBMS instance with MongoDB.
Maybe a lot of people see MongoDB as being better because they don't want to worry about optimizing indexes and execution plans...but that comes at a cost of data integrity. It's a schemaless structure which means consistency doesn't exist. It will eat anything you feed it which can be dangerous.
Think about what happens over time as you add/remove properties from your JSON or add/remove reference data based on changing business rules. Think about what that conversion would look like in MongoDB compared to a RDBMS instance.
I know I sound pretty critical of MongoDB but I don't mean to. We use it and it works well for our needs but it's not a replacement for RDBMS. More of a supplement.
精彩评论