请问node + mongodb的方案中,有必要引入数据库连接池吗?
仅有的幸福
仅有的幸福 2017-05-02 09:19:09
0
2
589

我不知道我的理解对不对,当node触发一个IO操作时,会起一个用于IO操作的线程,这个线程会利用之前建立的数据库连接(本质上就是与数据库实例的一个socket连接)进行通信,成功后返回事件给主线程。因为IO操作的线程是存在多个的可能,因此大并发的情况下还是有必要引入数据库连接池。

仅有的幸福
仅有的幸福

reply all(2)
为情所困

The Node driver already comes with a connection pool, whether you want to use it or not.
In fact, all officially supported MongoDB drivers are created according to unified standards and behave similarly, so in fact, all drivers used use connection pools to manage connections.

为情所困

Connection pools can reduce the time it takes for applications to create links. Using connection pools will not make any difference to upper-layer applications. Correctly configuring the connection pool can optimize performance during times of high concurrency

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template