Mah*_*ooq 5 mysql amazon-rds node.js bookshelf.js knex.js
我有一个Node.js使用应用MySQL上AWS RDS具有Bookshelf与Knex库。RDS实例具有一个max_connections值90。我正在使用以下作为连接对象。
knex: {
client: 'mysql',
connection: {
host: 'xxxxxxx.rds.amazonaws.com',
user: 'xxx',
password: 'xxxxx',
database: 'xxxx',
charset: 'utf8'
},
debug: true,
pool: {
min: 2,
max: 20
},
acquireConnectionTimeout: 10000
},
Run Code Online (Sandbox Code Playgroud)
const config = require('./environment');
const knex = require('knex')(config.knex);
module.exports = require('bookshelf')(knex).plugin('registry');
Run Code Online (Sandbox Code Playgroud)
'use strict';
const bookshelf = require('../config/bookshelf');
const config = require('../config/environment');
module.exports = bookshelf.model(`TableA`, {
tableName: 'TableA'
}, {});
Run Code Online (Sandbox Code Playgroud)
我对应用程序有很多要求,有时会因以下错误而崩溃。
未处理的拒绝TimeoutError:Knex:超时获取连接。游泳池可能已满。您是否缺少.transacting(trx)通话?
和
错误:ER_CON_COUNT_ERROR:连接过多
还我看到在服务器的连接数(上平均40至50)PROCESSLIST与Command作为sleep。
我怀疑当90服务器上的所有连接完全使用完/ knex尝试从其池中获取新连接时,会发生这些错误。什么可能是对此的永久解决方案,以及处理此类应用程序的最佳实践。
| 归档时间: |
|
| 查看次数: |
66 次 |
| 最近记录: |