Hosting is cheaper than virtual server or dedicated machine on a network. This fact is true because resources are shared between many customers and one can place hundreds of accounts on one physical server. Adding too much accounts leads to slowing server responses and to instability in general. It's called overselling. Do you know how to check if your hosting account is overselled?
The Fighters
I'm comparing three hosting providers here:
- DreamHost.com - popular host provider from USA
- Kei.pl - good hosting, 24/7 administration from Poland
- Linuxpl.com - Polish company, servers in Germany, cheap hosting with SSH option
I'm using separate Linux box located in Poland to reach analysed servers with few tools (awk, cron, bash).
The Time
First, the most important value you can measure is time to get a response from your server. Of course checking only for ping values is not sufficient here. You have to measure HTTP traffic (typical task for hosting account is to serve content by HTTP protocol). Let's think about what resources can slow down your response time:
- CPU (too much load caused by other customers)
- bandwidth (too much concurrent traffic to/from server)
- SQL database overload (typically on separate server)
Let's observer three hostings in work by measuring their time to get simple dynamically generated page (5 minute interval):
A legend:
- red: DreamHost.com
- green: Kei.pl
- blue: Linuxpl.com
As you can see sometimes server uses very log time to get pages (up to 14 seconds). You can see how often such situation occurs and make histogram from time. Lets zoom fragment of this graph:
You can see differences here between server in the same country (low ping values) and from USA (higher minimal time = pings above 200 ms). The closest server (green) has higher average time value because of higher variance.
I added -1 value if HTTP client (here: wget) returned an error during fetching a page. You can see red host (DreamHost) was inaccessible by 25 minutes. Let's compare average time to get a page:
- Kei.pl: 0,522 s
- Linuxpl.com: 0,330 s
- Dreamhost.com: 0,747 s
Availability
The higher availability - less page visitors will see blank screen during viewing your page. You can measure that parameter by collecting response time (shown above) and compare failed (or very slow) responses to all responses. You can get percentage availability then. Lets assume more than 4 seconds as unacceptable slow value. Here are the results:
- Kei.pl: 99,4914 %
- Linuxpl.com: 98,5758 %
- Dreamhost.com: 99,0854 %
So: the best is the more expensive from the three taken into account.
CPU Load & database
Let's control how CPU load and DB efficiency impact on time to get response on DreamHost account. We measure inside server to get load values and use 1-minute interval to get data from system:
Legend:
- red: CPU loadavg (1-minute)
- green: time to fetch locally file via HTTP CGI script that's not connecting DB
- blue: time to fetch locally file via HTTP that use SQL connection
Let's zoom interesting fragment:
As you can see:
- simple scripts can operate efficiently with high (30) load
- average load of my server is pretty good (under 2)
- peak load is not very big (30 - once per few days)
- there's a factor that has impact on execution time, but it's not load average (see next picture). It's a SQL database load that's not directly measured
Why I will not use DreamHost for any serious task?
Let's see situation after one week:
And look into interesting fragment:
You see regular page loading (with SQL queries) over 10 seconds over 7 hours! No comments.
Summary
Using simple tools (wget, cron, bash) you can measure parameter of your new hosting account and decide if it has enough level of availability (it's not oversold). I had many critical problems with load average in the past with few hosting companies so it's better to monitor host for a while before any serious web application is placed on new hosting.