Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

MySQLPlus: A Non-Blocking MySQL Driver for Ruby 1.8 and 1.9

By Peter Cooper / September 3, 2008


Recently we posted about NeverBlock, a Ruby 1.9-specific library that eases the development of apps that use non-blocking IO. eSpace, the company behind the library, have now come along with another surprise... MySQLPlus - a non-blocking MySQL driver for Ruby 1.8 and 1.9! There's more information here in the official announcement.

MySQLPlus is billed as a new general purpose MySQL driver that supports "threaded access and async operations" and after installing it and running the basic tests that come with the library, it certainly seems to do the job. eSpace believes that MySQLPlus could be used to significantly reduce the latency of certain Rails applications, but as a bare MySQL driver it should be of significant benefit to all Ruby developers whose code talks to MySQL servers. If yours does, try out MySQLPlus right now - your Ruby processes are crying out for some relief.

This post supported by Notifixious - Notifixious - a new notification service startup based in San
Francisco - needs a Rails expert to become its CTO! Knowledge of messaging technologies (XMPP) and REST API development is a must. You can learn more here.


  1. AkitaOnRails says:

    Awesome news!!! Ruby is gearing towards an Async world very fast.

  2. John says:

    I am wondering how this will affect the common Rails CRUD sites that use the standard Rails conventions.

    Would this make any difference if used in place of the mysql-ruby gem ?

    Or would this only be of interest to apps that are doing all sorts of hackish things with ActiveRecord::Base.connection directly in their code, such as managing a database connection pool?

    I'm just trying to see what this all means.

  3. ActsAsFlinn says:

    @John, seems like anything that depends on a DB query would benefit from this. AR or otherwise if the site makes a db hit per request I'd think it would benefit from the async. I'd love to combine this with merb's run_later for things like hit counting.

  4. murphee says:

    There's more extensive information in an interview with one of the Neverblock developers over @ InfoQ:

  5. Haitham says:

    @John: You are right, Rails applications that follow the standard way cannot benefit from MySQLPlus yet. However, it's good to know that eSpace is just about to release an ActiveRecord adapter (among other NeverBlock stuff) that would benefit from MySQLPlus. after the adapter is released, it will be a matter of configuring your Rails application to use it along with MySQLPlus, and everything wlse will be just seamless.. You'll continue writing code the way you have always been doing, but you'll gain the massive performance boost.

  6. Senthil Nayagam says:

    it is a good start to have thread safe rails 2.2 with thread safe db driver,

    hope people start posting their benchmarks,

    hope someone builds a tool for connection pooling as well

  7. Andy says:

    this is great news.
    between rails 2.2 and this new mysql driver, we'll be entering into a new generation of development and support soon.

  8. Jay says:

    Awesome news, but completely irrelevant for Rails production systems at this point in time. ALL these drivers require 1.9 and there is no news on the horizon that Rails is going to be 1.9 stable any time soon. In fact, Matz has even said 1.9 itself should not be considered stable.

    We're not going to see any of these drivers put into production until sometime next year probably. These non-blocking drivers have been making the rounds on all the news sites and that's good, but people need to realize that they're completely alpha at this point in time and are no where near being available as a usable gem that Rails can deploy on.

    The next biggest news for Rails, besides being thread safe in 2.2 will be Rails on 1.9.x. Watch out for that.

  9. Peter Cooper says:

    Jay: "ALL these drivers require 1.9" ? I'd be interested to hear more, but this works fine on 1.8 for me and is non-blocking as claimed.

    To your other point, 1.9 should be considered stable on the release of 1.9.1 which is supposedly production ready. Whether Rails will work with it is a different issue, of course :)

  10. roger says:

    @Jay MysqlPlus is compatible with 1.8 and 1.9. You could use it with rails 2.2 to have a more "ruby thread friendly" rails app that doesn't block on IO--whenever 2.2 comes out, that is :)

    MysqlPlus is a fork off the [already stable] Mysql C gem, so it should be near production ready [many thanks to Tomahito M.].

    1.9 will theoretically be "stable" at the end of this year [whatever that means], I probably wouldn't recommend upgrading least a little while after that :)

    AFAIK all rails' tests pass in Ruby 1.9 so you can run it and try it yourself :)

    @Senthil: Note that rails 2.2 will come with pooled db connections [you set the size in the database.yml descriptions].

  11. Ben Johnson says:

    I think this is awesome. But does anyone else feel a little skeptical about upgrading to ruby 1.9, rails 2.2, and throwing a new mysql driver at your production environment?

  12. roger says:

    Yeah if you want rails mysql multi threaded I'd probably just upgrade to mysqlplus + rails 2.2 [staying with 1.8.6] until the dust settles a little more. I guess it depends how aggressively you want to upgrade [or need to or what not].

Other Posts to Enjoy

Twitter Mentions