6

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?

Community
  • 1
  • 1
Noam
  • 3,341
  • 4
  • 35
  • 64
  • 1
    Well any performance depends on specific test and use case you want. What database are you considering? Programming languages? I see you tagged mongodb and cassandra. Read this answer for a mongodb benchmark done in SO. http://stackoverflow.com/a/9703513/728287 – Gianfranco P. Sep 25 '12 at 10:20
  • 2
    "NoSQL" is not one option - it's a whole range of many different options. "NoSQL" is an umbrella term for a wide field of different database technologies. The only thing they have in common is what sets them apart from each other: they are "not (only) SQL". They have widely different philosophies, use-cases and target groups. – Philipp Sep 25 '12 at 11:41
  • @Philipp I understand it's not one option. Maybe my wording was a little off, and the question should have stated: should I abandon SQL in my specific use case. – Noam Sep 25 '12 at 15:04

1 Answers1

3

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

Sammaye
  • 43,242
  • 7
  • 104
  • 146
  • mongodb 2.2 instead of global write lock has [per collection lock](https://jira.mongodb.org/browse/SERVER-4328). – Andrew Orsich Sep 25 '12 at 13:13
  • @AndrewOrsich Nah it has DB level lock. Collection level lock is coming much later, here is the JIRA for it: https://jira.mongodb.org/browse/SERVER-1240 – Sammaye Sep 25 '12 at 13:40
  • excuse me, they have [db level lock](http://docs.mongodb.org/manual/reference/server-status/#locks) now – Andrew Orsich Sep 25 '12 at 14:51
  • @AndrewOrsich Oh yea didn't bother looking at the link you posted lol If I had looked at the link I would have realised that :) – Sammaye Sep 25 '12 at 14:59