You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/06/16 06:43:19 UTC

[GitHub] [servicecomb-service-center] fuziye01 opened a new pull request #1053: fixbugs: mongo connection pool is full (#1052)

fuziye01 opened a new pull request #1053:
URL: https://github.com/apache/servicecomb-service-center/pull/1053


   【issue】: #1052
   
   【特性/模块名称】:mongo db 连接
   
   【修改内容】:
   新增配置项registry.mongo.cluster.poolSize,把该参数设置为可以配置的,默认设置为1000
   创建mongoclient的时候传入参数,扩大go driver与mongo的连接数量
   
   【自测情况】:
   测试通过,通过配置poolSize可以提高go driver 与mongo的连接数量,高并发场景酌情配置


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW commented on a change in pull request #1053: fixbugs: mongo connection pool is full (#1052)

Posted by GitBox <gi...@apache.org>.
robotLJW commented on a change in pull request #1053:
URL: https://github.com/apache/servicecomb-service-center/pull/1053#discussion_r652446366



##########
File path: datasource/mongo/mongo.go
##########
@@ -130,7 +130,8 @@ func (ds *DataSource) initClient() error {
 	verifyPeer := config.GetBool("registry.mongo.cluster.verifyPeer", false)
 	certFile := config.GetString("registry.mongo.cluster.certFile", "")
 	keyFile := config.GetString("registry.mongo.cluster.keyFile", "")
-	cfg := storage.NewConfig(uri, storage.SSLEnabled(sslEnable), storage.RootCA(rootCA), storage.VerifyPeer(verifyPeer), storage.CertFile(certFile), storage.KeyFile(keyFile))
+	poolSize := config.GetInt("registry.mongo.cluster.poolSize", 1000)

Review comment:
       得做个负数判断,若小于等于0 赋值为1000,第二个就是1000,弄成一个常量,魔鬼数字




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW merged pull request #1053: fixbugs: mongo connection pool is full (#1052)

Posted by GitBox <gi...@apache.org>.
robotLJW merged pull request #1053:
URL: https://github.com/apache/servicecomb-service-center/pull/1053


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW commented on a change in pull request #1053: fixbugs: mongo connection pool is full (#1052)

Posted by GitBox <gi...@apache.org>.
robotLJW commented on a change in pull request #1053:
URL: https://github.com/apache/servicecomb-service-center/pull/1053#discussion_r652447686



##########
File path: datasource/mongo/mongo.go
##########
@@ -130,7 +130,8 @@ func (ds *DataSource) initClient() error {
 	verifyPeer := config.GetBool("registry.mongo.cluster.verifyPeer", false)
 	certFile := config.GetString("registry.mongo.cluster.certFile", "")
 	keyFile := config.GetString("registry.mongo.cluster.keyFile", "")
-	cfg := storage.NewConfig(uri, storage.SSLEnabled(sslEnable), storage.RootCA(rootCA), storage.VerifyPeer(verifyPeer), storage.CertFile(certFile), storage.KeyFile(keyFile))
+	poolSize := config.GetInt("registry.mongo.cluster.poolSize", 1000)

Review comment:
       记得小于等于0的时候再打印一个警告日志




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org