httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harrie Hazewinkel <>
Subject Re: Keeping per-virtual host data?
Date Tue, 01 Oct 2002 08:42:57 GMT
Hi Steve,

--On Monday, September 30, 2002 10:50 PM +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? This is an SNMP module that does per v-host
statistics. With some modifications one could use this for the
purpose you want.

>   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.

The only problem you encounter is that the statistics exist in a
side process and you have to make some connection from each
Apache child to the side process.

>   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..

If you are willing to put all the data into temp files that could
be OK. However, in order to avoid dead-locks and many locks for access
to this you better fork of a process that only writes into it where
all children just can read it.

>   For those who might be interested my code is online at:
>   (Just be gentle; it's my first module ;)
> Steve
> ---


Internet Management Consulting
Author of MOD-SNMP, enabling SNMP management the Apache HTTP server

View raw message