具有 10000 个并发连接的 pgpool num_init_children

sco*_*ier 2 postgresql connection concurrency pgpool

昨天我用 pgbench 测试了 pgpool :

pgbench -c 30 -T 20 -r pgbench -p9999 -h192.168.8.28
Run Code Online (Sandbox Code Playgroud)

并发连接数为 30,pgpool 默认 num_init_children 为 32。

因此,当我设置 -c 33 时,除非我爆发,否则测试将被阻止。


我的问题是:

If my concurrent connections online is 10000, should I set num_init_children=10000? 
Run Code Online (Sandbox Code Playgroud)

num_init_children=10000 意味着 pgpool 以 10000 个进程开始,这很糟糕。

有什么不对 ?

如何使用 10000 个并发连接配置 pgpool?

Muh*_*ama 5

一个 pgpool 子进程可以在任何时候处理一个客户端连接。因此 num_init_children 的值与预期的最大并发连接数成正比。如果您希望通过 pgpool 建立 10,000 个并发连接,除了将 num_init_children 设置为 10,000 之外别无他法。PostgreSQL 还产生一个专用进程来处理每个客户端连接,因此如果在任何情况下 PostgreSQL 服务器有 10,000 个连接的客户端,它也会有 10,000 个子进程。pgpool 和 PostgreSQL 在这方面的区别在于 pgpool 预生成 num_init_children 连接数,而 PostgreSQL 按需执行。