Saturday, November 18, 2017

Yet Another Peril of Shared Hosting: Process Limits

So: I've been using Hostgator (not a referral link, I just like them) as my web host for lo on 15 years now, and occasionally blog about problems that come up and how to solve them. I think I've solved a new set of them after an informative chat with their tech support.

For the last several months (at least), the admin sections of my Wordpress sites have slowed down and started throwing off an unusual number of 500 server errors. It wasn't that bad for me, but it seemed to be really bad for Steve when he was trying to enter content for Rational Review News Digest, and it would be worse for both of us when I was online at the same time, proofing and scheduling items as quick as he entered them.

So, Hostgator (and lots of other hosts) like to advertise "unlimited storage" and "unlimited bandwidth" for shared hosting accounts, and that much is true. A little less well known is the limit on CPU capacity. That is, your sites are on one computer with several other people's sites, and your site can't be allowed to hog the resources in terms of CPU capacity. If I recall correctly, the user limit is 20%. That is, if your sites are using more than 20% of the CPU's available cycles for more than a short time, Hostgator is going to come down on you. It usually starts with a warning message letting you know there's a problem, and shortly thereafter people visiting your sites get a "suspended" message instead of the sites themselves.

A pat on the back to Hostgator: The last time the above happened to me, it was obvious that I was under a DDoS attack or the equivalent. There were suddenly thousands of content requests coming in (direct to the server, not through my Cloudflare DNS proxies) for no apparent reason. The database queries hogged up processor cycles. I got the warning message, took a look, got on support chat, and within minutes Hostgator agreed that that was the problem and did something about it instead of shutting down my sites and expecting me to deal with it.

That wasn't the problem this time. In tech support chat I learned about another limit that you don't see in the big up-front "unlimited storage, unlimited bandwidth" promotional language. That's a limit on the number of processes that can be going on at a time, each "process" being whenever one of your programs is doing something that talks to the CPU.

This isn't a limit on how much of the CPU's power is being used, it's a limit on how many things can be using that power at one time. At Hostgator (and at a couple of other hosts I was able to find information on this from), the "process limit" is 20-25. Go above a "soft limit" of 20 and weird stuff starts happening. Things slow down. Users start seeing "500 Server Error" messages.

The biggest culprit for bloated process numbers in Wordpress sites, my Googling told me, are the "plug-ins" that do various things. Every one of those plug-ins that does something every time a page is displayed will create additional processes. I spent quite a bit of time yesterday going through various plug-ins, thinking about how resource-intensive they might be in terms of processes, and ditching the likely resource hogs I could live without.

In particular, I ditched a really cool plug-in that I suspected was using all kinds of resources and that hadn't produced results I had hoped for -- not because it didn't do what it does, but because apparently nobody cares. That plug-in is called Transposh. Every time I wrote an article at The Garrison Center, it would automatically create versions of that article in a crap ton of other languages. Looking through my stats, I didn't see any people visiting the versions of my articles that were in Tagalog or Hungarian or whatever, so I axed it ... and suddenly my process count was way down and all of my sites were running the way they should be.

So: If you're noticing slow Wordpress site behavior or getting 500 errors, check out your "processes" and look at your plug-ins. There are lots of neat plug-ins that do lots of neat things, but they don't do those things with magic, they do them by acting as processes that use CPU power. If your web hosting uses the popular cPanel admin tool, you can find your process usage over in the left sidebar:


1 comment:

Anonymous said...

Thanks for sharing your thoughts on hosting.
Regards