Re: Too many postgres instances

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Re: Too many postgres instances
Дата
Msg-id 20090618074514.b82c868b.wmoran@potentialtech.com
обсуждение исходный текст
Ответ на Too many postgres instances  (Sam Wun <swun2010@gmail.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Sam Wun
Дата:
Сообщение: Too many postgres instances
Следующее
От: David Shen
Дата:
Сообщение: connecting to a remote pq always require a password