Thread: Too many postgres instances
Hi, Can anyone explain to me why my system is spawn so many postgress instances? System: FreeBSD 7.2 Stable I386 RAM: < 1GB Here is the output of the top command: Mem: 457M Active, 92M Inact, 150M Wired, 23M Cache, 85M Buf, 18M Free Swap: 999M Total, 150M Used, 849M Free, 14% Inuse Here is a list of the postgres instances running in my system: pgsql 70502 0.0 0.5 10364 3800 ?? Ss 2:24AM 0:28.85 postgres: stats collector process (postgres) pgsql 70797 0.0 0.4 49724 2892 ?? Is 2:28AM 0:00.24 postgres: liferay lportal 127.0.0.1(54110) (postgres) pgsql 70798 0.0 0.7 49724 5060 ?? Is 2:28AM 0:00.43 postgres: liferay lportal 127.0.0.1(52754) (postgres) pgsql 70799 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(49593) (postgres) pgsql 70800 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(55760) (postgres) pgsql 70801 0.0 0.6 49724 5016 ?? Is 2:28AM 0:00.56 postgres: liferay lportal 127.0.0.1(56710) (postgres) pgsql 70802 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(65367) (postgres) pgsql 70803 0.0 0.6 49724 4508 ?? Is 2:28AM 0:00.27 postgres: liferay lportal 127.0.0.1(55101) (postgres) pgsql 70804 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(62522) (postgres) pgsql 70805 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(57897) (postgres) pgsql 70806 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(51393) (postgres) pgsql 70894 0.0 0.8 49724 5908 ?? Is 2:30AM 0:00.67 postgres: liferay lportal 127.0.0.1(65399) (postgres) pgsql 70895 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(54991) (postgres) pgsql 70896 0.0 0.7 49724 5412 ?? Is 2:30AM 0:00.65 postgres: liferay lportal 127.0.0.1(63123) (postgres) pgsql 70897 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(63978) (postgres) pgsql 70898 0.0 0.8 49724 6284 ?? Is 2:30AM 0:00.59 postgres: liferay lportal 127.0.0.1(65359) (postgres) pgsql 70902 0.0 0.6 49724 4264 ?? Is 2:30AM 0:00.25 postgres: liferay lportal 127.0.0.1(50233) (postgres) pgsql 70903 0.0 0.6 49724 4924 ?? Is 2:30AM 0:00.41 postgres: liferay lportal 127.0.0.1(65401) (postgres) pgsql 70904 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(63124) (postgres) pgsql 70905 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(54153) (postgres) pgsql 70906 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(63712) (postgres) pgsql 80297 0.0 0.7 49724 5044 ?? Is 6:22AM 0:00.28 postgres: liferay lportal 127.0.0.1(58431) (postgres) pgsql 80298 0.0 0.7 48700 5288 ?? Is 6:22AM 0:00.48 postgres: liferay lportal 127.0.0.1(50051) (postgres) pgsql 80299 0.0 1.0 49724 7600 ?? Is 6:22AM 0:00.30 postgres: liferay lportal 127.0.0.1(49678) (postgres) pgsql 80300 0.0 0.7 48700 5380 ?? Is 6:22AM 0:00.67 postgres: liferay lportal 127.0.0.1(58183) (postgres) pgsql 80301 0.0 0.6 49724 4748 ?? Is 6:22AM 0:00.37 postgres: liferay lportal 127.0.0.1(55792) (postgres) pgsql 93527 0.0 0.4 49724 3464 ?? Is 11:28AM 0:00.14 postgres: liferay lportal 127.0.0.1(54222) (postgres) pgsql 93528 0.0 0.0 48700 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(52385) (postgres) pgsql 93529 0.0 0.0 48700 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(59677) (postgres) pgsql 93530 0.0 0.0 48700 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(60016) (postgres) pgsql 93531 0.0 0.0 49724 0 ?? IWs - 0:00.00 postgres: liferay lportal 127.0.0.1(56885) (postgres) pgsql 95330 0.0 0.9 49724 6812 ?? Is 12:05PM 0:00.18 postgres: liferay lportal 127.0.0.1(55050) (postgres) pgsql 95331 0.0 0.7 48700 5680 ?? Is 12:05PM 0:00.07 postgres: liferay lportal 127.0.0.1(53490) (postgres) pgsql 95332 0.0 0.8 49724 6572 ?? Is 12:05PM 0:00.47 postgres: liferay lportal 127.0.0.1(50029) (postgres) pgsql 95333 0.0 0.5 48700 3544 ?? Is 12:05PM 0:00.04 postgres: liferay lportal 127.0.0.1(65012) (postgres) pgsql 95334 0.0 0.8 48700 6236 ?? Is 12:05PM 0:00.06 postgres: liferay lportal 127.0.0.1(57130) (postgres) It seems I don't have enough memory to run my Liferay web portal, there are 3 web portal instances are running, but some of the primary keys are failed to index properly: .. 16:40:18,175 WARN [ResourceActionsUtil:564] Unable to obtain resource actions for unknown portlet SampleContactUs 17:45:17,326 WARN [PortalImpl:2948] Current URL /c/portal/login?p_l_id=10404 generates exception: No Layout exists with the primary key 10404 20:22:57,623 WARN [PortalImpl:2948] Current URL /c/portal/login?p_l_id=11432 generates exception: No Layout exists with the primary key 11432 (END) Your suggestion is very much appreciated. Thanks
Sam Wun <swun2010@gmail.com> wrote: > > Can anyone explain to me why my system is spawn so many postgress instances? Postgres starts a dedicated process for each connection. If you have too many processes, then either you're allowing too many connections, or you failed to size your server properly for the load you're experiencing. > System: FreeBSD 7.2 Stable I386 > RAM: < 1GB 1G of RAM is not very much for a modern DB server. > Here is the output of the top command: > Mem: 457M Active, 92M Inact, 150M Wired, 23M Cache, 85M Buf, 18M Free > Swap: 999M Total, 150M Used, 849M Free, 14% Inuse I see you only have 1G of swap, you should allocate more than that, 2x RAM is generally recommended. However, to address your RAM question directly, it's difficult to know where your problem is with the information you've provided. Let me take a guess, however. I'm guessing your shared buffers and other memory settings in Postgres are actually very low, and you're blaming Postgres for the memory problem simply because you see a lot of processes in top/ps. You can verify this by looking at these settings in your postgresql.conf: http://www.postgresql.org/docs/8.3/static/runtime-config-resource.html My guess, further is that it's actually Liferay that's using all the memory, it _is_ a Java app, and for all the good things about Java, it's not known for fitting in a small memory footprint. The top output will be a little more informative if you use: top -o res from the command line, which will sort the list by memory usage instead of CPU usage. Remember that whatever value you see for the postgres processes, you can subtract your shared_buffers setting from that, since all the postgres processes are sharing that RAM. > Here is a list of the postgres instances running in my system: [snip] Looks like you have about 30, which isn't very many. As a result, I'd guess that you failed to properly plan your hardware for the load, or the load is higher than you expected. I'm not familiar with "liferay", so I don't know if this is typical, but you might want to investigate your liferay configuration to see if you can convince it to use less connections. > .. > 16:40:18,175 WARN [ResourceActionsUtil:564] Unable to obtain resource > actions for unknown portlet SampleContactUs > 17:45:17,326 WARN [PortalImpl:2948] Current URL > /c/portal/login?p_l_id=10404 generates exception: No Layout exists > with the primary key 10404 > 20:22:57,623 WARN [PortalImpl:2948] Current URL > /c/portal/login?p_l_id=11432 generates exception: No Layout exists > with the primary key 11432 > (END) I'm not sure that this problem is related to the other problems. It looks like your database has become corrupt or your configuration for liferay is corrupt. You'll probably get better assistance if you take this particular question to the Liferay community for help. Hope this points you in the right direction. Feel free to ask again if you hit other snags. -- Bill Moran http://www.potentialtech.com