I have a GoDaddy shared hosting account that I usually use for hosting personal website (i.e. this one) and a few other websites for friends and family. A portion of TeaBreak’s website is also hosted on the account (TeaBreak is itself on a VPS). I have been using them for over four years now but for the last couple of months GoDaddy’s linux shared hosting has been painfully slow. It was taking minutes (literally) to do anything in WordPress’ admin area.
From my past experience I have found their technical support team to be quite helpful, but for this instance I didn’t bother to contact them mainly because the account was hosting a bunch of personal websites and there wasn’t anything significant that would require a serious action. Additionally, I was kind of busy with other errands and I thought if they suggested a host migration, it wouldn’t probably be the best time for me to handle that (most of the domains have custom DNS settings and are manually managed by me). So I chose to ignore it.
However, over the following weekend I found some spare time while waiting at Starbucks and thought to do some investigation myself. I wanted to find out why it was being slow – was it the network, was it the database, was it the I/O rate or was it simply the webserver being overloaded. I created a small perl script to help me narrow things down (yes, I have SSH access):
- the script executed about 5,000 mysql queries with RAND() and a random interval in between to make it server-friendly (I didn’t want to bring the server to a screeching halt)
- it did some I/O (file) operations by creating a bunch of random HTML files (roughly 100KB of crap)
- I pulled these files on my VPS to measure the network latency and webserver connection times
Just to give you an estimate, an average WordPress page view executes 8-15 queries (depending on plugins installed). So this means that the script modeled a traffic of roughly 500-600 hits. To keep it brief, the stats weren’t very impressive. The values for the 90th percentile were:
- MySQL Query: 2,209 ms
- I/O File write: 1,321 ms (100KB)
- File download time (on my VPS): 1.06 s (Phoenix -> Atlanta)
After looking at the numbers I identified I/O to be the culprit. Now that I had found what was wrong, I wanted to get rid of it. I recalled that GoDaddy had started offering Grid hosting (which is basically shared hosting but backed by a grid infrastructure). Looking at the details I found out that the package would actually cost the same as my current plan. It seems like that they have discontinued the old-fashioned one-shared-box model of hosting and have moved on to the grid-based shared hosting for all new accounts.
After a bit more investigation on the internet, I thought it to be a reasonable offer. Things I cared about were included in the package (like PHP5, Apache 2, SSH access, etc.). I thought to give it a shot given that the current server wasn’t at its best anyway. I upgraded using their hosting control panel and after about 2 days I received an email with my new IP address stating that the migration was complete. I was afraid that there might be some downtime but turns out it went extremely smooth and there wasn’t any noticeable downtime.
Once I was able to shell in to the new server, I wanted to re-run the script again. This time, it showed an improvement of about 30%. Disclaimer: I must mention that the way I was measuring performance is quite error-prone because of other variables like time of the day, current load on the webserver, apache version, etc. To get a second reading, I was also benchmarking the server (i.e. my website) using Pingdom.com. This is what Pingdom showed me before / after migrating to the grid-based hosting. The website was live on the new server roughly around 2nd March:
- Uptime improved noticeably from having brief downtime almost every other day, it hasn’t seen any downtime so far after the migration
- The biggest win is in server response time which went from >5-6 seconds to under ~1.5 sec. (that’s ~70% speed up)
- Disk I/O isn’t super-fast but it doesn’t seem to be waiting as much as before (I suspect it was the IO-wait which was causing the bottleneck before but I can only speculate as I don’t have access to strace on the server)
- Connections to MySQL are a bit faster (but I am not reading much into it as this could just be a red-herring, it really doesn’t matter much as MySQL databases are hosted on separate servers which presumably are near local-network connection latency)
- I am happy!
The Grid-based shared hosting looks much better from what I can tell. There are some subtle differences between the two (i.e. traditional shared v/s grid) like concurrency issues with file writes / locks (might be problematic if your application is doing a lot of file-writes) – they might go out-of-order or possibly lose data. But you will face these issues in any distributed infrastructure so it’s not something specific to them. Also, Java / JSP support is not available yet, I don’t use it so it didn’t really matter to me.