Browse Source

fasthttp: limit the maximum db connetions count to 256 - the maximum concurrency level used in the benchmark

Aliaksandr Valialkin 9 years ago
parent
commit
ab8c3c24db

+ 1 - 1
frameworks/Go/fasthttp-mysql/src/hello/hello.go

@@ -78,7 +78,7 @@ func main() {
 		dbConnCount = (dbConnCount + runtime.NumCPU() - 1) / runtime.NumCPU()
 		dbConnCount = (dbConnCount + runtime.NumCPU() - 1) / runtime.NumCPU()
 	}
 	}
 	db.SetMaxIdleConns(dbConnCount)
 	db.SetMaxIdleConns(dbConnCount)
-	db.SetMaxOpenConns(dbConnCount * 2)
+	db.SetMaxOpenConns(dbConnCount)
 
 
 	worldSelectStmt = mustPrepare(db, "SELECT id, randomNumber FROM World WHERE id = ?")
 	worldSelectStmt = mustPrepare(db, "SELECT id, randomNumber FROM World WHERE id = ?")
 	worldUpdateStmt = mustPrepare(db, "UPDATE World SET randomNumber = ? WHERE id = ?")
 	worldUpdateStmt = mustPrepare(db, "UPDATE World SET randomNumber = ? WHERE id = ?")

+ 1 - 1
frameworks/Go/fasthttp-postgresql/src/hello/hello.go

@@ -71,7 +71,7 @@ func main() {
 	if *prefork {
 	if *prefork {
 		dbConns = (maxConnectionCount + runtime.NumCPU() - 1) / runtime.NumCPU()
 		dbConns = (maxConnectionCount + runtime.NumCPU() - 1) / runtime.NumCPU()
 	}
 	}
-	if db, err = initDatabase("localhost", "benchmarkdbuser", "benchmarkdbpass", "hello_world", 5432, 2*dbConns); err != nil {
+	if db, err = initDatabase("localhost", "benchmarkdbuser", "benchmarkdbpass", "hello_world", 5432, dbConns); err != nil {
 		log.Fatalf("Error opening database: %s", err)
 		log.Fatalf("Error opening database: %s", err)
 	}
 	}