开发者

Are there any non-blocking node.js db drivers for redis, mongo or mysql?

开发者 https://www.devze.com 2023-03-12 06:27 出处:网络
I know there are blocking drivers for these and have used them but am looking for non-blocking node d开发者_开发百科rivers.thanks.node-mongodb-native is an excellent, non-blocking Node driver for Mong

I know there are blocking drivers for these and have used them but am looking for non-blocking node d开发者_开发百科rivers. thanks.


node-mongodb-native is an excellent, non-blocking Node driver for MongoDB. It also contains optional C-based BSON extensions for performance.


Non-blocking MySql drivers:

native JS, non-blocking due to event loop

  • http://github.com/felixge/node-mysql
  • https://github.com/sidorares/nodejs-mysql-native
  • https://github.com/sidorares/node-mysql2

libmysqlclient bindings, non-blocking with node thread pool

  • http://github.com/Sannis/node-mysql-libmysqlclient

libmariasql bindings:

  • https://github.com/mscdex/node-mariasql/


https://github.com/mranney/node_redis

For portability, a pure JavaScript reply parser is used by default. Pieter Noordhuis has provided a binding to the official hiredis C library, which is non-blocking and fast. To use hiredis, do:

npm install hiredis redis

Performance

hiredis parser:

PING: 20000 ops 46189.38 ops/sec 1/4/1.082 
SET: 20000 ops 41237.11 ops/sec 0/6/1.210 
GET: 20000 ops 39682.54 ops/sec 1/7/1.257 
INCR: 20000 ops 40080.16 ops/sec 0/8/1.242
LPUSH: 20000 ops 41152.26 ops/sec 0/3/1.212 
LRANGE (10 elements): 20000 ops 36563.07 ops/sec 1/8/1.363
LRANGE (100 elements): 20000 ops 21834.06 ops/sec 0/9/2.287
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号