Atomic counters with nginx

ktwalrus nginx-forum at nginx.us
Fri Jul 31 18:50:22 MSD 2009


I need to implement some atomic counters (where the counter is persistent across server reboots/crashes) to scale to lots of hits per second to update the counter  as GET requests to a web available global server.  I need these counters to have fairly low latency.  Since I already use nginx as my web server, I was thinking it might be the best place to implement this web service.

Basically, I want to issue a single GET request to an nginx server and increment and retrieve the new value of several 64-bit counters.  The single GET request needs to handle incrementing several distinct counters (to reduce overhead) and restrict the request from a list of requesting IPs and a password (or some other secure method to prevent a server other than my servers from updating the counters.

Is there an existing module that I can implement something like this?  Or, would someone consider writing such a module?

I need the counters to be atomic since I am using them as unique global indices in my local databases.  I think such a module would have general appeal since many people might like to keep page counters for their web pages (and this module could be written to support this too).

Hopefully, atomic counters is already implemented, but I couldn't find it in a search.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4654,4654#msg-4654






More information about the nginx mailing list