An interesting thing and general misconception about website caching is that caching is good. Well yes, it can be. But do you really need caching? I think most people do not…
This post is not about how useful Caching can be. It is about how people misuse caching and the illusion of making things better.
most people use caching to make up for sloppy shared hosting
That’s right. You have found the cheapest hosting provider you could get and now you discovered your site is slow. Like any sane person everything is to blame but the server. Because the provider says its “quality premium ultra hosting on fast and reliable servers” and they’re experts.
Well, think again; you’re to blame for being cheap. Your provider is to blame for offering crap hosting packages. Everybody looses.
So what is caching?
Caching is a method of speeding up your site or lessening the server load by having the caching software generate HTML files and store them in a static location. This generally means that your server has less to do so can do things faster. Which is a good thing.
The generated HTML files do not talk to the Database server, nor do they require tons of PHP code to be generated on pageload. This saves Processor capacity, uses less memory and prevents MySQL connection clogging. If set up correctly this means your site may be faster.
Shared hosting generally sucks
Yes it’s cheap, yes it works, yes you got screwed.
Why? Because 9 out of 10 hosting companies oversell their server capacity. They assume that you, the common user, will not use 100% of your allotted resources. Thus that “spare” power can be sold again, and again.
Think of the server as a swimming pool. And you rent that pool for you alone. But it’s big enough for 10 people. So the owner of the pool rents out the pool 9 more times. Because you, a single person, only uses 10%. And you’re not always there either. So why stop at 10 people. 20 will fit too.
And yes, it’s the most common and most popular form of hosting in the world. And the internet thrives on it. But it’s also the worst form of hosting. Often you don’t even get proper separation from other customers in terms of resource pooling.
Why that matters for caching
All those people clustered together, sharing computer resources and hogging up connections will take it’s toll. Usually on speed. Logically you complain. You paid for your fancy hosting and it’s not as fast as promised.
Almost always their response will be that your site uses too much CPU or memory. Or has too many open connections to your database… But they have a fix for that. And that is that you set up caching. This will lessen the load and make things faster. It’s win win. Except it’s not.
If the hosting would actually be sufficient for your needs you very likely wouldn’t need caching. Simple as that. Sure you can install a caching solution to make it faster. But it shouldn’t be the solution to make up for underperforming servers.
On my websites I do not use caching, but I do use a CDN for images. This makes sites a bit more smooth yet I don’t have to deal with actual caching.
Small sites using shared hosting is fine. Even on a server that is heavily oversold. Since it’ s small site. You don’t use a ton of resources. Your user base is probably not too bothered with the site being a tiny bit slower.
Larger sites should seriously upgrade to “real” hosting. Some sort of premium package with higher limits. Or a dedicated server or higher end VPS. Simply because more visitors require more resources. Shared hosting by design can’t provide that without crippling everyones experience. Caching may appear to be the solution. But it’s a sham to compensate for your underperforming hosting package.
It happens all the time. I see it almost every day. Sometimes people using my AdRotate plugin complain about their site being slow. A quick investigation often points out dumb limitations in their shared hosting package causing the slowdown.
Limitations such as 4-10 simultaneous MySQL connections. A maximum on server threads. A cap on Ram or CPU usage. In some cases you wonder why those sites can even be online during peak hours because they’re so slow and unwieldy.
But hey, you got cheap $3/month hosting…
The viable solution
Admit you’re successful. You have thousands of visitors per day. Pull out that wallet. Upgrade to a larger hosting contract. Invest in some proper infrastructure and stop being cheap!
Find a hosting provider that…
… does not limit your MySQL connections.
… does not limit your IMAP connections.
… allows you to set your *own* memory limit. Or has a reasonably high (128MB or more) limit.
… does not throw you in a resource pool with 300 others on one server to fight for CPU cycles.
Better yet. Hire a respectable dedicated server or a higher tier VPS (with reasonable resource allocation). Usually any type of hosting has a whole bunch of limitations and shortcomings. However, on a dedicated server or VPS the bar is set a lot higher and often allows for customized configurations you can make/configure yourself.
None of my sites use Caching. As mentioned, I do use a CDN for images. This is enough of a boost as far as I can tell. I rent a managed VPS. It costs about $50 USD a month and it’s worth it.