Site Is Either Really Slow Or Really Fast, Any Ideas?

I have a site running on an ec2 instance with low cpu usage and lots of free memory. When you hit pages on the site there is a long wait (15-16 seconds) before first byte time. This is inconsistent though as it will also frequently have short wait times (350-500ms).

My dns is hosted by route53, and the server is WAY overkill for what it needs. I can’t figure out what the issue might be. Any ideas?

I’ve got APC setup and memcache.

Ubuntu, Apache, Mysql (RDS), and PHP…using yii framework.

So I appear to have found the source of the issue. I was using AWS elasticache for memcache in my yii application. When I disabled that…it works like a dream every time. I do not understand WHY that would slow the response time DOWN, and why it would only do it sometimes, but at least I have some degree of isolation on it.

Hello dmapes123. Could you show your Yii’s config file with the AWS elasticache section? I am trying to set the AWS elasticache memcached option

$static_client->setOption(Memcached::OPT_CLIENT_MODE, Memcached::STATIC_CLIENT_MODE);

but I don’t know any way to get it.