cronolog.org
flexible web log rotation
HOME
DOWNLOAD
FEATURES
USAGE
FAQ
BLOG
KNOWN BUGS
SECURITY
PATCHES
USERS
TO DO
HISTORY
LINKS
FEEDBACK
MAILING LIST
ADVERTISING

support cronolog development



Google   HELP


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CRONOLOG: VS: Cronolog processes



Tuc writes:
 > > There are a couple of ways to redesign cronolog as a module to cope
 > > better in this sort of situation:
 > > 
 > > 1. the module could just open the required file (in append mode),
 > >    write the log message and close the file 
 > > 
 > > 2. the module could maintain a cache (in each process) of the most
 > >    recently accessed log files, closing the least recently used file
 > >    descriptor (and/or any descriptors that are no longer valid
 > >    according to their templates)
 > > 
 > > 3. have a server process to handle all the logging requests
 > > 
 > > 
 > > I started along the third route a couple of months ago, but other
 > > demands on my time intervened.  I might have a look at the second
 > > approach, as it might be simpler and would avoid the complexities of
 > > interprocess communication, etc.
 > > 
 > 
 > 	I've personally expressed this to Andrew... I think #3 is just
 > "A BAD IDEA".  Having Apache depend on another process, especially via
 > some sort of IPC/etc, could be trouble.  If the other process dies, theres
 > the possibilty of Apache blocking until it can talk.
 > 
 > 	I think #1 would cause ALOT of file open/closes on heavily used
 > web servers with many hosts.
 > 
 > 	Wouldn't #2 chew up valuable File Descriptors?
 > 
 > 		Tuc/TTSG Internet Services, Inc.
My feeling is that a configurably-sized cache of file descriptors
would be the best solution -- of course if the cache size is one then
you have solution #1, except that the log file wouldn't be closed if
it was used to log the next request.  If you set the size to say five
to ten (per child server process) then there would probably be about
the same number of processes used globally as in the current setup
(there will be file descriptors in use in the shell processes and the
cronolog processes), but the number of processes will definitely be
less.  
If you have 500 virtual hosts and MaxClients is set to 512 with one
piped log per virtual host, then under the current setup you would
have in extremis:
                          processes    log-related file descriptors
  httpd processes            513		   500 *
  shell processes	     500		  1500
  cronolog processes	     500		  1500
  TOTAL			    1513		  3500
* assuming the file descriptors are opened in the parent httpd process
and shared with the child processes
with a mod_cronolog that cached file descriptors and had the cache
size set to 5
  httpd processes	     513		  2560
Obviously the number of processes is drastically cut, and the cache
size can be tuned to the needs of the individual site.  Even with a
size of 5 I would expect that the majority of log writes would find
the file already open.
This is my stab at guestimating how module would behave.  mod_cronolog
is partly coded and implementing this solution should not be
difficult.  I was trying to implement approach #3, which Tuc believes
is a bad idea.  Having got bogged down in the complexities I think
this may well be a better solution.
If anyone out there wants to act as beta tester I will try and get
something together next week.
Andrew
-- 
Andrew Ford,  Director       Ford & Mason Ltd             Tel: +44 1531 829900
A.Ford@xxxxxxxxxxxxxxxx      South Wing, Compton House    Fax: +44 1531 829901
http://ford-mason.co.uk      Compton Green, Redmarley  Mobile: +44 7785 258278
http://pauntley-press.co.uk  Gloucester, GL19 3JB
http://refcards.com          Great Britain

Copyright © 1996-2010 Andrew Ford and Ford & Mason Ltd