[Pas-dev] Run Mulitple Apps in the same Apache instance...
Status: Beta
Brought to you by:
mortis
|
From: Kyle R . B. <mo...@vo...> - 2003-04-03 15:00:27
|
We're about to roll out another application built off of Pas where
I work. Since the existing web-server isn't even close to running at
capacity, we'd like to install the new app on the same box.
The new applicaiton introduces a few new derived page objects and psp
pages to go with them. Both applicaitons run from the same codebase.
The remainder of the differences are just some configuration chagnes to
the pas.conf file.
The only way I can see to do this right now is to set up a second instance
of apache driven off of slightly different configuation files that point
to the new codebase and configuration file. Then this second instance
becomes the new app and the first instance continues to be the first app.
The problems with this are probably obvious - it's more work-load for the
box in question (double the number of apache instances) and it increaces
maintenence issues. Plus, we'll probably have to set up three Apache
instances, where the first proxies to the other two based on the virtual
host settings. This may be an unnecessarily complex setup.
What I'm interested in discussing at this point are the issues surrounding
attempting a multiple installation like this. I think that given the
current implemenation of some of the modules, and the convention of
using singeltons (either package my's, package our's, or variables
that are lexically captured closure style at compile-time) for some
code constructs (like the singelton configuration object) prevents
multiple applications from being hosted in the same process space.
Are there changes we can make to Pas to allow for this type of configuration?
Are they worh doing? I'm not sure I know of any other application servers
that allow for multiple instances of the same codebase (multiple applications)
to be hosted in a single process space.
The issues I can identify are the following:
- Org::Bgw::Config uses a singelton pattern. The singelton is at the
package level. This means that you can't have multiple configurations
loaded. A requirement for multiple applicaitons. An approach
for solving this (and not incuring the performance hit of loading
the configuration on every request) is not clear to me at this time.
- Org::Bgw::Environment pulls the location of the configuration from
an environment variable. This was originally done because it was
portable beteween the mod_perl and standard CGI worlds. If we gave
in and just decided to support mod_perl, we could use a PerlVar
directive instead of SerEnv/PerlSetEnv. PerlVar has the advantage
that it can be localized to either an Apache Location configuration
directive, or a Directory directive. This would allow mutliple
configurations, localized to an alias (in the case of a Location
directive), to be supported.
- Any singelton pattern must be reworked to include a parameter to
identify the singelton to be retreived. In the case of the configuraiton
it might just be the full path and file name of the configuration file.
Or we could introduce a new PerlVar that acts as this kind of switch.
Perhaps we could just use the virtual-host's name? That might be a good
approach for solving alot of these issues.
- Developers would have to know the implications of using globals, static
variables - singeltons by any other name.
Are there any other issues that anyone can think of? Can we solve these
and host multiple apps in the same process space?
Beyond that, can we solve the ISP's delima? So that mod_perl/Pas could
be used in a web-hosting type of environment where tens or hundreds of
seperate web-sites all run in the same suped-up Apache process? Is
Apache2/mod_perl2 working on this problem? To summarize, the problem
here is that the mod_perl namespace is shared - so if I set a variable
in my codebase $Foo::Bar, anyone else running in the same Apache instance
can access it (and worse, change it).
Kyle
--
------------------------------------------------------------------------------
Wisdom and Compassion are inseparable.
-- Christmas Humphreys
mo...@vo... http://www.voicenet.com/~mortis
------------------------------------------------------------------------------
|