I recently came across a new little VPS provider called Digital Ocean that if you’ve even casually looked at VPS providers lately you’re likely to have come across too. They do a lot of advertising. I was a bit skeptical at first as their prices seem way too low to be able to offer service comparable to my current provider, Linode. But hey, for $5 a month I didn’t have much to lose and it was the perfect opportunity as an Apache guy to learn the ins and outs of Nginx. So I took the plunge and spun up a small 512 VPS. I not only learned a few things about hosting sites on Nginx but I also got to see first-hand how Linode stacks up against Digital Ocean.
Nginx is pretty fast
Since I only had 512mb of RAM to work with, and having seen how Apache could consume one-fourth of a slice’s memory serving up simple PHP and static files, I thought Nginx might be a good option for those same purposes instead. I was right. The server Write.app runs on has 512mb RAM, 512 swap, 1 core (technically), and 20GB of disk space (non-SSD). I also host about 10 other sites most of which are totally static but a few of which run some very small PHP scripts. That server with Apache, PHP5, MySQL5, and Passenger (and 2 SSL secured sites) runs idle at about 110/512 in terms of memory. Yes, I have optimized it plenty however I suspect Google’s Pagespeed module might be taking up some extra memory unnecessarily as it becomes pretty useless once you start serving sites over SSL.
Nginx on the other hand, so far, only uses about 65/512 memory on the same size VPS. That’s almost half of what Apache uses. Now, I haven’t seen it perform under load and while I have benchmarked it several times I don’t believe there’s any substitute for real world traffic so I’ll have to wait and see how it performs. Despite Apache using more memory, however, I can say that it handles relatively high loads quite well. It survived a Twitter retweet attack and I actually DDOS’ed it myself once. It got a little slow but not unuseable. Anyway, Nginx, so far at least, seems very similar to Apache in its configuration. It’s got a similar config file and all the relevent configurations are in almost the exact same directories as you’d find with Apache (just replace
nginx). The difficult part is actually figuring out which directives match what you’re used to in Apache and just generally understanding how Nginx works where it differs from Apache. Virtual hosts work almost the same. They’re a little harder when it comes to using Fast-CGI for PHP but only insofar as understanding how it works and what the configuration directives the manual suggests actually mean and do. Setting up multiple sites to use SSL is a breeze with Nginx. Just name your server, tell it to listen on port 443 and that’s it. No need to multiple IPs. One thing Apache has that Nginx doesn’t is the nice
a2dissite commands. It does still have
service nginx [stop, start, restart] though (but only if you install it via your package manager). All in all I’m very happy with Nginx right now and I’m currently moving all of my static sites over to my Nginx server on Digital Ocean.
Digital Ocean is cheap and satisfactory
Digital Ocean is not amazing. But not awful. They’re cheap and I’m actually quite happy with what I’ve gotten. The network connections currently leave something to be desired and if your app is very CPU demanding then you may have trouble with them as compared to Linode. Otherwise they’re very comparable to Linode. It’s basically most things you’d get from Linode at a quarter of the cost. Digital Ocean is lacking in a few areas though. I mentioned CPU performance and networking already. You should also know that currently they only offer servers in New York and Amsterdam. Now, there’s nothing wrong with that but depending on your latency tolerance/requirements you may need servers in a different location. In addition, if you require IPv6, you’re out of luck (for now). Most of us don’t truly need IPv6 support but it’s nice to have. Digital Ocean does have a leg up on Linode when it comes to hard drives and pricing though. DO offers you a 20GB SSD with their cheapest plan. If you happen to run an application that tends to use a lot of swap (and somehow survives) you can rest assured that your swap will be super high performance swap. Digital Ocean is also able to bill itself as a VPS with an AWS-like twist. You can add and resize servers, or Droplets as they call them, on demand (though it kind of sucks not having a smartphone app for that). You can also take a snapshot of your server, store it, then destroy the server and come back to it any time. You won’t be billed so long as the server isn’t being used (but you actually need to completely delete it, not just take a snapshot and power it down). So that’s pretty cool for on-demand usage. At the end of the day Digital Ocean is great for running anything you want on the cheap. I think for most of us, its a great service. As much as we’d like to think our little web app will become the next Google/Facebook love child, chances are you’ll probably only be managing a few hundred users at a time. Digital Ocean should give you all you need to run an app on that level.
Linode is Linode. Awesome and expensive.
Linode rocks. Period. They feel more solid than Digital Ocean. Are they better? Eh, not in every area but I do prefer Linode to Digital Ocean. I only wish they weren’t so expensive. But I know what I’m paying for with them at least. IPv6, excellent support, an amazing web interface that lets you do far more than just manage your server and DNS, and a long history of being a solid VPS provider. Digital Ocean, to me, is only trustworthy because they’ve got some brand name investors backing them. I love Linode and I think I’m going to stick with them despite how expensive they are for some time.