httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Holsman" <li...@holsman.net>
Subject Re: Keeping per-virtual host data?
Date Tue, 01 Oct 2002 13:56:01 GMT
On Mon, 30 Sep 2002 22:50:13 +0100, Steve Kemp wrote:

> Hi All,
> 
>   I've written a module for Apache which will limit the 
>  amount of data the server may transfer in a given time
>  period.  (OK that's a simplistic overview anyway ;)
> 
>   To do this I make use of the information gathered by
>  mod_status, and when the data transferred goes over a
>  given threshhold I cause the server to simply respond
>  to all requests with a redirect.
> 
>   This works fine on a per-server basis.
> 
>   I'd like to re-code my module to work with virtual
>  hosts; so I believe I need some way of keeping track of 
>  the size of data which has been transferred on a 
>  per-vhost basis.
> 
>   (Or failing that find another module, like mod_status,
>  which contains the necessary magic which I can piggy back
>  upon).
> 
>   Is this possible, and if so does anybody have a pointer
>  to a method I could use?
> 
>   All of the modules I've studied seem to manage to operate
>  without having per vhost static data which makes me think
>  either I'm missing something obvious, or it's not possible.
>  Either way I'd love to be enlightened.
> 

it's hard, as there is no way 'in-process' to manage that information
without using a mutex lock to protect the data structure (imagine two
processes/threads serving the same URL for a virtual host) or having some
kind per-thread per-vhost structure which your module would summarize.
mod-status avoids a lock as each thread writes it's server stats to a
thread-specifc area which mod-status sums up.

>   It does cross my mind that the forking may rule out persistant
>  static data of the kind I want; but temporary files could be used
>  I guess..
> 
>   For those who might be interested my code is online at:
>    http://www.steve.org.uk/Software/mod_curb/ 
> 
>   (Just be gentle; it's my first module ;)
> 
> Steve
> ---
> www.steve.org.uk


Mime
View raw message