I’m inadvertently running a WordPress website who has a lot of success right now. The site became really really slow, so I decided to tune it up:
- I recently changed from Apache to Lighttpd
- My static images, js and css are running through Edgecast
- Cloudflare is managing my DNS
Even with this new setup, the site is really slow (i mean a page is loading in ten seconds). Sometimes, the site is not even answering.
I’m still trying to figure out why, so I activated the stat module from Lighttpd. From what I see, most of the requests go to the front page. All of them come from Cloudflare.
My question is : I thought Cloudflare was caching pages. Why is it still asking the frontpage several times in a second?
Since I don’t have any more ideas to speed up the website, I’m also looking for tips if you have any. I think, most of the slowness is caused by WordPress and all the plugins I have.
Any help would be appreciated.
If CloudFlare is turned on on that domain, all requests will go through CloudFlare. This means that your server will only see CloudFlare’s IPs and all requests will look like it is coming from them.
To solve this, there are modules from CloudFlare available, but I don’t believe there is one compatible with Lighttpd. But, there is a CloudFlare plugin for WordPress that will do the same thing.
CloudFlare does not cache HTML (except for the “Always On” feature). Does use it to cache pages because it does not cache pages. It caches static resources like images, js, and css.
Because of this, you still need a page caching plugin. If you want something full featured, then go for W3TC. If you want something simpler, go for HyperCache.
Can’t speak to Cloudflare directly, but you could always install one of the WordPress Caching Plugins.
I recommend Hyper Cache. It’s light-weight and had a straightforward configuration. Others have more beef if you need them.
CloudFlare handles static resources (images/CSS/JS) differently from dynamic content (HTML/PHP). In the case of static resources, you may use HTTP headers to control CDN caching. In the the case of dynamic content, your HTTP headers won’t have any effect on the CDN. The headers are merely forwarded to end-users.
CloudFlare’s “Page Rules” may be used to override this behavior and “Cache Everything”. One might expect this feature to enable HTTP header controls for dynamic content, but headers are still ignored. Instead, the Page Rule’s “Edge TTL” setting is always used. On a free CloudFlare account, the minimum CDN cache time is 2 hours.
Be cautions with conditional content – like admin pages, user account menus, and paid content which, under certain circumstances, could become cached and freely accessible on CloudFlare.
Websites generally benefit from server-side caching, with or without a CDN. Features like database query caching and component caching help reduce the work required to render a page, usually resulting in a performance gain.