Ask HN: What Linux distro for a Rails app that needs to scale?
Title says it all. My startup has collected so many users that it's getting to be just ridiculous. So, we bought a brand new server with really nice specs, and I'm debating what OS to use.
While I love OpenBSD, I'm more concerned with scalability than security, at this point.
As of right now, I'm going to use nginx over Apache, and probably use a 64-bit Ubuntu server.
What would you use?
26 comments
[ 2.8 ms ] story [ 66.6 ms ] threadI think Engine Yard, which is where I'm hosting right now, uses Gentoo, it seems to work fine.
On the other hand, if you use a distribution that somehow 'benchmarks' marginally better but you don't know how to configure it or deal with it properly, you'll end up losing any performance gains you otherwise would have had. Better to deal with a distribution that works the way you do (Which is why a lot of people like CentOS or Ubuntu Server) than end up making a major mistake somewhere because you are in unfamiliar territory.
(Gentoo? Blech. -funroll-loops.)
If you don't have more than 4GB of RAM, it makes absolutely no sense to have a 64 bit OS install.
One other thing, make sure you build everything from the source. Get exactly what you want/need, and nothing more as well as the latest packages.
We use Ubuntu 8.04 LTS because it is committed to be supported for a very long time. Traditionally Debian releases have been supported with security updates and the like for one year after the subsequent release. There's no guarantee or date for Debian. Ubuntu 8.04 Server Edition on the other hand is supported through 2013... and that very well might turn out to be longer than Debian 5.0.
And if the answer is "visualized it" - then compiling is a waste of your time to being with. Better to run native from packages than virtualized from source.
I was right there with you until this bit of crazy.
Do not build everything from source. You're just asking for trouble when you do. You lose so many really important features of modern Linux distros when you do this, that I can't believe people are still suggesting it as a sane practice for production servers.
If you install from source you won't be able to update quickly and easily via apt-get or yum when a security update comes out...you'll have to rebuild. But, you probably won't even know a security update exists until it's too late. If you don't keep copious and specific notes about what your custom build does, and why you did it that way, you will forget a flag or overwrite or lose a config file, and it will break something next time you roll out a new version.
The performance benefits are probably negligible, and in my many years experience cleaning up amateur maintained systems, it is just as likely to be negative as it is positive. You probably know dramatically less about the package you're building than the maintainer of the OS package, and you're more likely to make mistakes than they are. Those mistakes could have security implications, performance implications, or stability implications.
Certainly, if you are the maintainer of some piece of software, you might want to replace it. I've never run a system without at least a few custom builds...but the custom pieces are usually software that I am one of the core maintainers of, and I know it better than just about anybody. And, when I do run custom software, I tend to build an RPM or deb of it, and setup a local yum or apt-get repo, so that when I need to replicate my production machine, I can do it quickly and consistently.
I have a vested interest in being pretty much OS agnostic; our products support tons of systems and versions, and you can easily get me to say nice things about all sorts of operating systems. But, I simply can't have no opinion about Gentoo. It's just such a poor choice for a server that I'd feel guilty not using the strongest possible language to discourage folks from using it.
As far as the rest goes, it would be better to use Debian before Ubuntu, but there's a lot of other distros as well. RHEL powers many of the webs servers as does SuSE and Debian and Gentoo. Once you get past that, it's mostly personal preference.
Also, big plugs for nginx. It's definitely a very impressive software package.
I personally use Debian for everything. I can't imagine the distro making a huge difference really. I've used Debian as a desktop os for some time, so when I needed a server os, it was easy to get going quickly.
Switching from Apache to Nginx made more of a difference in my case than anything else I could have done I believe.
You're working against the grain if you go BSD instead of Linux with Rails, whether you like FreeBSD or not.
For the past several years, and up until FreeBSD 7 you've always been seriously misled. FreeBSD has historically had dramatically worse performance in most concurrent server applications (certainly in multi-process SMP workloads). As of FreeBSD 7, it generally is the equal or slight better of Linux. It is not better in enough categories or by a large enough margin for anyone to say with confidence that a particular workload will perform better on FreeBSD or Linux. One would always have to benchmark the actual application, and the differences would be minimal in most cases...and with every new kernel release, you'd have to benchmark again, because things change and performance advantages might flip from one release to the next.
And, tptacek is correct, none of the other BSDs has inherited these dramatic performance improvements found in FreeBSD 7, so they are very unlikely to provide better performance than any modern Linux version on modern multi-core hardware.
If you're talking about switching to nginx from Apache, that makes me think that you are still proxying to a collection of mongrels? I'd recommend switching to Phusion (aka mod_rails) as it seems to handle high loads much better.
make sure you build from source.
http://antoniocangiano.com/2008/12/09/the-great-ruby-shootou...
I can't find the papers off hand but there has been some research into how kernel level cache tweaks will dramatically effect how web servers and DB servers will perform.
i'm curious because i use openbsd+lighttpd (soon will be nginx) in my colo (because no slice/vps offers openbsd afaik)
I'd say 64-bit Debian. I have already mentioned my qualms with Ubuntu elsewhere on HN (I don't like upgrading every 6 months, and I don't want to be stuck with old software in case I decide to skip an upgrade).