PGPool 内存要求

gre*_*egn 5 postgresql pgpool load-balancing

对于运行连接池和负载平衡但没有查询缓存的专用 PGPool 机器,建议使用多少物理内存?

我看到了;num_init_children(96) * max_pool(2) * number_of_backends(2) = 384中的线条 SHOW pool_pools每个 PID 的模态平均值似乎约为 99M,有几个 1G 异常值

# top for 20 pgpool processes
$ top -p $(pgrep pgpool | head -20 | tr "\\n" "," | sed 's/,$//')

Tasks:  20 total,   0 running,  20 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.1 us,  4.0 sy,  0.0 ni, 92.2 id,  0.0 wa,  0.0 hi,  0.7 si,  0.0 st
KiB Mem :  1784080 total,    22068 free,  1629960 used,   132052 buff/cache
KiB Swap:  4194300 total,   437328 free,  3756972 used.    71276 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND     
15407 root      20   0   97828    872    708 S   0.3  0.0   5:52.95 pgpool      
 8076 root      20   0  101664   2800   1708 S   0.0  0.2   0:06.51 pgpool      
 9597 root      20   0  101656   4508   1264 S   0.0  0.3   0:18.85 pgpool      
13603 root      20   0  149936  35548    984 S   0.0  2.0   1:13.56 pgpool      
13634 root      20   0  151848  39364    984 S   0.0  2.2   1:00.25 pgpool      
13677 root      20   0  149424  37812   1180 S   0.0  2.1   0:28.03 pgpool      
13680 root      20   0  153416  34948   1180 S   0.0  2.0   0:32.97 pgpool      
15397 root      20   0   97820    828    668 S   0.0  0.0   0:33.05 pgpool      
15399 root      20   0   97884    240    132 S   0.0  0.0   1:41.48 pgpool      
15402 root      20   0   93636     72      0 S   0.0  0.0   0:07.12 pgpool      
15405 root      20   0   93636    280    172 S   0.0  0.0   0:42.39 pgpool      
17121 root      20   0  101676   2016   1648 S   0.0  0.1   0:03.39 pgpool      
17206 root      20   0   97824     72      0 S   0.0  0.0   0:00.00 pgpool      
17207 root      20   0   97820    164     56 S   0.0  0.0   0:00.27 pgpool      
21348 root      20   0 3871428 1.090g   1536 S   0.0 64.1 429:48.53 pgpool      
21917 root      20   0  102672   2832   1696 S   0.0  0.2   0:49.46 pgpool      
22117 root      20   0  101692   2868   1752 S   0.0  0.2   0:16.57 pgpool      
22436 root      20   0  101692   4644   3464 S   0.0  0.3   0:31.12 pgpool      
23037 root      20   0  101692   3776   1780 S   0.0  0.2   0:20.52 pgpool      
23142 root      20   0  101664    980    936 S   0.0  0.1   0:08.60 pgpool      
Run Code Online (Sandbox Code Playgroud)

fil*_*rem 2

它没有在官方文档中记录(截至目前 - 2018 年 2 月),但 PgPool 的内存占用相当大。

在我最近的测试中,PgPool II 3.6 版每个子进程需要多达 140 MB RAM。(子进程的数量在 中定义num_init_children)。这是私有进程内存- 不共享。

这意味着每 50 个客户端大约有 8GB。

与 PostgreSQL 相比,这是 5-10 倍(PostgreSQL 可以在 8 GB RAM 上轻松处理 250 个会话)。另外,PostgreSQL 使用共享缓冲区缓存,这更具成本效益。