patternsqlMinor
PGPool memory requirements
Viewed 0 times
requirementspgpoolmemory
Problem
What amount of physical memory is recommended for a dedicated PGPool machine running connection pooling & load balancing, but no query cache?
I see
```
# 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
I see
num_init_children(96) max_pool(2) number_of_backends(2) = 384 lines in SHOW pool_pools; and the modal average seems to be about 99M per PID, with a couple of 1G outliers```
# 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
Solution
It's not documented in the official docs (as of now - Feb 2018), but PgPool's memory footprint is quite heavy.
In my recent testing PgPool II version 3.6 needs as much as 140 MB RAM per child process. (the number of child processes is defined in
This means approximately 8GB for each 50 clients.
Compared to PostgreSQL, this is 5-10 times more (PostgreSQL can easily handle 250 sessions on 8 GB RAM). Plus, PostgreSQL uses shared buffer cache which is much more cost effective.
In my recent testing PgPool II version 3.6 needs as much as 140 MB RAM per child process. (the number of child processes is defined in
num_init_children). This is private process memory - not shared. This means approximately 8GB for each 50 clients.
Compared to PostgreSQL, this is 5-10 times more (PostgreSQL can easily handle 250 sessions on 8 GB RAM). Plus, PostgreSQL uses shared buffer cache which is much more cost effective.
Context
StackExchange Database Administrators Q#177867, answer score: 2
Revisions (0)
No revisions yet.