简体   繁体   English

RethinkDB 与 NodeJS:打开单个连接与单个静态连接

[英]RethinkDB with NodeJS: Open individual connections vs single static connection

I am currently developing a real-time app with rethinkdb and node, and there are many different rethinkdb queries to run in different classes.我目前正在使用 rethinkdb 和 node 开发实时应用程序,并且有许多不同的 rethinkdb 查询可以在不同的类中运行。 So, my question is, does it make more sense to have a single rethinkdb connection which every query must open and close, or a single connection where every query is run, statically available?所以,我的问题是,有一个每个查询都必须打开和关闭的 rethinkdb 连接,还是运行每个查询的单个连接,静态可用更有意义吗?

From this issue I deduce that parallelization is already an option, so this is a matter of what is more efficient.这个问题我推断出并行化已经是一种选择,所以这是一个更有效的问题。

It's best to have a pool of open connections to your RethinkDB server.最好有一个到 RethinkDB 服务器的开放连接池。 For example rethinkdbdash (which I recommend you use) opens a pool of 50 connections that are available for your queries.例如,rethinkdbdash(我建议您使用)打开一个包含 50 个连接的池,可用于您的查询。

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

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