0

是的,我只是想知道使用用纯 JS 编写的 MySQL 或 MongoDB 驱动程序是否是个好主意。我的意思是,在每月运行 100 个用户的小型数据库的小型应用程序时,这应该不是问题,但是重负载/非常大的数据库呢?

没有我可以编译的 NodeJS 的专业 MySQL 和 Mongo 驱动程序吗?这些的性能应该要好得多。

还是我错了?例如,Mongoose 使用纯 JS 编写的驱动程序。这足以有效地查询 5 亿份文档吗?

任何建议/意见将不胜感激!

谢谢

编辑:

所以感谢大家的回复。好吧,我仍然对此不确定:)。我的意思是,用 Python 或 Java 甚至 C# 编写驱动程序肯定是有意义的,但这些语言比 JS 更强大、更快。

以下是让我担心的地方:

我的 MySQL 驱动程序(用纯 JS 编写)在 300-400 毫秒内执行查询 SHOW COLUMNS FROM Table。如果我从 MySQL shell 执行完全相同的查询,则需要 20 毫秒。

我使用了一个使用https://github.com/felixge/node-mysql模块的 ORM (JugglingDB)。300ms 是原始查询执行时间,在调试模式下打印。

为什么我们会看到如此大的差异?是 ORM 还是 Node/JS 或驱动程序太慢了?

4

1 回答 1

1

Most MongoDB drivers are written in the language that they are used with. The Python driver is written in Python, the Perl driver in Perl. There are a few exceptions, as the PHP driver is written in C and the Python driver as an optional C extension to speed things up.

The node-mongodb-native driver is written all in JavaScript: https://github.com/mongodb/node-mongodb-native. It make sense as the NodeJS platform is optimised for this and there should be no adverse effects.

于 2013-06-23T15:18:43.797 回答