问题描述
我正在寻找有关mysql和node.js的一些工作,并且发现了一些不同的模块,但是我对它们的稳定性/成熟度不满意.我知道每个作者在每个人中都付出了艰辛的努力,但是对于我们正在做的工作,我需要知道我有一个扎实的mysql基础.我发现看起来不错的模块是:
I am looking to do some work around mysql and node.js and have found a few different modules out there but I cannot get a good bead on their stability/maturity. I know each author puts very hard work into each one, but for the work we're doing I need to know I've got a solid mysql foundation. The modules I've found that look pretty good are:
- db-mysql 这似乎很活跃.
- node-mysql 这是到目前为止我所见过的相当普遍的模块,似乎正在维护中阶段,并且看起来很牢固.
- node-mysql-native 我喜欢在这里完成异步工作,但不确定如何效果很好.
- node-mysql-libmysqlclient 我不确定这一点,但它似乎很活跃好吧.
- db-mysql This appears pretty active.
- node-mysql This is a pretty pervasive module I've seen so far, it appears to be in a maintenance phase, and seems solid.
- node-mysql-native I like the async work being done here, but I'm not sure how well it works yet.
- node-mysql-libmysqlclient I'm not sure about this one, but it appears to be active as well.
我没有太多与众不同的需求.我需要常规的查询支持,其他功能会很不错,我只需要一个良好的基础就可以开始.关于这些模块的优势和劣势的任何投入都是很好的.如果还有其他竞争者,我没有发现我完全不反对考虑其他选择.
I don't have many needs that are too far out of the ordinary. I need regular query support, extras would be nice, I just need a good foundation to start from. Any input as to the strengths and weaknesses of these modules would be great. If there is another quality contender I have not found I am not at all against considering another option.
推荐答案
我是node-mysql-native驱动程序的作者,从我的角度来看,差异是
I'm the author of node-mysql-native driver, from my point of view the differences are
- node-mysql中尚无准备好的语句支持
- 根据我的基准,node-mysql比node-mysql-native慢10-20%
- node-mysql具有更广泛的采用,更多的测试和更多的用户.如果需要稳定性,最好使用它 在快速查询中,
- node-mysql-libmysqlclient快2到3倍.但是,如果您有很多慢查询并使用连接池,则它可能比本机JS驱动程序还要慢,因为libmysqlclient异步调用基于nodejs线程池而不是事件循环.
- no prepared statements support (yet) in node-mysql
- according to my benchmarks node-mysql is 10-20% slower than node-mysql-native
- node-mysql has much wider adoption, more tests and users. If you need stability, better use it
- node-mysql-libmysqlclient is 2 to 3 times faster on fast queries. However, if you have a lot of slow queries and use connection pools it could be even slower than native JS driver because libmysqlclient async calls are based on nodejs thread pool and not on event loop.
更新
截至2013年7月11日
As of 11/07/2013
- (2).不再有效(mysql-native比node-mysql慢一点)
- 在节点上有此替代 ,在某些基准测试中,它快了2-3倍,对准备好的语句,SSL和压缩具有相同的API +支持.还实现服务器端协议的简单子集-例如,参见 MySQL-> Postgres代理.
- node-mariasql 也是一个很好的选择(如果可以使用二进制插件)-快速,稳定,异步,准备好的语句支持,压缩和SSL.
- (2). no longer valid (mysql-native is a bit slower than node-mysql)
- have this alternative to node-mysql, on some benchmarks it's 2-3 times faster, has same API + support for prepared statements, SSL and compression. Also implements simple subset of server side protocol - see for example MySQL -> Postgres proxy.
- node-mariasql is also a very good option (if it's ok to use binary addon) - fast, stable, async, prepared statements support, compression and SSL.
这篇关于什么是最成熟/稳定的mysql node.js模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!