ANN: mariasql

353 views
Skip to first unread message

mscdex

unread,
Aug 19, 2012, 8:00:15 PM8/19/12
to nodejs
Hello all,

This weekend I was poking around MariaDB's website and noticed they
had recently released a libmysqlclient library that contains non-
blocking functions. So I took it upon myself today to start writing a
binding to it and to see how well such a binding would perform.

One silly benchmark I did was executing "SHOW DATABASES" on a stock
XAMPP MySQL server. With the `mysql` module, the total time taken from
start to finish was anywhere from ~141-151ms. With the `mariasql`
module, the total time was anywhere from ~6-46ms. I also wanted to try
the node-libmysqlclient binding, but I was doing main development and
testing for mariasql on Windows at the time and node-libmysqlclient is
not currently available there.

There are still things to be implemented yet, but the basics are
already there.

I encourage feedback on this project, whether it's in the form of bug
reports, bug fixes, enhancement requests, other comments, etc. :-)

URL: https://github.com/mscdex/node-mariasql
Via npm: `npm install mariasql`

Alan Hoffmeister

unread,
Aug 19, 2012, 11:10:55 PM8/19/12
to nod...@googlegroups.com
This is something fascinating...
I can already see good ORMs rising from this project.

Node.JS is all about concurrency and speed, and I really think that
MariaDB/XtraDB have a place in this culture.

Good job.

--
Att,
Alan Hoffmeister


2012/8/19 mscdex <msc...@gmail.com>:
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

Mihamina Rakotomandimby

unread,
Aug 20, 2012, 1:08:03 AM8/20/12
to nod...@googlegroups.com
On 08/20/2012 06:10 AM, Alan Hoffmeister
:
> Node.JS is all about concurrency and speed, and I really think that
> MariaDB/XtraDB have a place in this culture.



In an adjacent topic, I also notice we already have a "quiet mature"
LDAP binding too: https://github.com/jeremycx/node-LDAP

Nicer and nicer!

--
RMA.

Oleg Efimov (Sannis)

unread,
Aug 21, 2012, 8:13:13 AM8/21/12
to nod...@googlegroups.com
Good work, Brian!

I'll hope add you module to my benchmark utility [1] on weekend and update results in wiki.

[1]: https://github.com/Sannis/node-mysql-bindings-benchmarks

понедельник, 20 августа 2012 г., 4:00:15 UTC+4 пользователь mscdex написал:

mscdex

unread,
Aug 21, 2012, 12:37:56 PM8/21/12
to nodejs
On Aug 21, 8:13 am, "Oleg Efimov (Sannis)" <efimo...@gmail.com> wrote:
> I'll hope add you module to my benchmark utility [1] on weekend and update
> results in wiki.

I already had this done locally at the time of my original post, but I
have sent a PR that includes additional changes.

For those interested, here are some updated results using Sannis'
benchmarks on one of my Linux machines: https://github.com/Sannis/node-mysql-bindings-benchmarks/wiki

Felix Geisendoerfer

unread,
Aug 21, 2012, 3:34:42 PM8/21/12
to nod...@googlegroups.com
Nice work! Looking forward to doing my own benchmarks / finishing some more optimizations for my module!


> One silly benchmark I did was executing "SHOW DATABASES" on a stock 
> XAMPP MySQL server. With the `mysql` module, the total time taken from 
> start to finish was anywhere from ~141-151ms. With the `mariasql` 
> module, the total time was anywhere from ~6-46ms.

That sounds weird. Are you taking the connection time into account? Otherwise I'm confused why there should be much of a difference for this.

> For those interested, here are some updated results using Sannis' 
> benchmarks on one of my Linux machines: https://github.com/Sannis/node-mysql-bindings-benchmarks/wiki 

A few eyebrow raisers:

* mysql: SELECT seems to perform *exactly* as fast as in the June 28 benchmark, even so this is on different hardware?
* PHP: SELECT seems massively slower compared to the June 28 benchmark (201 kHz vs 345 kHz)?
* mariasql: INSERT performance is better than it is for C?

Overall I'm afraid these numbers are not without flaws, but for now I'll assume 'mariasql' to be faster than my 'mysql' module. That is all I need to spend more time hacking on this again : ).

--fg

Oleg Efimov (Sannis)

unread,
Aug 21, 2012, 4:30:00 PM8/21/12
to nod...@googlegroups.com
Felix, there is one more difference that I do not take into account in benchmark: my, your and Brian's modules handle field types differently. 

вторник, 21 августа 2012 г., 23:34:42 UTC+4 пользователь Felix Geisendoerfer написал:

mscdex

