简体   繁体   English

什么是最成熟/稳定的mysql node.js模块

[英]What is the most mature/stable mysql node.js module

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.我希望围绕 mysql 和 node.js 做一些工作,并且已经找到了一些不同的模块,但我无法很好地了解它们的稳定性/成熟度。 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.我知道每位作者都非常努力,但对于我们正在做的工作,我需要知道我有扎实的 mysql 基础。 The modules I've found that look pretty good are:我发现看起来不错的模块是:

  1. db-mysql This appears pretty active. db-mysql这看起来很活跃。
  2. 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这是迄今为止我见过的一个非常普遍的模块,它似乎处于维护阶段,并且看起来很可靠。
  3. node-mysql-native I like the async work being done here, but I'm not sure how well it works yet. node-mysql-native我喜欢这里的异步工作,但我不确定它的工作情况如何。
  4. node-mysql-libmysqlclient I'm not sure about this one, but it appears to be active as well. node-mysql-libmysqlclient我不确定这个,但它似乎也处于活动状态。

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.如果我没有发现另一个质量竞争者,我完全不反对考虑另一种选择。

I'm the author of node-mysql-native driver, from my point of view the differences are我是 node-mysql-native 驱动程序的作者,从我的角度来看,差异是

  1. no prepared statements support (yet) in node-mysql node-mysql 中没有准备好的语句支持(还)
  2. according to my benchmarks node-mysql is 10-20% slower than node-mysql-native根据我的基准,node-mysql 比 node-mysql-native 慢 10-20%
  3. node-mysql has much wider adoption, more tests and users. node-mysql 有更广泛的采用、更多的测试和用户。 If you need stability, better use it如果您需要稳定性,最好使用它
  4. node-mysql-libmysqlclient is 2 to 3 times faster on fast queries. node-mysql-libmysqlclient 在快速查询上快 2 到 3 倍。 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.但是,如果您有很多慢查询并使用连接池,它可能比原生 JS 驱动程序更慢,因为 libmysqlclient 异步调用基于 nodejs 线程池而不是事件循环。

update更新

As of 11/07/2013截至 2013 年 11 月 7 日

  • (2). (2)。 no longer valid (mysql-native is a bit slower than node-mysql)不再有效(mysql-native 比 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.这个 node-mysql 的替代品,在某些基准测试中它快 2-3 倍,具有相同的 API + 支持准备好的语句、SSL 和压缩。 Also implements simple subset of server side protocol - see for example MySQL -> Postgres proxy .还实现了服务器端协议的简单子集 - 例如参见MySQL -> Postgres 代理
  • 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. node-mariasql也是一个很好的选择(如果可以使用二进制插件) - 快速、稳定、异步、准备好的语句支持、压缩和 SSL。

I went through a similar search and ended up settling on node-mysql.我进行了类似的搜索,最终选择了 node-mysql。 I like it's simplicity, the fact that it's pure js, and that it's well supported.我喜欢它的简单性,它是纯 js,并且得到很好的支持。 It was slower in tests that I did than some of the mixed modules (those that used non-js libs), but I did a minor patch that helped considerably with that for my cases:我做的测试比一些混合模块(那些使用非 js 库的模块)慢,但我做了一个小补丁,对我的情况有很大帮助:

https://github.com/geochap/node-mysql https://github.com/geocap/node-mysql

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM