Skip to content

Commit 94662df

Browse files
authored
feat: optimize mysql pool config (#72)
1 parent 35fd320 commit 94662df

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

config/config.prod.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ module.exports = () => {
2222
port: port || 3306,
2323
username: username || 'root',
2424
password: password || '',
25-
// 设置连接池
25+
// 设置连接池,连接数会乘以进程数 (`lsof -i:7001` 得到 pid,`ps -ef | grep ${pid} | wc -l` 可以查看进程数)
2626
pool: {
27-
max: 100, //最大连接个数
28-
min: 20,
27+
max: 50, //最大连接个数
28+
min: 0,
2929
acquire: 40000, // 从连接池获取连接的最长等待时间(毫秒)
3030
idle: 15000 // 连接池中空闲连接的最长存活时间(毫秒)
3131
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"dev": "egg-bin dev --daemon",
1111
"start": "bash start.sh",
1212
"start:test": "bash start.sh -t",
13-
"server": "egg-scripts start --daemon",
14-
"server:test": "egg-scripts start --port=7002 --env=test --daemon",
13+
"server": "egg-scripts start --daemon --workers=4",
14+
"server:test": "egg-scripts start --port=7002 --env=test --daemon --workers=2",
1515
"dingBot": "node DingBot.js",
1616
"stop": "egg-scripts stop",
1717
"lint": "eslint .",

0 commit comments

Comments
 (0)