Обсуждение: Cached Memory increasing up and drop the caches through sync; echo 1 > /proc/sys/vm/drop_caches

Поиск
Список
Период
Сортировка

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

От
"AL-Temimi, Muthana"
Дата:

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.

 

Any help will be gratefull

 

 

Muthana AL-Temimi

M.Sc. Informations- und Kommunikations-Systeme

 

Technische Universitaet Hamburg Harburg

-Rechenzentrum-

Am Schwarzenberg-Campus 3

D-21073 Hamburg

 

Tel.:  +49.40.42878.2338

Fax.: +49.40.42793.5160

E-Mail: m.al@tu-harburg.de

http://www.tu-harburg.de/rzt

 

 

"AL-Temimi, Muthana" <muthana.al-temimi@tu-harburg.hamburg.de>
wrote:

> 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.

The only problem would be that performance would tend to be poor if
you discard the OS cache.

> Because I have a problem with cached memory on the linux Server
> beacaue there are increasing in cached memory till swap.

You probably have not configured PostgreSQL very well.  Please
describe your hardware and OS and show the results of running these
queries:

SELECT version();
SELECT name, current_setting(name), SOURCE
  FROM pg_settings
  WHERE SOURCE NOT IN ('default', 'override');

Also, if you could show about 30 seconds of output from `vmstat 1`
while the swapping is happening, that would help us provide useful
advice.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Mon, Jul 6, 2015 at 1:50 AM, AL-Temimi, Muthana
<muthana.al-temimi@tu-harburg.hamburg.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.