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