Like a Buffet Restaurant?!
You have booked yourself and a couple of friends to this nice seafood buffet restaurant downtown. It has everything -- nice food (and lots of them), good experience, live music, and the best of all -- it is cheap. It costs you only five bucks to enter, and you can eat as much you want. Moreover they will actually half your bill if you bring your friends along. What a bargain.
However, when you arrived at the door and paid the admission, you noticed something. Because of this great deal, the restaurant is crowded with customers. Fully packed. People everywhere. Everyone wants to come and enjoy their cheap buffet meal, and apparently there is not enough tables to sit! People walk around carrying their plates, and some of them have just decided to sit on the floor with their oysters, prawns and lobsters. Though the food is plenty, it takes ages to queue up. Not happy.
So the management thought of an idea -- how about restricting diners how much time they must finish their meals? They still provide unlimited amount of food, and you can eat as much you want, but you only have 10 minutes to eat them all. When the time is up, you will either be asked to leave, or be asked to pay extra for your own table.
Well, you can feed yourself and be satisfied in 10 minutes, if you really try. But that's more of a "hack", then an enjoyable dining experience.
And sometimes being on a shared host with DreamHost is like that.
CPU Minutes Hell
First of all, I must admit that I had been advocating DreamHost. I welcomed their recent custom DNS change and diskspace/bandwidth increase. I loved their affiliation program -- and I have almost earned enough through my promotion code to cover my one year hosting cost. They are that generous cheap buffet restaurant, and everyone loves their deals. And because of their affiliation program, no wonder everyone is saying good things about them (with their own referral code posted along side, of course).
But popularity often ends up in overselling. The box I am on might have 2x 2.8Ghz Xeon with HT and 2Gb of RAM, but at the same time it also hosts 500+ user accounts and 1,000+ websites (many I believe might be dead accounts/dead sites)! It certainly doesn't feel fast. Loading Playground's index page is usually 1.5-2 second job, which is actually slower than serving from my Pentium III 450Mhz server at home, which usually sits idle.
I guess one issue is how PHP pages are served. In a shared hosting environment, for security reason it is recommended to serve PHP pages using suexec+CGI, so that PHP process runs with webmaster's uid/gid. It introduced the exact problem which
mod_php was designed to solve -- forking new processes for each dynamic page is slow and expensive. However, when you share a web server with 500 other accounts, you'll rather have slow page loads than password file stolen by someone else.
The other problem is DreamHost's CPU minutes limit, which is not really visible when you sign up. On the page it says:
We measure server resource consumption in CPU minutes. This number indicates how much time a processor spends working for your username. All shared hosting customers should use less than 60 cpu minutes per day for all their users on their account.
It turns out that 60 CPU minute is not really 60 minutes of CPU slice (which would be generous), but 60 minutes of execution time of your processes. I am not really worrying about it at the moment, but my sites, totaling only 1,000 visitors per day, are already using 15+ CPU minutes, yet only 2Gb of bandwidth is consumed every month. You might have a great big buffet, but diners cannot really enjoy it due to time limits!
(Update: Actually I am not very sure about the way CPU minutes are calculated -- I better go and read about GNU system accounting. It cannot be the whole execution time as my
bash process would kill my limit straight away. It cannot be just user + sys CPU time, as there is no way a WordPress page taking 1 second to generate would use 1 second CPU time -- it should be around 0.1-0.2 seconds on this kind of hardware. Maybe time waiting for blocked IO is counted?)
And what if you have exceed the limit? Leave, or pay for your own table. Oh, I mean, get your own dedicated server.
If you search for DreamHost CPU minutes on Google, you'll find out many other users ran into this same problem way before their disk/bandwidth allocation is exhausted. At the end, that only means DreamHost shared hosting is only useful for small dynamic sites, or large static sites. Although by looking at the CMS packages today, it would be hard pressed to find people working on pure static sites.
What would I do?
What does that imply? For now, I still have lots of CPU cycle to spare, and I don't really need to worry unless my traffic go quadrupled as well. However when my account is due for renewal, depending on my statistics then, I might consider switching to a Xen-based VPS hosting, for that root account and "guaranteed" CPU cycles.
Update 2006-05-12: A few months after I have written this blog entry, it somehow becomes the first result on Google SERP if you search for "DreamHost CPU Minute" (and second on Yahoo). Just let me update what has been happening over the last few months since I first wrote this entry.
First of all, this blog is still getting only around 1,000 visitors per day -- I suck at blog marketing. In another word -- I am still safe from crossing the CPU minutes limit. However I also use my DreamHost account to host other sites now. We'll see.
Secondly, WP-Cache2 helps. Heaps, as John B has suggested here. A subsequent load of the same page is now much faster. I just need more visitors to make caching worthwhile :)
Thirdly, I have indeed got myself a VPS plan. At a bit more than twice the monthly cost of DreamHost, it is much faster and much more flexible. It is definitely a path people should look at if you are competent in getting a Linux server up and running.
Fourthly, note the title of this blog entry -- Dark side of DreamHost (and SHARED HOSTING). Issue with CPU minutes is not limited to DreamHost -- if you search around many budget shared hosting companies have similar problems. In fact DreamHost is the one who is very clear about their threshold, and has provided system accounting option for you to diagnose the offending scripts. Many others just kick you out without any explanation. DreamHost should be applaused for that.
Finally, DreamHost has improved over the last few weeks. January was slow -- probably due to their large influx of new sign ups as they upgraded their plans. Since then they have fixed their DNS issue which makes connecting to MySQL much faster. My VPS is still 3 to 4 times faster in rendering WordPress pages, but I am generally happy with my DreamHost account. Moreover, through its affiliation program I have already made enough to give me 3 more yers of free hosting. I might as well stay.
More on DreamHost affiliation can be read here -- Exploring DreamHost Promo/Discount Code.
Update 2006-06-09: DreamHost has announced no more CPU minute limit on their May news letter. No, it does not mean "unlimited CPU resource", but instead DreamHost will impose a softer limit and they will be working with their customers over resource hogging sites. I have written my response here at HostingFu.com.
Update 2006-06-18: I have moved this site off from DreamHost and it now sits on an OpenVZ VPS I purchased from VPSLink. It just feels faster, though the host server is much inferior (a P4 3.0Gb with 4Gb RAM). I still have quite a few sites on DreamHost, but I probably won't put anything CPU intensive on it...