Re: Cached Memory increasing up and drop the caches through sync; echo 1 > /proc/sys/vm/drop_caches

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: "AL-Temimi, Muthana" <muthana(dot)al-temimi(at)tu-harburg(dot)hamburg(dot)de>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Cached Memory increasing up and drop the caches through sync; echo 1 > /proc/sys/vm/drop_caches
Date: 2015-07-06 18:40:38
Message-ID: CAOR=d=3KMbCpUmdfJuAPm6pSLJNDsPZFvJ2wXAhaPri_imEviw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Jul 6, 2015 at 1:50 AM, AL-Temimi, Muthana
<muthana(dot)al-temimi(at)tu-harburg(dot)hamburg(dot)de> wrote:
> Hello there,
>
>
>
> is there any problem if I use the following command: “sync; echo 1 >
> /proc/sys/vm/drop_caches” to release the cached memory on linux server.
>
>
>
> Because I have a problem with cached memory on the linux Server beacaue
> there are increasing in cached memory till swap. Therefore I’m looking for
> workaround job works daily night to release the cached memory.
>
>
>
> But if I used it will be there a lost in information. I used the sync before
> drop the caches.

It's perfectly safe to drop cache, however, this is the wrong solution
to your problem. A few points.

1: older kernels don't do well with large memory and swap, and make
some questionable decisions. In the past I have simply turned off swap
on machines with a lot of memory due to this behaviour. Let's face it,
if a machine with 256G RAM needs swap, something's gone terribly wrong
with memory usage.

2: there are tunables that will slow down this behaviour, if not
outright stop it, particularly the vm.swappiness setting. See sysctl
for how to set that to 0.

3: You need to define your problem better for us. To give advice we
need to see what's happening. Linux tends to swap out little used
stuff to make room for cache. In this case you may not have an actual
problem to worry about anyway.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kiki Sugiaman 2015-07-06 23:26:33 Re: Running two postgresql servers in same Ubuntu machine
Previous Message Kevin Grittner 2015-07-06 15:37:26 Re: Cached Memory increasing up and drop the caches through sync; echo 1 > /proc/sys/vm/drop_caches