I am not that strong in linux / unix so asking for any help on problem I have. I am running site on amazon ec2. I am running apache tomcat mysql on one large instance 8gb of RAM. Database is quite large but I don't have problems with performance and there is around 3gb of free memory on the box. I noticed that about once in a hour box becomes virtually frozen, so site is not responding and even ssh shell is very slow. I enabled performance monitoring and noticed that amazon reports that each hour or so there are huge disk i/o spikes.

I am running UBUNTU with kernel release 2.6.32-305-ec2 So I started monitor with vmstat and noticed that in normal operation box reports around 1.5gb free memory and 2gb of cache and cache is gradually grows. but at some point cache starts growing takes whole ram leaving like 1mb free or something like that. And then I see lots of processes waiting for disk and everything depening on drives i/o freezes. It lasts from 3 to 5 minutes usually. My understanding that system is dumping cache to the drive and freeing memory and that is what causing all that mess. I did not have this problem before I think it started recently when I loaded much more data in mysql. But again there are plenty of free memory it just management of the memory and cache by linux causing it. I read that it should be seamless and it is good thing to have buffer cache but having site down for 5 minutes each hour is definitely bad thing for me. Please advice what options I have with it. I could not find anything on internet.