Is it safe to drop page cache on ubuntu ?

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.
[LIST]
[*]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
[/LIST]
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.

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/

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.