Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Connection Pooling #74

Open
chrisdew opened this issue May 17, 2013 · 6 comments
Open

Feature Request: Connection Pooling #74

chrisdew opened this issue May 17, 2013 · 6 comments

Comments

@chrisdew
Copy link
Contributor

Would it be possible to add connection pooling to mysql-native?

I have an 8 core DB server and sometimes I need to run dozens of queries from one NodeJS process (where the order of completion is unimportant). It would be nice if these queries finished sooner.

@sidorares
Copy link
Owner

can you suggest api? By the way, take a look at https://github.com/sidorares/node-mysql2 - it's nearly 10 times faster and has same features (and many more). The is pooling in mysql2, same api as with node-mysql

@chrisdew
Copy link
Contributor Author

What does sidorares/node-mysql2 offer over felixge/node-mysql - is it speed
alone (not that that's a bad thing)?

How does sidorares/node-mysql2 compare to mysql-native for speed?

Is mysql-native discontinued in favour of mysql2? If not, I'll think about
an API.

On 17 May 2013 12:06, Andrey Sidorov [email protected] wrote:

can you suggest api? By the way, take a look at
https://github.com/sidorares/node-mysql2 - it's nearly 10 times faster
and has same features (and many more). The is pooling in mysql2, same api
as with node-mysql


Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-18055565
.

@sidorares
Copy link
Owner

speed (x2 to x7 times), prepared statements, SSL, compression. Rows are compiled to proper JS objects, which means property access is very fast ( = not in a dictionary mode) I'll probably declare mysql-native discontinued in favour of mysql2. It was long due to be refactored and ended in complete rewrite. mysql-native parser is string based and byte manipulation on strings is slower than on Buffer. Also, in mysql2 I'm trying not to buffer as much as possible - if there is enough data in incoming chunk to make a packet it is processed immediately without appending to internal buffer first. mysql-native is still useful as it can be used with virtually any version of node, even with 0.1 if you add sha1 shim.

@sidorares
Copy link
Owner

my speed benchmarks (might be wrong, I'm biased) on air 5.1 2Ghz and local mysql 5.6
sequential selects in one connection (one row in result):
mysql-native ~ 5k selects/sec
node-mysql ~ 6-7k
node-mysql2 ~ 7-8k
mariasql ~10k

selecting large number of rows or multiple selects in many parallel connections:
mysql-native - ~ 200k rows/sec
node-mysql - 350k rows/sec
node-mysql2 - 2000k rows/sec
mariasql - 800k rows/sec

numbers given for a very small row (1-2 numeric columns, might be different for another types of data)

Also there is server protocol api so you can easily mock any mysql server behaviour.

@chrisdew
Copy link
Contributor Author

Thanks, I'll try mysql2 on my next project.

On 17 May 2013 14:44, Andrey Sidorov [email protected] wrote:

my speed benchmarks (might be wrong, I'm biased) on air 5.1 2Ghz and local
mysql 5.6
sequential selects in one connection:
mysql-native ~ 5k selects/sec
node-mysql ~ 6-7k
node-mysql ~ 7-8k
mariasql ~10k

selecting large number of rows or multiple selects in many parallel
connections:
mysql-native - ~ 200k rows/sec
node-mysql - 350k rows/sec
node-mysql2 - 2000k rows/sec
mariasql - 800k rows/sec

numbers given for a very small row (1-2 numeric columns, might be
different for another types of data)

Also there is server protocol api so you can easily mock any mysql
server behaviour.


Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-18062035
.

@sidorares
Copy link
Owner

In the meantime I'll try to port node-mysql pool code to mysql-native (e.i same pool api)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants