Not the answer you need?
Register and ask your own question!

Is it safe to drop page cache on ubuntu ?

sungju hongsungju hong EntrantCurrent User Role Beginner
Hello,

I am using MySQL 5.6 on ubuntu 14.04.
MySQL server was killed by OS yesterday. (oom kill)

I investigated the memory usage.

$ free -m
total used free shared buffers cached
Mem: 122952 121468 1483 0 285 44494
-/+ buffers/cache: 76689 46263
Swap: 0 0 0
$

It is a dedicated database server but so much "cached".
So I have a plan for dropping page cache.
  • To free pagecache:

    $ echo 1 > /proc/sys/vm/drop_caches
  • To free dentries and inodes:

    $ echo 2 > /proc/sys/vm/drop_caches
  • To free pagecache, dentries and inodes:

    $ echo 3 > /proc/sys/vm/drop_caches
Can anyone let me know it is safe to drop page cache ?
Does it can have any side effect ?

I have a ubuntu server that just one MySQL server is running on.

Thanks.

Comments

  • niljoshiniljoshi MySQL Sage Inactive User Role Beginner
    Hi,

    drop = sync linux page cache to disk immediately, but it will not help with oom kill. To fix oom kill problem mysql buffers should have right size for this server. I would suggest to check all parameters and find how much memory is used by MySQL.
    Check this blog post: http://www.percona.com/blog/2014/01/24/mysql-server-memory-usage-2/
  • sungju hongsungju hong Entrant Current User Role Beginner
    Hello niljoshi

    I found some parameters that might cause the oom kill.

    so, I decided to modify the parameters as follows.

    unit : kb
    read_rnd_buffer_size 16,384 -> 256
    sort_buffer_size 8,192 -> 256
    join_buffer_size 8,192 -> 256

    Really thanks to reply.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.