IT IS HERE! Get Smashing Node.JS on Amazon Kindle today!
Show Posts
← Back to homepage

I just pushed node.dbslayer.js to GitHub, a very basic and easy-to-use interface to DBSlayer.

What is DBSlayer?

The DBacesslayer aka DBSlayer is a lightweight database abstraction layer suitable for high-load websites where you need the scalable advantages of connection pooling. Written in C for speed, DBSlayer talks to clients via JSON over HTTP, meaning it’s simple to monitor and can swiftly interoperate with any web framework you choose.

Developed by the New York Times to distribute the load of their MySQL servers, DBSlayer allows us to perform queries in a non-blocking way. Running a SQL query is as simple as:

connection.query("SELECT * FROM TABLE").addCallback(function(result){
	for (var i = 0, l = result.ROWS.length; i < l; i++){
		var row = result.ROWS[i];
		// do something with the data
	}
});

Have fun!

22 Comments

abraham said

how can I make mysql connection from a .js file

asdfasdf

Cool :) Does DBSlayer affects performance? Will binary connector to MySQL be much faster?

thomas said

what about Join Select request? its easy to crash the server with connections like this or does it exist some requestrules in the backend?

Andy Schuler said

Thanks for releasing this.

For anyone looking to use this with the latest version of Node.js (version 0.1.30), I’ve updated Guillermo’s driver to work with the new way events are handled.

To grab my forked version:

git clone git@github.com:shoeman22/node.dbslayer.js.git

    rooster said

    having a permission problem cloning that fork…

Matt said

Thank you to both the original author and Andy Schuler for posting an update. Just got this all set up on my system and I love the potential here.

Marjorie said

And this is why I love devthought.com. Increfible post.

christopher cuizon said

is this for real wooo that’s awesome…

Muftimaster said

Hi, I am mufti from blogfreakz.com, Can you tell me the License please..

wow , really good !

Anonymous said

thank you~

Anonymous said

thank you~

this is something i was searching for quite some long…

can you pack it all in one single tar.gz so that we can unzip it and run?? would like to see the package with dependencies as well…i would owe you a big favour. 

Dfsf said

dfsdfsdf

Your thoughts?

About Guillermo Rauch:

CTO and co-founder of LearnBoost / Cloudup (acquired by Automattic in 2013). Argentine living in SF.