Ash Berlin

Running JSGI Multiple Apps in One Process

Posted on Feb 10 2010

Good idea or bad?

‘App’ in this case is talking about running two different Pressed (a blog engine for Juice) apps. More generally this question could apply to any application written in a scripting language.

Well on the one hand, if the apps use a lot of common modules, the memory footprint will be reduced. And using less memory is always hand for resource-starved virtual servers.

However more seriously this turns out to be a horrendously bad idea. Who knew? (Clearly not me). Even when you control all the apps in question and can set aside the security concerns, there are other reasons to not do this. Well just one really: its far to easy to unintentionally share state between the apps apps, even when you know about this danger and thought you’ve worked around it.

This is just a post of the “Remember Ash, Don’t Do That” variety. Some approach like this node.js patch might be a suitable alternative, and it gives other fuzzy warm benefits too.