我正在使用node-pg-pool在我的 REST API 中查询我的 Postgres db(AWS 中的主机,db.t2.micro)。
我担心如何为池的最大大小指定最佳数量。
我从https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing获得了一些有用的公式来获取池大小
我需要知道 AWS 实例中使用了多少线程、内核和硬盘驱动器(例如:db.t2.micro)。我搜索了 AWS 文档,但仍然找不到所有这些信息
我正在使用node-pg-pool在我的 REST API 中查询我的 Postgres db(AWS 中的主机,db.t2.micro)。
我担心如何为池的最大大小指定最佳数量。
我从https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing获得了一些有用的公式来获取池大小
我需要知道 AWS 实例中使用了多少线程、内核和硬盘驱动器(例如:db.t2.micro)。我搜索了 AWS 文档,但仍然找不到所有这些信息
当我使用以下代码连接到大象 SQL 上的 postgres 数据库时,我成功设置了池大小,aws 应该类似。顺便说一句,您如何连接到 AWS RDS?因为我有很多麻烦
var poolConfig = {
max: 5, //connections (was 20 in brianc's repo)
min: 2, //connections (was 4 in brianc's repo)
idleTimeoutMillis: 1000 //close idle clients after 1 second
}
poolConfig.user = 'aaaa';
poolConfig.password = 'bbbb';
poolConfig.database = 'ccccc';
poolConfig.host = 'ddddd';
poolConfig.port = 5432;
poolConfig.ssl = true;
var pool = new Pool(poolConfig);
pool.connect().then(client => {
client.query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';")
.then(data=>{});