Slow I/O due to APC

Ruriko asked:

I have a vps running Ubuntu 10.04 with nginx as my webserver. I use APC for php caching and I noticed my server is doing lots of disk queries which resulted me having slower I/O. I have about +50 sites running on my vps and all are running wordpress. The vps has 2GB RAM with 2GB SWAP. I notice APC has used 100% fragments. You can see my apc stats here

Could anyone help me optimize APC? cause it’s causing slow I/O

top - 09:34:24 up 2 days, 22:02,  1 user,  load average: 0.39, 0.41, 0.32
Tasks:  25 total,   1 running,  24 sleeping,   0 stopped,   0 zombie
Cpu(s):  3.3%us,  0.9%sy,  0.0%ni, 95.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   4194304k total,   849228k used,  3345076k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

My answer:

You gave the APC cache 2GB of RAM, but your VPS only has 2GB of RAM! Therefore the system must swap in order to do anything at all.

To resolve the problem, reduce the size of the APC cache, or add more RAM.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.