unread,
Aug 21, 2012, 4:58:27 PM8/21/12
to nodejs
On Aug 21, 3:34 pm, Felix Geisendoerfer <haimu...@gmail.com> wrote:
> > One silly benchmark I did was executing "SHOW DATABASES" on a stock
> > XAMPP MySQL server. With the `mysql` module, the total time taken from
> > start to finish was anywhere from ~141-151ms. With the `mariasql`
> > module, the total time was anywhere from ~6-46ms.
>
> That sounds weird. Are you taking the connection time into account?
> Otherwise I'm confused why there should be much of a difference for this.

Yes, that was including time to connect.

> * mysql: SELECT seems to perform *exactly* as fast as in the June 28
> benchmark, even so this is on different hardware?

It's a coincidence, but as far as I know the hardware is different (I
am not sure what environment was used for the previous tests).

> * PHP: SELECT seems massively slower compared to the June 28 benchmark (201
> kHz vs 345 kHz)?

Probably due to a different benchmarking environment.

> * mariasql: INSERT performance is better than it is for C?

Yeah that was the one thing I didn't quite understand and have yet to
figure out the exact cause.



On Aug 21, 4:30 pm, "Oleg Efimov (Sannis)" <efimo...@gmail.com> wrote:
> Felix, there is one more difference that I do not take into account in
> benchmark: my, your and Brian's modules handle field types differently.

That is true, I hadn't thought of that. mariasql 0.0.2 does not do any
typecasting at all.

mscdex

unread,
Aug 21, 2012, 5:20:40 PM8/21/12
to nodejs
On Aug 21, 4:58 pm, mscdex <msc...@gmail.com> wrote:
> That is true, I hadn't thought of that. mariasql 0.0.2 does not do any
> typecasting at all.

Hrmm... even disabling typecasting for `mysql` didn't seem to change
the benchmark results much.

mscdex

unread,
Aug 21, 2012, 5:42:35 PM8/21/12
to nodejs
On Aug 21, 4:58 pm, mscdex <msc...@gmail.com> wrote:
> > * mariasql: INSERT performance is better than it is for C?
>
> Yeah that was the one thing I didn't quite understand and have yet to
> figure out the exact cause.

After some more runs, I've actually seen the C client significantly
beat (most times >=2x) mariasql now with regards to the INSERT
benchmark. I've also now seen the PHP INSERT benchmark beat mariasql
in some runs, but not by quite as much as the C client.

Oleg Efimov (Sannis)

unread,
Aug 22, 2012, 2:13:09 AM8/22/12
to nod...@googlegroups.com
I plan to add possibility to run benchmark some times and show averages. But I have no idea when I finish this. 

среда, 22 августа 2012 г., 1:42:35 UTC+4 пользователь mscdex написал:

mscdex

unread,
Aug 31, 2012, 9:53:28 PM8/31/12
to nodejs
On Aug 22, 2:13 am, "Oleg Efimov (Sannis)" <efimo...@gmail.com> wrote:
> I plan to add possibility to run benchmark some times and show averages.
> But I have no idea when I finish this.

I had a little free time today and whipped up a page for displaying
benchmarks (using averaged data over n runs) with nifty graphs:
http://mscdex.github.com/node-mysql-benchmarks/

:-)

mscdex

unread,
Sep 6, 2012, 4:06:17 PM9/6/12
to nodejs
mariasql 0.1.0 has just been released. Get it now from npm: `npm
install mariasql`.

Highlights:

* Bundled libmariadbclient/libmysqlclient -- no more third party
dependencies required!

* Multiple statements (and stored procedures) support: "SELECT * FROM
foo; SELECT * FROM bar; SELECT * FROM baz"

* SSL support

* Compression support

* Connect timeout and password hashing (MySQL 4.1.1+) connection
options


On a related note I have added a couple more sets of benchmarks to the
list here: http://mscdex.github.com/node-mysql-benchmarks/

The 9/5/2012 benchmarks merely include updated driver/module versions
from npm. The 9/6/2012 benchmarks include the results of using value
arrays instead of objects for rows (for drivers/modules that support
this feature) when making SELECT queries.

mscdex

unread,
Sep 13, 2012, 1:11:18 AM9/13/12
to nodejs
mariasql 0.1.5 has been released. Get it now from npm: `npm install
mariasql`.

The most notable change in this version is the inclusion of support
for client-side/emulated prepared statements using either/both
`:name_123` or `?` style placeholders. Example usage of these prepared
statements can be found in the readme.

mscdex

unread,
Sep 13, 2012, 1:15:03 AM9/13/12
to nodejs
I should also note that this prepared query support ensures that
placeholders inside of string literals do not get recognized/replaced
(e.g. "SELECT * FROM foo WHERE status = '?' AND id = :id" when parsed,
only finds one placeholder, ":id").
Reply all
Reply to author
Forward
0 new messages