作者:手机用户2602906017 | 来源:互联网 | 2023-09-03 17:50
作者
digoal
日期
2018-03-25
标签
PostgreSQL , pgbench , ppoll
背景
目前pgbench最大可以测试1000个连接,显然在某些时候是不够的,我们可能需要建立更多的连接进行测试。
$ pgbench -j 3000 -c 1500
invalid number of clients: "1500"
使用这里提到的方法修改一下pgbench,让它能够建立100万个连接。
《从PostgreSQL支持100万个连接聊起》
PostgreSQL 11这块会改掉,使用ppoll代替select,超过1000个连接。
```
[trying again for 2018-01]
This patch enables building pgbench to use ppoll() instead of select()
to allow for more than (FD_SETSIZE - 10) connections. As implemented,
when using ppoll(), the only connection limitation is system resources.
The patch has been implemented to introduce a minimal of #ifdef/#ifndef
clutter in the code.
Without this patch, one is limited to '(FD_SETSIZE - 10)’ number of connections.
Example of something that fails without this patch but works with the patch:
Without the patch:
$ pgbench -j 3000 -c 1500
invalid number of clients: "1500"
With the patch:
$ pgbench -j 3000 -c 1500
starting vacuum...end.
transaction type:
scaling factor: 2000
query mode: simple
number of clients: 1500
number of threads: 1500
number of transactions per client: 10
number of transactions actually processed: 15000/15000
latency average = 631.730 ms
tps = 2374.430587 (including connections establishing)
tps = 4206.524986 (excluding connections establishing)
doug
Doug Rady
Amazon Aurora, RDS PostgreSQL
radydoug(at)amazon(dot)com
```
参考
https://www.postgresql.org/message-id/flat/3B729131-C891-41F3-B911-8DEB05515D63@amazon.com#3B729131-C891-41F3-B911-8DEB05515D63@amazon.com
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=60e612b602999e670f2d57a01e52799eaa903ca9
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.
9.9元购买3个月阿里云RDS PostgreSQL实例
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.