Re: Controlling memory of session

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: Controlling memory of session
Дата
Msg-id 20070118105212.GA13669@svr2.hagander.net
обсуждение исходный текст
Ответ на Re: Controlling memory of session  ("James Im" <im-james@hotmail.com>)
Ответы Re: Controlling memory of session  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
On Thu, Jan 18, 2007 at 07:41:27AM +0000, James Im wrote:
> Ok so the solution is to limit the number of connections. But it seems
> that there is no good way to choose the ideal number of connections as I
> don't know how much RAM will a connection use.
>
> If a connection takes 3MB (on windows I see the process in the Process
> Monitor, in Linux the RSS is more like 5MB) just after creation can I
> limit its growth potential so that I know that it will not 6,10, 20MB
> under some circumstances.

What figure exactly are you looking at? If you're just looking at the
values in task manager, that includes the shared pages from the
executable, as well as the shared buffer cache. You'll want to check the
counter for "Private bytes", and nothing else.
(As an example, my *notepad* shows 60Mb virtual size, 8Mb working set,
of which 6.2 is shared, but only 1.5Mb private bytes. So the different
figures you get are completely different)

Either way, the overhead is likely small enough not to really matter
once you factor in shared buffers and work_mem. Your mem usage will be
something along the line of:
shared_buffers + num_connections * (overhead+work_mem*number_of_sorts)


> Not knowing how much RAM can take the server is annoying. You have to be
> extra careful and scale the server down as you don't know what will happen.

The fact that work_mem is "per sort" and not "per backend" is going to
cause you more problems than the overhead in trying to figure out how
far you can do. The fact that there is no "work_mem per backend" is
certainly very annoying, but it's obviously hard to fix or it would've
been fixed already :-)

//Magnus

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

Предыдущее
От: Hannes Dorbath
Дата:
Сообщение: Re: Ask about large database?
Следующее
От: Jorge Godoy
Дата:
Сообщение: Re: [1/2 OFF] Varlena.com inaccessible from .br (Blocked?)