VPS hosting – Linode FTW

Linode logo transparentWhen I migrated this site from shared hosting to a VPS, I initially went with some really cheap hosting, and I got what I paid for: The site went down often, like every week or so. Sometimes for days at a time. Support tickets went ignored and unanswered, and I was generally a sad puppy.

After a month or two of this I’d had enough, and decided to migrate the site hosting away from Cheap-O-Host to a company called Linode – and I’ve got to say – it’s been absolutely flawless ever since. I can’t even remember the last time the site went down.

This isn’t to say I haven’t had issues with Apache bogging down and basically killing the site by trying to use more RAM than the VPS has available. If I got more concurrent connections than I had RAM for, then some il-advised Apache settings meant that the server would get into swap territory, and the entire thing would grind to a halt from which the only escape was to log into the VPS from the web interface and reboot it. But this wasn’t Linode’s fault – it was mine for trying to do to much with too little.

I finally solved the problem by disabling all the apache modules I didn’t need (which lowered the RAM usage per Apache process, as well as lowering the server’s attack surface), and limiting the concurrent connections to a number that would happily fit within 512MB of RAM – and since then, not a cough or a hiccup. Everything has been running beautifully.

In fact, at the time of writing, my VPS uptime stats are:

# uptime
21:15:38 up 244 days, 12:26,  1 user,  load average: 0.10, 0.07, 0.06

244 days without as much as a reboot! Sweet!

I’m just writing this post to commend Linode because I got yet another monthly email (from siteuptime.com) today saying “site up-time: 100%” and… well, if something goes wrong then people (and definitely me included, here) tend to jump up and down and make a noise – but when something goes right – we generally don’t say anything at all. Which makes the cost of failure getting slagged off, and the reward for success merely not getting slagged off.

As that’s not a particularly good system, I wanted to say something positive about Linode, because it’s not an accident that their systems so rarely go down – I’m sure that it’s entirely due to their hard work, professionalism, and investment & re-investment in the company infrastructure. And I absolutely cannot fault them on that.

So well done, Linode! You guys rock! =D

P.S. For anyone trying to minimise their apache footprint, the minimal set of apache modules I found I needed to run a wordpress site are:

  • alias
  • authz_default
  • deflate
  • dir
  • env
  • expires
  • headers
  • mime
  • php5
  • reqtimeout
  • rewrite, and
  • setenvif

And my final, working Apache prefork MPM settings in apache2.conf for a VPS with 512MB of RAM are:

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          4
    MinSpareServers       1
    MaxSpareServers       1
    MaxClients            13
    MaxRequestsPerChild   5000

In my experience, the above config will happily serve tens of thousands of hits per day without getting to a stage where a VPS with 512MB of RAM starts to page out excessively, and without dropping incoming connections. Of course, this won’t stop a site getting flattened, but it’s a pretty good middle ground to cope with a large amount of hits with a low amount of RAM.


