0
我正在使用ReactiveMongo 0.12,並試圖瞭解不同類型的連接池如何在ReactiveMongo中工作的核心差異。ReactiveMongo:單連接池實例VS很多連接池實例VS多連接池
ReactiveMongo似乎提供了3種方式,使我們可以建立與數據庫的連接:
TYPE 1:使用單一的連接池實例
import reactivemongo.api.MongoConnection
val driver1 = new reactivemongo.api.MongoDriver
val connection3 = driver1.connection(List("addressA: 27017", "addressB: 27017","addressC": 27017", "addressD: 27017"))
TYPE 2:使用多個連接池實例
import reactivemongo.api.MongoConnection
val driver1 = new reactivemongo.api.MongoDriver
val connection1 = driver1.connection(List("addressA", "addressB"))
val connection2 = driver1.connection(List("addressC", "addressD"))
TYPE 3:使用多個連接池
import reactivemongo.api.MongoConnection
val driver1 = new reactivemongo.api.MongoDriver // first pool
val driver2 = new reactivemongo.api.MongoDriver // second pool
// Pick a connection from the first pool
def connection1 = driver1.connection(List("addressA", "addressB"))
// Pick a connection from the second pool
def connection2 = driver2.connection(List("addressC", "addressD"))
這些是什麼3種連接方式之間的區別是什麼?在性能方面哪個是最好的方法?
您可以使用[MailingList](https://groups.google.com/forum/?fromgroups#!forum/reactivemongo)提問。 – cchantep