Slashdot Mirror


MemSQL Makers Say They've Created the Fastest Database On the Planet

mikejuk writes "Two former Facebook developers have created a new database that they say is the world's fastest and it is MySQL compatible. According to Eric Frenkiel and Nikita Shamgunov, MemSQL, the database they have developed over the past year, is thirty times faster than conventional disk-based databases. MemSQL has put together a video showing MySQL versus MemSQL carrying out a sequence of queries, in which MySQL performs at around 3,500 queries per second, while MemSQL achieves around 80,000 queries per second. The documentation says that MemSQL writes back to disk/SSD as soon as the transaction is acknowledged in memory, and that using a combination of write-ahead logging and snapshotting ensures your data is secure. There is a free version but so far how much a full version will cost isn't given." (See also this article at SlashBI.)

43 of 377 comments (clear)

  1. A nice approach perhaps... by alphatel · · Score: 4, Interesting

    It sounds cool, but we can get 200k iops on Raid10 SSD without degradation.

    --
    When the foot seeks the place of the head, the line is crossed. Know your place. Keep your place. Be a shoe.
    1. Re:A nice approach perhaps... by tomhath · · Score: 4, Insightful

      Price/performance is a better question. If it's fast enough that you don't need the Raid 10 SSD then it could be a good choice. Throw hardware at any DBMS and you'll get good throughput.

  2. Ya Don't Say! by Rary · · Score: 5, Insightful

    Really? Accessing RAM is faster than accessing a disk? What a novel discovery!

    It seems to me that MySQL can also be run in memory. Apparently that's how the clustered database works (or used to work). I've never tried it, but let's see some benchmarks between MemSQL and an entirely memory-based MySQL.

    --

    "You cannot simultaneously prevent and prepare for war." -- Albert Einstein

    1. Re:Ya Don't Say! by errandum · · Score: 3, Insightful

      That and memcached (I think that's the name).

      This comparison is far from fair... Is it ACID? Or eventually synchs up? How does it compare with other memory based DB's?

      Comparing it with a slow relational DB will not give you any kind of credibility.

    2. Re:Ya Don't Say! by bill_mcgonigle · · Score: 3, Interesting

      Not just that - you can get a FusionIO ramdisk device for really big databases and get performance that's somewhere between SSD and memory. Those are all battery backed and such, so no monkeying around with whether the ACID was done right or not.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    3. Re:Ya Don't Say! by gman003 · · Score: 4, Interesting

      It's a bit more complex. There's four main ways to do MySQL storage in RAM (which I know of because my current work project is a MySQL application).

      First, the NDB Cluster system is there, which is what you've mentioned. That's basically just a MySQL frontend to a distributed, memory-based NoSQL database, though. Convenient, but not truly "MySQL".

      The second is using the "Memory" storage engine, where it actually stores a normal MyISAM table in memory. However, this is a surprisingly crappy option, because it uses table-level locks for writing, so parallel write performance is only marginally faster than disk.

      The third is to store regular InnoDB tables on a ramdisk. This can be crazy fast, but it also means that if your server crashes or loses power, you're *fucked*

      The fourth is to use Memcached, which isn't really a MySQL thing at all. You're basically just caching data in a memory-only NoSQL database, at the application level. This is actually what we ended up doing, because all the others are pretty crappy options - Cluster is the best one, but the hardware requirements are higher than we could justify spending given our performance requirements. Shoving memcached onto the web server (which has RAM to spare) and setting certain queries to cache their results there sped things up significantly, at minimal cost.

      As far as I can tell from the summary (I refuse to read the articles for such a blantant slashvertisement), this "MemSQL" doesn't do anything you can't do by configuring MySQL properly, although they likely optimized some rarely-used modules to make them faster.

    4. Re:Ya Don't Say! by arth1 · · Score: 4, Informative

      The third is to store regular InnoDB tables on a ramdisk. This can be crazy fast, but it also means that if your server crashes or loses power, you're *fucked*

      Not necessarily. There are battery-backed volatile RAM devices that can last for days, and also non-volatile RAM devices like F-RAM and MRAM.
      Battery backed volatile RAM can even be considered "cheap" - if the bottleneck are in tables small enough to fit on these, or the amount of overall writes is so high that placing the innodb logs there makes sense, it can be cheaper than a RAID10 or 50 of high-speed SAS drives.

      The HyperCard / ACARD drives, for example, are only $300 plus RAM. And if the worst happens, you can even dump the RAM to a CF card before the battery runs out.

    5. Re:Ya Don't Say! by Paradise+Pete · · Score: 5, Funny

      I am a ramdisc fan since Mac+.

      I'm gonna call BS on this one. Why would a ram disc need a fan?

    6. Re:Ya Don't Say! by arth1 · · Score: 4, Interesting

      The biggest issue with RAM drives are their cost.

      Yes and no. If you can fit the Innodb writeahead-logs and a few of the worst bottleneck tables on, say, an 8 GB ram drive, it's a bargain.

      HyperDrive: $300
      2 * 4GB 240-Pin DDR2-800 SDRAM ECC: $234
      16 GB CF card for backup: $30
      Total: $564

      That's downright cheap compared to what a RAID 10 or 50 of SSDs or short-stroked 10k/15k rpm drives would cost.
      If it solves a bottleneck, it could be a big money saver.

    7. Re:Ya Don't Say! by Hognoxious · · Score: 5, Funny

      MySQL is not webscale because it uses joins.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    8. Re:Ya Don't Say! by Anonymous Coward · · Score: 4, Informative

      For those who don't get the reference:

      http://www.xtranormal.com/watch/6995033/mongo-db-is-web-scale

    9. Re:Ya Don't Say! by mwvdlee · · Score: 4, Insightful

      TFS states that transactions are writen to disk after being "acknowledged" in memory.
      I assume that means transactions are written to disk only after the database reports back a succesful commit.
      So failing to meet the D of ACID compliancy.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    10. Re:Ya Don't Say! by xelah · · Score: 4, Insightful

      I don't think that's something which can be changed, except by changing the hardware. The starting point is this: When a COMMIT is made all changes have to be written to the write-ahead-log before a success response can be returned to the client. The WAL is written sequentially, and so if you're using ordinary disks and are sensible you give it its own set of spindles (RAID1, say). That means that between each write you have to wait for one disk rotation - you append to the log, you process the next transaction, then you have to wait for the disk to rotate to just after where you finished writing before you can write the next one. So you can do 1/15k transactions per minute with this basic setup.

      You can do things to make this faster. You can write several transactions at once, and you can put slight delays in to transaction commits to wait for others to bundle them with (PostgreSQL I believe will do the first and can be configured to do the second). You can use battery backed caches in your RAID system, which will have much the same effect (and leave you limited by disk bandwidth and cache size). You can use SSDs that don't need to seek.

      I can't see anything in TFA that MemSQL is supposed be doing differently here, or anything it CAN do differently. From TFA: 'The key ideas are that SQL code is translated into C++, so avoiding the need to use a slow SQL interpreter, and that the data is kept in memory, with disk read/writes taking place in the background.'. The first I'm not too sure I understand (presumably they're not turning it in to C++ and then passing it through a C++ compiler....) but maybe we can blame the journalist for that. Or maybe they've just reinvented prepared statements. The second is what databases do anyway - except, of course, for the WAL and when you're reading data which isn't in memory. Perhaps what they're doing is flushing the WAL after the commit has returned to the client - which makes the database very much not ACID, and is also something that other databases can be configured to do if you don't care about your data.

      Potentially what they could do, though, is to have designed all of their data structures, algorithms, locking and so on around the assumption that everything is in memory. There are big differences in the best query plan to use when data is in memory vs on disk, and traditional databases don't necessarily make the right choices. They try, but may for instance use table scans for queries which return a large proportion of the rows in a table because sequential IO is faster, when they should be using indexes if the data is in memory. And BTrees and the way data everywhere is split in to pages is something traditional DBs do because that works well even when most of your data is on disk. So maybe that's what they've done differently that other DBs haven't already been doing.

    11. Re:Ya Don't Say! by drsmithy · · Score: 3, Insightful

      Wake me up when that is 800GB to a few TB. Then you can say. This might shock you to learn but some business uses their databases to drive more than just web forums.

      You can already put a TB of RAM into a server if you want. If you really need to have that amount of data with next to zero latency, then the cost (which is still relatively low) is unlikely to be much of a stumbling block.

      It clearly will shock you to learn that most databases are well under a couple of hundred GB in size.

  3. okay...? by bhcompy · · Score: 4, Funny

    When I think of fast databases to compare to, the first thing I think of is MySQL.

    /Actually, I'd rather see a comparison to Pick or other lightning fast MV dbs

    1. Re:okay...? by Kergan · · Score: 4, Insightful

      MySQL is the last thing I think of, personally. It sucks as soon as you make it ACID compliant and start hitting it with thousands of concurrent requests. You're much better off with PostgreSQL.

    2. Re:okay...? by LurkerXXX · · Score: 4, Funny

      But with MySQL you can get a wrong answer REAL FAST!!!

    3. Re:okay...? by Ziekheid · · Score: 3, Informative

      He was being sarcastic..

    4. Re:okay...? by evilviper · · Score: 3, Insightful

      When I think of fast databases to compare to, the first thing I think of is MySQL.

      MySQL is actually very fast under light loads / one-off queries, and if you choose to leave it at the non-ACID compliant default settings, and similar. eg. "innodb_flush_log_at_trx_commit"

      That's probably the only reason why it got popular... There weren't any open source NoSQL DBs at the time, and MySQL seems fast when tested with a basic, shallow benchmark. Of course others like PostgreSQL completely leave it in the dust once there's some real load, or complex queries, or you WANT to be absolutely sure transactions were committed to disk before returning.

      As a single point of evidence, I give you Zabbix... It supports the use of all the major databases (Postgresql, DB2, Oracle, SQLite, etc.) as backends, yet MySQL is recommended as it performs the fastest.
      http://www.zabbix.com/documentation/1.8/manual/performance_tuning

      /Actually, I'd rather see a comparison to Pick or other lightning fast MV dbs

      Level-2 overflow! Resize analysis! Change the modulo! Ahhhh!

      I've done the PICK-OS thing for a few years, and I'm not a big fan. I'm infinitely happier administering PostgreSQL DBs.

      Besides, you don't have to go to something as exotic as PICK to get away from SQL. Try ages-old Berkley DB (db4), or any of the newer NoSQL options.

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    5. Re:okay...? by Areyoukiddingme · · Score: 4, Informative

      Here on Slashdot, we have a convention for saying that with less typing. It's spelled like this:

      *woosh*

  4. Show me vs a real DB engine by Kergan · · Score: 4, Interesting

    Show me benchmarks vs Oracle, PostgreSQL or SQLServer. Spare me the comparison with MySQL or some other toy.

    1. Re:Show me vs a real DB engine by BitterOak · · Score: 4, Informative

      Show me benchmarks vs Oracle, PostgreSQL or SQLServer. Spare me the comparison with MySQL or some other toy.

      I think the reason the comparison to MySQL is appropriate is that this database is supposed to be MySQL compatible.

      --
      If I can be modded down for being a troll, can I be modded up for being an orc, or a balrog?
    2. Re:Show me vs a real DB engine by symbolset · · Score: 4, Informative

      This i supposed to be funny. Oracle prohibits private benchmark publication in their license.

      --
      Help stamp out iliturcy.
    3. Re:Show me vs a real DB engine by gman003 · · Score: 3, Funny

      Ah, but it's an "enterprise-grade" toy.

  5. Err... what? by Splab · · Score: 3, Interesting

    Ok, so both article and video is extremely thin on details, the explanation for the massive performance is pretty much gibberish and their argumentation for ACID compliance is bullshit.

    Just leaves me with the question, what are they trying to get out of this BS?

    1. Re:Err... what? by viperidaenz · · Score: 4, Informative

      Just leaves me with the question, what are they trying to get out of this BS?

      Your money, its not a free piece of software.

  6. Meh. by hey! · · Score: 5, Insightful

    Give me fast enough, robust, easy to administer and standards compliant. Maybe a little less fast means you throw more hardware at a problem, but it doesn't matter if overall the overall cost and risk is inflated. A platform decision boils down to three things: (1) is it good enough; (2) is it economical; (3) if we decide later this doesn't work for us, are we totally screwed.

    In any case, there's no meaningful way you can make a claim that a database management system is the fastest on the planet. All you have is benchmarks, and different benchmarks apply to different use-cases.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  7. Facebook engineers? Gah! by TheMiddleRoad · · Score: 3, Funny

    I wouldn't run my toaster on software engineered by someone from Facebook, let alone a database. I'd have to spend ten minutes searching for my toast, and it would show up the following week.

  8. Re:Facebook engineers? Gah! by duk242 · · Score: 5, Funny

    And then the next week, your toast would have changed from white bread to wholegrain and you're just going to have to get used to it.

  9. Re:Looks good for testing by realityimpaired · · Score: 5, Insightful

    As a long time SysAd/webmaster/developer, I'm certainly interested

    At the risk of sounding incredibly condescending....

    If you were really a sysadmin who could benefit from that kind of speed improvement, you'd know that it's possible to achieve that level of performance with MySQL already, by either running it from memory or by using a fast hard drive array. The simplest/cheapest option to drastically improve MySQL performance is to throw a large amount of RAM at a system and point MySQL at the memory. MySQL can be configured to keep the database in active memory and sync to the disk on a regular basis, which is almost exactly the kind of behaviour described for MemSQL... for an exceptionally large database that can't be stored in system memory, I imagine that the advantage that MemSQL is boasting would evapourate. There are other ways to go about doing it, such as running a fast disk array or a cluster, in order to get around the limitations of using RAM, but ultimately the prime determining factor for speed in MySQL is speed of access to the database file itself.

  10. Ahhhh, Pick! by hedronist · · Score: 4, Interesting

    The most over-the-top DB God I know started in Pick-land (ca 1972?). Although he does (is forced to?) use SQL nowadays, he thinks in ways that do not come out of any SQL DBA handbook. As a result he gets DBMSs to do things that are ... unnatural.

    He is currently doing some data-cubing stuff for us that I didn't think could be done with something less than a DOD budget. He says his touchstone is thinking in Pick and then 'translating' to SQL.

    I still think that the 2 missing courses from any CS degree program are 1) how to debug, and 2) history of computing.

    1. Re:Ahhhh, Pick! by Zenin · · Score: 4, Insightful

      I still think that the 2 missing courses from any CS degree program are 1) how to debug, and 2) history of computing.

      Practical software engineering is mostly about debugging. An actual course in debugging would imply that Computer Science curriculum had something to do with practical software engineering, which we're all painfully away it hasn't in the slightest.

      --
      My /. uid is better then your /. uid
  11. Speed vs. speed by Todd+Knarr · · Score: 4, Interesting

    Speed's fine, but what kind? Or more specifically, over what timeframe? High transaction rates are fine, but they don't do any good if you can only sustain them for a few seconds or minutes before the whole thing collapses. I want to know the transaction rate the thing can sustain over 24 hours of continuous operation. In the real world you have to be able to keep processing transactions continuously.

    That long-time-period test also shows up another potential problem area: disk bottleneck. In-memory's fine, but few serious databases are small enough to fit completely in memory. And even if it will fit, you can't lose your database when you shut down to upgrade the software so eventually the data has to be written to disk. And that becomes a bottleneck. If your system can't flush to disk at least as rapidly as you're handling transactions, your disk writes start to lag behind. Sooner or later that'll cause a collapse as the buffers needed to hold data waiting to be written to disk compete for memory with the actual data. You can play algorithmic games to minimize the competition, but sooner or later you run up against the hard wall of disk throughput. And the higher your transactions rates are, the harder you're going to hit that wall.

    1. Re:Speed vs. speed by hawguy · · Score: 3, Insightful

      I can buy servers with over a Terabyte of ram, mutiple power supplies and 4 x 10G interfaces for FCOE.
      What is a disk again other than to boot from.

      The disk is something to hold your data when a backhoe cuts your datacenter power, and cuts the network connections that you use to replicate data to your remote site.... then your UPS runs out of battery after an hour of transactions have been applied to the database with no replication to the remote site.

      Sometimes sh*t happens in ways you haven't planned for... when you have N degrees of redundancy, you'll get bit by the rare N+1 event. It's better to have your data stored somewhere that doesn't disappear after the power goes away (or the machine reboots).

      (if you're using your FCoE network to connect to the SAN to store your data, you're still using disks but there's no reason to use a local disk to boot from)

    2. Re:Speed vs. speed by Todd+Knarr · · Score: 4, Interesting

      A terabyte of RAM costs quite a lot of money, far more than a terabyte of hard drive does. And it's not as big as it sounds, I've dealt with databases bigger. Usually the ones that demand the highest performance are also the ones that eat the most space once you start taking indexes and such into account.

      And multiple power supplies? Won't help you when the data center rack loses all power. I recall at least 2, maybe more, reports of total loss at data centers in the last 12 months, so it's not like it's that rare an event. That's not counting partial losses, or cases where someone simply fumble-fingered and powered down or rebooted the wrong server. And it certainly doesn't count maintenance outages when the server or the database software had to be restarted to upgrade software. Redundant power supplies won't help against that, and while it's no big deal normally it's a really big deal when it means losing 100% of the contents of the database when memory gets cleared. Sooner or later you need the data on persistent storage, disk or an equivalent. You can handwave that need over the short term, minutes to maybe hours, but when you start talking about maintaining the database for months to years it's a different story. And if you want to say you don't need that kind of up-time, well, the business people where I work would probably boot you out the door so hard you'd bounce twice for suggesting they could just live with losing all our data a couple of times a year. Having it happen even once would probably be the end of the company.

  12. Top coder by Taco+Cowboy · · Score: 4, Interesting

    They did have an ad to lure in "Top Coders" at http://developers.memsql.com/blog/

    Apart from their ad, what they said about Top Coders was interesting - with the exception of top coders memorizing who books filled with algorithms, because top coders do not memorize nothing - top coders do not get to be top coders by memorizing.

    Instead, top coders have that instinct to _know_ which algorithm to adapt and apply, and top coders know where (and how to) look for the algorithm (either from their own archive, from books, from old magazines, or from some strange corners on the Web)
     

    --
    Muchas Gracias, Señor Edward Snowden !
    1. Re:Top coder by Surt · · Score: 4, Interesting

      All of the best developers I've met had phenomenal memories. I think both a natural reasoning ability and great memory are assets. If you are missing one, you aren't going to be as strong as someone who has both.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    2. Re:Top coder by gweihir · · Score: 4, Interesting

      I have met quite few people that could fake being good coders using really good memory. They were in fact at best mediocre coders and sometimes really bad ones. While these people can code solutions to simpler things really fast, they usually do not notice when they are out of their depth and would need to look up things or think about them for a while. Then they screw up royally. That most people mistake them for really good coders (and no, memory does not help reasoning ability, it hinders it) makes things worse. One of the hallmarks of a great coder is a very keen sense for when he/she needs to be careful because something is more difficult than it appears to be. Those with really good memories regularly fail that test. Bad memory is an asset here.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    3. Re:Top coder by mwvdlee · · Score: 4, Insightful

      Juggling 20 factors in your brain (short term memory) is not the same as having a good memory (long term memory).
      In fact they literally use different parts of the brain.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    4. Re:Top coder by zig007 · · Score: 4, Insightful

      Except that so very little of programming these days is about algorithms.
      Rather, it is about elegantly solving businesses problems and to know one's way around huge frameworks.
      Being a "top coder" is in it self a very good thing of course, but there are very few companies that actually work with technical details like implementing a better hash algorithm and so forth.

      Rather, in most developers jobs, it is very valuable to;
      * be good at being able to understand, handle and especially change large systems.
      * be good at producing solutions that at a reasonable rate balances cost and customer demands versus simplicity, performance, structure and other technical values.
      * being able to foresee the usages of the solutions in different time frames, and through this make systems cheaper and easier to evolve. Sometime, a super quick and butt-ugly solution is a really good thing to get the customer going while it figures out what it really wants. As long as all parties are aware of the situation and knows that a complete rewrite will have to be paid for next.
      * not act like a stubborn child when ones pet solution or technology gets scrapped or unaccepted or that the rest of the company think it is risky to invest time in going down that road. But to just keep pushing.
      * to be professional and keep on working even though the current thing is really boring.

      --
      Baboons are cute.
  13. Re:How do they write to disk faster? by Surt · · Score: 4, Informative

    SSD is significantly faster than HDD at both sequential and random writes. Top 15K SAS drives write ~250MB/s sequential. Top SSD write 550MB/s sequential. Write random and it gets much worse for the SAS drive. Try to even find an enterprise HDD benchmark done in the last year. No one bothers because enterprise buys SSD if they care about performance.

    --
    "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
  14. The Devil Is In The Detail by Anonymous Coward · · Score: 4, Informative

    I've had a love-hate relationship with MySQL for over ten years now, and have as much cause to hate it as anyone, but I have to point this out. Read the MemSQL docs carefully, and here's the killer - they only support single-query transactions, and only at isolation level READ COMMITTED.

    Until those two facts change, then its hardly a fair comparison.

  15. Re:Filesystem anyone? by Anonymous Coward · · Score: 3, Interesting

    I work on a system like that right now in a really big company. Let me tell you something- it's shit. If you need concurrent access to the files/directories by several processes, you'll have a heap of issues. Consumers pick up files before they are completely written by the producers (now fixed by file renaming, but required work). Sime directories now hold 300k files, and any file operations are extremely slow- filesystems aren't designed for this (in process of being fixed by splitting directories squid style into many subdirectories). On top of that, because we need to access the repository from multiple machines and we want reliability, it's now on NAS. This means any file open/close operation takes ~6 ms, at least 2 ping trips to the NAS server and back. This means 166 IO operations per second and no more. You want notification when a file arrives- you get to use polling. FS file modification notifications don't work on NAS. It is terrible. I wasn't there when this thing was designed, but I'd like to find the architector who thought this is a good idea and punch him in the face.