httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sorin Manolache" <sor...@gmail.com>
Subject Re: number of bytes/packets sent/received
Date Thu, 09 Oct 2008 13:50:37 GMT
On Thu, Oct 9, 2008 at 15:44, Andrej van der Zee
<andrejvanderzee@gmail.com> wrote:
> Thanks for your reply!
>
>>
>> Giving it a second thought, the problem looks complicated. Such
>> filter-based counters would count the traffic of _one_ apache process.
>> When you increment the counter, you have to protect it from concurrent
>> access by other threads running in the same apache child process.
>> Then, before the apache child process exits, you need to add the
>> counter to a global counter shared among apache child processes (which
>> has to be protected against race conditions as well). It's really
>> hairy. Don't do it in apache.
>>
>
> I forgot to mention, but I need the number of packets / bytes per HTTP
> request and log it to a database with other information. So I guess
> that would take case of all the hairy stuff. I think I will give it a
> go as you recommend with an input and output filter that only counts
> the bytes and just passes on the data, unless somebody comes with a
> better idea (what about the content-length for example, can I trust
> this?). I understood from your email that the headers are counted with
> it (I never wrote a filter before) and that's exactly what I need.

No, the Content-Length doesn't include the size of the headers.

While I was typing the message, Dave Ingram's message arrived. I think
the solution he proposes is much better.

Sorin


Sorin

Mime
View raw message