6 thoughts on “VPS hosting – Linode FTW”

    1. Interesting… I don’t know. I guess you can trust it more than most providers, as Linode seem to be a very robust & professional company – but nothing’s ever perfect and sometimes accounts get hacked.

      I just ran lastlog | more and everything looks okay (and no new accounts) – but yeah, I can see your point.

  1. Sounds good!
    What would you prefer, basic site hosting or VPS? At the moment I am on site hosting with Just Host (www.justhot.com) and for a few $$ a month I get unlimited space etc..

    1. Hey Rob!

      Sorry for not getting back to you for a few days, but you asked a big question, and since I wanted to answer it properly and have been under a crushing workload all week, I thought a late “good” answer would be better than a quick “bad” one.

      Okay – so basic hosting or VPS: I’m going to say it’s horses for courses, but for me, a VPS is by far the best choice.

      With basic hosting, everything is set up for you. The hosting provider just adds a directory called [YOUR-HOST-NAME] to the /var/www/ directory on one of their servers, and adds a A/AAAA/MX record to their DNS servers + some email and FTP details to their allowable clients config.

      This means your site gets hosted and is reachable, and you have email and FTP and all that – but it’s all unevenly shared. All the sites at your web address reside at the same IP (which won’t resolve with a traceroute [or tracert on Windows] because the same IP resolves to multiple URLs), and they all use the CPU as needed, they all use the hard-drive as required, they all use that server’s network bandwidth as required.

      So let’s say you add small piece of JavaScript to your header that kicks off some massive number-crunching operation on your server – EVERYBODY hosted on that server will suffer. Pages will load slower, respond slower, and generally it’s a drag. However, the basic hosting providers mitigate against this by putting in their terms and conditions that if you monopolise their server, they’re going to discontinue your hosting – pronto.

      So in basic hosting, you all share the same kernel instance, the same apache instance, the same email instance etc. – and you take resources as required. If you want resources which cannot be made available, then you simply wait until it becomes available or times out. For everyday hosting of small sites – basic hosting is fine. But other users of the same server can be jerks, and end up taking your site offline.

      VPS’s on the other hand are a different beast. Instead of handing out resources (CPU time, I/O bandwidth etc.) on a first-come-first-served basis, the server is separated into separate “sections” through virtualisation software like Xen or OpenVZ. So what you get with a VPS is that instead of a fighting over the same resource, you get a “slice” of the resource. If there are 100 websites running as 100 separate VPS slices, then we each run our own kernel, and we each get 1/100th of the available CPU resources etc.

      What’s nice about this is that it’s like you have a single, limited machine – but it’s your machine. If I decide to crunch numbers on my slice of the server then fine! Because I’ll just be using up my 100th of a second, and I won’t be affecting any other sites hosted on the same physical machine. I can reboot it when I want, upgrade it when I want – it’s my box to do with as I please.

      The downside of having an unmanaged VPS lie this, however, is that it’s a basically a PC, which you can log into through SSH or such. And that’s it. That’s all it does.

      It doesn’t come with a webserver like Apache or NGinx setup and ready to go.
      It doesn’t come with an FTP server setup and ready to go.
      It doesn’t even come with an email server and Mail Transfer Agent (MTA) setup and ready to go.

      YOU have to do all these things on your “slice” of the server. And it turns out that it can be a big technical effort to make it all work.

      I’ve set up email/MTAs, FTP, tweaked Apache tons etc. on my VPS – and it took me days and days of reading and experimenting to get it up and running. Of course, if I had to do it again now, it’d take me an hour or two because I’ve already sussed it. But it’s pretty tough-going if you’ve never done it before.

      You can, of course, pay a few hundred bucks per month to run a managed VPS (as opposed to unamanaged as we’ve been talking about) where all of this is taken care of for you – but for a small-scale just-for-fun thing like this – it’s just not worth it.

      I think I pay Linode around $200 a year for hosting, and for that I get a 512MB slice of a server with 20GB storage and 200GB bandwidth, which is more than I’ll ever need – although the RAM limit is cutting it tight sometimes, so I’ve had to tweak Apache a bunch to minimise it’s per-process RAM usage.

      To compensate for the $200 hosting fee, I’ve put 2 Google AdSense adverts on my site, which you don’t even see if you run AdBlockPlus, and they basically pay the vast majority hosting for me over the course of the year. I don’t ask anyone to click on anything – they just can if they want to.

      So that’s why I prefer a VPS over basic hosting!

      Catch you soon,

      P.S. If you’re doing Cert IV Multimedia next year then yeah, I’ll be teaching ya for the programming stream. Buckle-up, Buttercup =P

      1. Is that backed up for you? Or do you have to do that?
        What about browsing stats? If it’s manual, what do you use?

        Only answer when you have pleeeeeeeenty of spare time :)

        1. You can pay extra for scheduled backups if you want to… but I don’t.

          Instead, I just have a copy of all my working config files, so if it all goes to hell I can just re-install the applications (apache, courier, proftp etc) and re-upload the configs for it to work as planned. Actually I take a full site backup every couple of weeks, and the database gets compressed and emailed to me every day. But you get the idea.

          I get browsing stats through WordPress Stats (which is a plugin), and Google Analytics (which is a monster).

          I do nothing at all with any of the stat data, I just glance at what my traffic count is every few weeks, which is currently around 22K hits per week.

          If you’d like a visual representation of what tracking cookies are used by sites (including this one) – try out Collusion [Firefox plugin] – you’ll be amazed…

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.