Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a high performance difference in a Key-Value db on a single server with MySQL vs. NoSQL

In my PHP application I have a 470M rows table weighing 200GB in a MySQL MyISAM partitioned table on one server. Usage includes 70% Writes/30% Reads. I'm trying to improve performance. Main problem currently is read/write contentions due to table-level locks. I'm trying to decide between two options:

  1. Changing MySQL to Innodb. Pros: avoiding the table level locks. Cons: Much more disk space, need bigger HDs which might not be as fast as these (currently using RAID10 6*300GB SAS 15k).
  2. Moving data to a NoSQL db. Main Con: Learning curve. Have never used NoSQL before.

Question is, while trying to still avoid sharding the data, and considering the fact I'm using the RDMS MySQL as a simple key-value storage, are there high differences between performances between the two approaches or is the NoSQL main advantage here comes when moving to a distributed system?

like image 252
Noam Avatar asked Sep 25 '12 09:09

Noam


People also ask

Which DB is faster MongoDB or MySQL?

MongoDB Speed. In the MySQL vs. MongoDB speed debate, MongoDB usually comes out as the winner. MongoDB can accept large amounts of unstructured data much faster than MySQL thanks to slave replication and master replication.

What can a typical NoSQL database not do simply compared to an SQL database?

SQL databases are vertically scalable, while NoSQL databases are horizontally scalable. SQL databases are table-based, while NoSQL databases are document, key-value, graph, or wide-column stores. SQL databases are better for multi-row transactions, while NoSQL is better for unstructured data like documents or JSON.

Is key-value database fast?

Key-value databases offer fast in-memory access. For applications that don't require frequent updates or need to support complex queries.


1 Answers

I can only answer your question partially but hopefully more than a comment.

MongoDB is not typically a key-value store and has been known to have certain performance hits when used as one.

MongoDb also has a locking problem here that could come back to haunt you. It has a DB level lock atm which means it could (would need testing) cause write lock saturation.

It is also heavily designed for a 80% read app (which is said to be the most common setup for websites now-a-days) so the more writes you do the more you will notice a performance drop over time. That being said you can tweak MongoDB to be more write friendly and the distributed nature does help to stop write lock saturation a little.

However that being said my personal opinion the learning curve of MongoDB from SQL:

  • Was next to null
  • More natural and simpler to implement into my app than SQL
  • Query language is simple making it dead easy to get to grips with
  • Query language has a lot of similarities to SQL
  • The drivers are standardised so that the syntax you see in the Docs for the JS driver in the console is consistent across the board.

My personal opinion on the general matter is the distributed notion of it. If you get a NoSQL solution designed for key-value stores then it could be really good. A quick search on Google pulled out a small list of NoSQL key-value stores on Wikipedia: http://en.wikipedia.org/wiki/NoSQL#Key-value_stores_on_solid_state_or_rotating_disk

like image 51
Sammaye Avatar answered Oct 12 '22 15:10

Sammaye