Re: vacuumdb causes memory drain.

From: Sushil Shirodkar <sushilps(at)hotmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: "don(at)seiler(dot)us" <don(at)seiler(dot)us>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: vacuumdb causes memory drain.
Date: 2018-04-30 01:23:57
Message-ID: 55DDA52C-9FA1-47FF-9E96-264A8522E7A1@hotmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin


> On Apr 27, 2018, at 8:39 AM, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
>
> Sushil Shirodkar wrote:
>>>>>> On Thu, Apr 26, 2018 at 10:31 AM, Sushil Shirodkar <sushilps(at)hotmail(dot)com> wrote:
>>>>>> Running "vacuumdb -a -z -v" from the cron on one of our test environment, and
>>>>>> noticed that memory of the server goes down from 3.4GB free to 150MB. Once
>>>>>> the process is over, memory is not released, is it normal or something needs to be
>>>>>> changed ? also other processes start running slow afterwards due to low memory.
>>>>>
>>>>> How are you measuring free memory? Memory might be listed in cached/buffers instead of
>>>>> free but is still available. Although that wouldn't then explain other processes being slow.
>>>>
>>>> I have put some small script which runs in a loop with "free -h" command,
>>>> while I am running "vacuumdb". Once I clear by "sync" or bounce PG,
>>>> everything runs normal afterward.
>>>
>>> Then I would say everything is fine.
>>> It is normal for a Linux system to have almost no free memory; the memory is used
>>> for the file system cache.
>>>
>>> Do you experience any problems, like reduced performance or high I/O?
>>>
>> Performance issue.
>>
>> Can I restrict memory usage at session level in the script where I run
>> Vacuum DB ?
>
> Could you please bottom-post?
>
> Once vacuumdb is done, the associated backend process is gone too, so
> it cannot consume any memory.
>
> Try to figure out which process consumes your memory.
>
> What do you get for free -h?
>
> How did you configure shared_buffers and maintenance_work_mem?
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com

Sorry for the delayed response.

Process which was running close to 99% memory was
"/usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf"

free -h - was showing between 100-150 mb free.

shared_buffers = 1GB
maintenance_work_mem = 256MB

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2018-04-30 05:43:03 Re: vacuumdb causes memory drain.
Previous Message mk1221 2018-04-28 04:46:41 C-function in windows