PostgreSQL11preview-pgbench支援大於1000連結(ppoll()代替select())

德哥發表於2018-04-18

標籤

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: <builtin: TPC-B (sort of)>  
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


相關文章