Re: Sharing memory between Apache processes
On Tue, 4 Apr 2000 [EMAIL PROTECTED] wrote: > >A good package for this is IPC::Shareable. You can store info in semaphores > >and share it between processes. > > Except that I don't think you can you use shared memory (the semaphores are > just flags) across multiple web servers, and I have been wrong before. You can share memory segments between web servers with no trouble. Depending on how you implement the storage, you may run into difficulties with your operating system, though. For instance, all the BSD derivatives I've investigated (FreeBSD, OpenBSD, and BSDi so far) only have 32 shared segments and 10 semaphores compiled into the kernel by default. In contrast, the Linux kernel ships with 128 of each. - Matt
Re: Sharing memory between Apache processes
Flemming Mahler Larsen wrote: > > Hi, > > We've been moving several small "CGI powered sites" to mod_perl and the > results has been quite terrific. Based on this we're about to move our > first large (large in size and heavy traffic) site from an Oracle > Application Server to mod_perl. We're using our own custom > "HTML::Template"-like module and reading all templates in to the memory > during the server start-up (these are placed in a hash structure in a > "project-speciffic"-module name space). > > It seems as this has the effect that each server process keeps its own > copy of the templates. I would like to avoid this by using some sort of > shared memory between the server processes. Does any of you have any > experience in this field (or even better examples of how to do it)? > > TIA, > Flemming > -- > Flemming Mahler Larsen, Tele Danmark Internet > http://projekt.tele.dk.net/about/mahler.html // +45 3917 9013 Check HTML::Template - it has a IPC shared cache feature implemented with IPC::ShareLite. -- ... Roger Grayson - Software Developer Physical Verification Runset Center System-on-a-chip Design Technology - Motorola, Inc. - Austin TX Phone#(work): (512)996-7302 email: [EMAIL PROTECTED] ...
Re: Sharing memory between Apache processes
>> It seems as this has the effect that each server process keeps its own >> copy of the templates. I would like to avoid this by using some sort of >> shared memory between the server processes. Does any of you have any >> experience in this field (or even better examples of how to do it)? >A good package for this is IPC::Shareable. You can store info in semaphores >and share it between processes. Except that I don't think you can you use shared memory (the semaphores are just flags) across multiple web servers, and I have been wrong before.
RE: Sharing memory between Apache processes
> It seems as this has the effect that each server process keeps its own > copy of the templates. I would like to avoid this by using some sort of > shared memory between the server processes. Does any of you have any > experience in this field (or even better examples of how to do it)? A good package for this is IPC::Shareable. You can store info in semaphores and share it between processes. Another approach would be to use something like Apache::Session with a common session ID of '0' or something of that short. Apache::Session has no problem storing complex data structures, and by having each script tie to session with ID '0', you access a common data store. I think the Apache::Session docs talk a little bit about using the package to create this type of shared memory store. Hope this helps, Russell Weiss Founder and Technical Manager InfoRelay Online Systems, Inc. http://www.InfoRelay.net/
Re: Sharing memory between Apache processes
Flemming, Check out IPC::SharedCache (uses IPC::ShareLite(?) underneath) by Sam Tregar, author of HTML::Template. It does exactly what the name implies. I believe the most recent version is 1.3, but check out your local CPAN mirror for the latest copy. The documentation is rather good IMHO and it is used by HTML::Template for a shared cache. Flemming Mahler Larsen wrote: > > Hi, > > We've been moving several small "CGI powered sites" to mod_perl and the > results has been quite terrific. Based on this we're about to move our > first large (large in size and heavy traffic) site from an Oracle > Application Server to mod_perl. We're using our own custom > "HTML::Template"-like module and reading all templates in to the memory > during the server start-up (these are placed in a hash structure in a > "project-speciffic"-module name space). > > It seems as this has the effect that each server process keeps its own > copy of the templates. I would like to avoid this by using some sort of > shared memory between the server processes. Does any of you have any > experience in this field (or even better examples of how to do it)? -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704.370.0550 http://www.vialogix.com
Re: Sharing memory between Apache processes
> "FML" == Flemming Mahler Larsen <[EMAIL PROTECTED]> writes: FML> It seems as this has the effect that each server process keeps its own FML> copy of the templates. I would like to avoid this by using some sort of FML> shared memory between the server processes. Does any of you have any FML> experience in this field (or even better examples of how to do it)? If that's the case then there's something wrong with your OS' virtual memory system or it is really ancient. If you preload the information at server start time, the forked off children *should* share the same physical memory pages until they modify them (copy on write.) Your OS may report the memory used for each child, giving the illusion that more memory is used. The only way to really tell is to figure out how much of the memory is in shared pages. That's a highly os-dependent thing, and you have not yet shared those details with us. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-301-545-6996 PGP & MIME spoken herehttp://www.kciLink.com/home/khera/