Linux using most of the memory for cache

I had a very strange WTF-moment yesterday, when I noticed that one of our servers had hogged most of the momery – almost 3 gigs – to linux kernel cache, which meant that the appserver had only a tiny fraction of memory to start on with, and ran quite fast into problems with starting new threads etc. Happy times to no-one.

As I hadn’t ever before had similar experience of seeing almost all the memory taken by no process, but the kernel itself, I was little worried. Luckily Google helped me to find info on how to drop linux caches:

http://www.ubuntu-unleashed.com/2008/04/free-up-cache-memory-in-linux.html

So effectively running as root:

echo 1 > /proc/sys/vm/drop_caches

echo 2 > /proc/sys/vm/drop_caches

echo 3 > /proc/sys/vm/drop_caches

.. dropped caches and appserver was free to start again.

Live and learn.

-huima

This entry was posted in technology. Bookmark the permalink.

2 vastausta artikkeliin: Linux using most of the memory for cache

  1. Tel sanoo:

    Your app server has other problems, the cache is not your enemy.

    Active process space always takes priority over cache, so dropping the cache merely makes your drives work harder and slows everything down.

  2. huima sanoo:

    Tel:

    Normally I would agree and I do know that process space should take priority over caches. However for some reason that did not happen. I was running JDK 1.6 and Resin 3.1.8 – and after dropping caches everything works swimmingly. Caches are back at reasonable 800 megs instead of 3 gigs.

Vastaa

Täytä tietosi alle tai klikkaa kuvaketta kirjautuaksesi sisään:

WordPress.com-logo

Olet kommentoimassa WordPress.com -tilin nimissä. Log Out / Muuta )

Twitter-kuva

Olet kommentoimassa Twitter -tilin nimissä. Log Out / Muuta )

Facebook-kuva

Olet kommentoimassa Facebook -tilin nimissä. Log Out / Muuta )

Google+ photo

Olet kommentoimassa Google+ -tilin nimissä. Log Out / Muuta )

Muodostetaan yhteyttä palveluun %s