You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Creg Zolast <cr...@gmail.com> on 2013/09/27 11:54:34 UTC

[users@httpd] Timers and counters in Apache module

Hi,
I am currently developing a module in Apache 2.4.4

I need a counter that is going to count all requests in the system and
based on a small processing, some of them are to be tagged and counted
separately. I would like to do this the right way, in memory and not using
shared file on the hard disk.

At this point I can have a thread-safe counter per worker but I want to
save it periodically into a DB. I was looking for some kind of timer-based
event or something, or something like idle-event hook or anything
(whatchdog would be my last idea) to be able to save periodically these
counters into a DB.

Another way I found is working with shared memory like this example does:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/examples/mod_example_ipc.c?revision=1211680&view=co
but I have a doubt that the shared memory is actually a file on disk and
for each counter incrementation the hard disk is accessed.

Please help me getting on the right track. Thank you.

Creg

Re: [users@httpd] Timers and counters in Apache module

Posted by Jeff Trawick <tr...@gmail.com>.
On Sep 27, 2013 5:55 AM, "Creg Zolast" <cr...@gmail.com> wrote:
>
> Hi,
> I am currently developing a module in Apache 2.4.4
>
> I need a counter

http://httpd.apache.org/lists.html#modules-dev

Re: [users@httpd] Timers and counters in Apache module

Posted by Peter Phaal <pe...@gmail.com>.
Take a look at mod_sflow, it maintains basic HTTP counters and periodically
exports them using the sFlow protocol. The counters you are looking for may
already be exported; the following article shows the counter and
transaction data exported by mod_sflow:

http://blog.sflow.com/2011/01/http.html


On Fri, Sep 27, 2013 at 2:54 AM, Creg Zolast <cr...@gmail.com> wrote:

> Hi,
> I am currently developing a module in Apache 2.4.4
>
> I need a counter that is going to count all requests in the system and
> based on a small processing, some of them are to be tagged and counted
> separately. I would like to do this the right way, in memory and not using
> shared file on the hard disk.
>
> At this point I can have a thread-safe counter per worker but I want to
> save it periodically into a DB. I was looking for some kind of timer-based
> event or something, or something like idle-event hook or anything
> (whatchdog would be my last idea) to be able to save periodically these
> counters into a DB.
>
> Another way I found is working with shared memory like this example does:
>
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/examples/mod_example_ipc.c?revision=1211680&view=co
> but I have a doubt that the shared memory is actually a file on disk and
> for each counter incrementation the hard disk is accessed.
>
> Please help me getting on the right track. Thank you.
>
> Creg
>
>