The case for “one webapp per VM”
Tuesday, May 29th, 2007I’ve been spending more time testing out Xen and installing various web-based software, and I think that’s my conclusion. Putting more than one web application in a VM is the same as putting multiple web applications on one machine; eventually you’ll run into problems with the exact versions of the various components of the stack, or the various required auxiliary modules. Perhaps it’s not much of a problem when one webapp depends on Perl::DBI and PostgreSQL and the other on PHP/MySQL. Perhaps it’s OK to run
The “one webapp per VM” policy has its advantages:
- you’ll never get into trouble when you upgrade your CPAN modules for one app and break something in another app
- you’ll never get into trouble when you upgrade your PHP pear modules for one app and break something in another app
- you’ll never get into trouble when you upgrade your Ruby gems for one app and break something in another app
- restarting apache because of one app won’t affect the others
Of course, there are disadvantages:
- you suddenly have a whole computer to manage for each app
- that’s it, I think
The one thing I’m not yet sure about is the database backends. It sure sucks to have a MySQL install on all the machines, requiring separate maintenance and backups. I’m more of a fan of a single db machine that all the different webapps can point to. The webapps tend to care much less about the database version compared to the various module versions.