Dear CentOS users,
I run a small Facebook game at a CentOS 6.3 machine
with PostgreSQL 8.4.3 + few PHP scripts + 1 Perl daemon
and even though the server worked ok,
I've suggested my users to double up the RAM
to 32 GB and they have collected money for that.
Now my problem is that I don't know, which knob
to turn and how to really use the additional memory.
Below is my top output at the peak time (evenings) -
as you see, 27 GB of RAM aren't used:
# top - 18:47:55 up 23:12, 2 users, load average: 2.17, 2.31, 2.56
Tasks: 246 total, 2 running, 244 sleeping, 0 stopped, 0 zombie
Cpu(s): 12.1%us, 0.2%sy, 0.0%ni, 87.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 32790380k total, 5296664k used, 27493716k free, 197132k buffers
Swap: 2096056k total,0k used, 2096056k free, 3815840k cached
PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND
12363 postgres 20 0 4376m 717m 710m S 40.6 2.2 2:03.48 postmaster
3842 nobody20 0 118m 23m 3920 S 12.0 0.1 46:24.68 pref.pl
9178 postgres 20 0 4375m 518m 514m S 11.3 1.6 53:50.63 postmaster
12380 postgres 20 0 4377m 668m 660m S 11.3 2.1 2:33.26 postmaster
12243 postgres 20 0 4377m 668m 662m S 9.3 2.1 2:20.49 postmaster
12438 postgres 20 0 4374m 502m 498m S 6.3 1.6 1:03.34 postmaster
12249 postgres 20 0 4384m 852m 839m S 3.0 2.7 3:59.11 postmaster
12241 postgres 20 0 4378m 632m 625m S 1.7 2.0 2:48.62 postmaster
12156 apache20 0 366m 27m 17m S 1.0 0.1 0:05.12 httpd
36 root 20 0 000 S 0.3 0.0 0:01.32 events/1
100 root 39 19 000 S 0.3 0.0 0:06.04 khugepaged
9217 postgres 20 0 21976 1036 516 S 0.3 0.0 1:01.07 pgbouncer
12010 apache20 0 376m 37m 17m S 0.3 0.1 0:07.58 httpd
12280 apache20 0 370m 30m 16m S 0.3 0.1 0:03.17 httpd
12362 apache20 0 365m 15m 6816 R 0.3 0.0 0:01.90 httpd
12457 apache20 0 360m 9.8m 3456 S 0.3 0.0 0:00.14 httpd
1 root 20 0 19352 1584 1284 S 0.0 0.0 0:01.03 init
2 root 20 0 000 S 0.0 0.0 0:00.00 kthreadd
# vmstat 10
procs ---memory-- ---swap-- -io --system-- -cpu-
r b swpd free buff cache si sobibo in cs us sy id wa st
6 2 0 27323416 196988 385253600 3 165 159
14 0 84 2 0
1 0 0 27422148 197012 381486000 0 5284 4784 2104
46 1 51 2 0
1 0 0 27454748 197020 382665600 4 1734 2021 1200
16 0 83 1 0
0 2 0 27514008 197028 381346400 0 702 1475 1208
8 0 90 2 0
0 0 0 27465612 197040 381396800 0 1435 1764 1725
10 0 85 5 0
1 0 0 27459260 197060 381424800 0 2032 2667 1304
22 0 76 1 0
1 0 0 27440076 197064 382706400 0 1604 3146 2109
27 0 72 1 0
1 0 0 27466796 197068 381486800 2 1241 2014 1637
13 0 83 3 0
4 0 0 27380104 197072 384825600 0 1064 2375 894
20 0 79 1 0
1 0 0 27488168 197096 381529600 0 2075 2697 2220
23 0 75 1 0
1 0 0 27462168 197116 382138000 0 871 1750 943
13 0 86 1 0
4 0 0 27432100 197128 382232000 0 3980 4767 2340
46 1 53 1 0
0 0 0 27493716 197132 381584400 0 1871 3209 2078
27 0 72 1 0
3 0 0 27424284 197132 382703600 0 1452 2551 1487
18 0 78 3 0
3 0 0 27435428 197160 382411600 0 2066 3430 2082
29 0 70 1 0
2 0 0 27452004 197172 381744000 0 1356 2722 1895
23 0 76 1 0
2 0 0 27436668 197176 382664800 0 1633 3629 2162
30 0 69 1 0
1 0 0 27439924 197204 382312400 0 1502 1786 1293
14 0 86 0 0
0 0 0 27466696 197212 381678000 0 1200 1701 1164
13 0 86 0 0
3 0 0 27432204 197212 381834400 0 2587 2098 2154
16 0 83 1 0
2 0 0 27421088 197224 382722400 0 1229 2635 1421
21 0 75 3 0
3 0 0 27319136 197232 38320880013 2965 4220 1951
40 0 59 1 0
procs ---memory-- ---swap-- -io --system-- -cpu-
What I've already done:
/var/lib/pgsql/data/postgresql.conf (local connections only)
max_connections = 10
shared_buffers = 4096MB
work_mem = 16M
/etc/php.ini
memory_limit = 300M
[PostgresSQL]
pgsql.allow_persistent = Off# because I use pgbouncer
/etc/pgbouncer.ini (local connections only too)
max_client_conn = 600
default_pool_size = 80
/etc/httpd/conf/httpd.conf (didn't modify yet):
IfModule prefork.c
StartServers 10
MinSpareServers8
MaxSpareServers 30
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 4000
/IfModule
Any suggestions please?
I was actually hoping that Linux would use the additional
memory for caching disks, but this doesn't seem to happen?
Thank you
Alex
P.S. Below my dmesg output -
#