Re: [ROOT] [Carrot] Persistant Object in Apache

From: Valeriy Onuchin (Valeri.Onoutchine@cern.ch)
Date: Wed Apr 03 2002 - 18:31:42 MEST


 Hi Ashley,
I truncated discussion a ltl bit

Ashley Cambrell wrote:

> Hi Valeriy,
>
>
> I don't quite understand what TApacheCache is used for.  There doesn't
> seem to be anyway of putting objects in the cache.. [?]

TApacheCache is used for server-side caching
http://carrot.cern.ch/CarrotExamples/tutorial/tut6-1.chtml

It uses "index file" which store information (size,mime-tpye,expiration date etc. )
about files which are in cache directory ( /tmp/carrot_cache/).
A special apache child process is spawned at apache initial start up
(garbage collector) which periodically checks consistency of cache.
Since files in cache can be accessed by several apache subprocesses
simultaniously semaphore based locking mechanism is used.



> Looking at the php source, the session handler they use is extremely
> complex.  Basically it seems to boil down to serializing registered
> variables to a single char*which is saved in the an mm segment.  Once
> session_start has been called (can be implied by sessions_register or
> accessing $_SESSION) the data is unserialized and placed into $_SESSIONS
> or if register_globals is on, then the appropriate variable is created.
>
> Is there a file that is run everytime a new connection to Apache is made
> (new connection that calls a Carrot file).  It says that
> CarrotChildInit.C and CarrotChildExit.C are called when the server
> spawns a new server.

The Apache web server follows the model of a process farm:
It has a parent process which spawns several children processes.
Whenever a client request arrives at the server, it is handled by a child process.
If the number of simultaneous requests exceeds the number of existing children,
a new child process is spawned.  When a child process terminates, a new one is spawned.

CarrotChildInit.C script is executed whenever server spawns a new child.
CarrotChildExit.C script is executed when apache child exits.


> But Apache is usually configured so that
>
> StartServers 100
> MinSpareServers 100
> MaxSpareServers 200

??
my server configured as:

MinSpareServers 5
MaxSpareServers 20
StartServers 8
MaxClients 150


These values are defined  by requirements of Apache Server tuning
http://dcb.sun.com/practices/howtos/tuning_apache.jsp
http://www.devshed.com/Talk/Books/ProApache/page2.html


>
>
> does this mean that if the site is a low traffic site, CarrotChildInit.C
> and CarrotChildExit.C would rarely get called as there would rarely be a
> server startup?  (Or does "spawn a new server" mean "a client connection")
>

check the previous comments.

>
> If it does mean spawn a new server, is there a way to run functions on
> script startup?
>

You can load user defined libs at CarrotChildInit.C script
and execute functions as similar as it is done by rootlogon.C
script in normal ROOT session.

HTH.     Regards.    Valeriy



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET