You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Harrie Hazewinkel <ha...@lisanza.net> on 2002/10/01 10:42:57 UTC
Re: Keeping per-virtual host data?
Hi Steve,
--On Monday, September 30, 2002 10:50 PM +0100 Steve Kemp
<sk...@tardis.ed.ac.uk> 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?
www.mod-snmp.com 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:
> http://www.steve.org.uk/Software/mod_curb/
>
> (Just be gentle; it's my first module ;)
>
> Steve
> ---
> www.steve.org.uk
>
Harrie
Internet Management Consulting
mailto: harrie@lisanza.net http://www.lisanza.net/
--------------------------------------------------------------------
Author of MOD-SNMP, enabling SNMP management the Apache HTTP server
Re: Keeping per-virtual host data?
Posted by Steve Kemp <sk...@tardis.ed.ac.uk>.
Hi Harrie,
On Tue, Oct 01, 2002 at 10:42:57AM +0200, Harrie Hazewinkel wrote:
> www.mod-snmp.com This is an SNMP module that does per v-host
> statistics. With some modifications one could use this for the
> purpose you want.
Thanks for the pointer. I've had a quick look at this just now
and it's quite nice.
(Maybe it'd be a good idea to have the source unpack into it's
own directory ;)
> 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.
Sure.
> 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.
After a bit of trial and error I've managed to get the effect I
want. My big mistake was using 'per_dir_config' rather than the
per server config. Once I'd corrected that the rest flowed fairly
easily.
(Reading the virtual host from the mod_status is trivial, and that
allows me to do everything I need to do).
Steve
---
# GNU MP3 Streaming
http://www.gnump3d.org/