On 11/13/2012 09:02 AM, Marco Pallante wrote:
Hello everybody,
Can you explain to me what happens to the global namespace
when Apache serves requests to different virtual hosts?
I did a check, creating something inside :: (variables, procs, and
another namespace) with a request towards a virtual host, and
then tried to see whether they exists from a request towards
another vh.
They are not accessible, as I would expect, but then I'm asking
whether is just a case, because the two requests were served
by different child processes, or whether Apache guarantees
that each child never serves more than a virtual host, or whether
No, definitely. You would waste a lot of the server resources. Child
processes are scheduled by the OS (with the possibile intervention of
the MPM) and they must be agnostic about what application/virtual host
they're going to serve, at least from the programmer perspective.
Rivet ensures that each virtual host inside a child process gets
its own private global namespace.
Is there any reference to this behavior?
If SeparateVirtualInterps is off (default) you have one interpreter in
each child process, therefore the global namespace is shared even when
your applications store data in their own namespaces. If the flag is
'on' each virtual hosts gets a slave interpreter and it will have its
own global namespace.
Thank you very much for your anwser, and sorry if I'm bothering
so much!
well, in general you cannot presume to have the same child process
serving 2 subsequent requests from the same client or to the same
virtual host. If SeparateVirtualInterps is off then you should see
namespace data be shared among different virtual hosts. Keep the number
of servers as small as possible on your testing machine and press F5 on
your browser several times.
<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
MaxClients 150
MaxRequestsPerChild 100
</IfModule>
Of course this is not a good setting on a production machine, even one
with a small workload.
run a script which prints the pid
<?= "<b>[pid]</b>" ?>
you should see the same pid most of the times and then you should also
see your global persistent data
-- Massimo
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]