Search Postgresql Archives

Re: Controlling memory of session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux