incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Batalha Cunha dos Santos <>
Subject Re: Optimal counter implementation?
Date Tue, 10 May 2011 12:32:23 GMT

I tryed it before but didn't go ahead with the idea.

I was creating each document for each access, and put inside the document a
lot of info related to the request.

In my opinion all depends on the among of access you cite receive, but I'm
sure it isn't a sustainable way to store access histories. The databases
become huge I hours and maybe in minutes.

I think, if you want to do that with couchdb or other document databases,
you will need to think in a way to process those stored data before it
becomes to big and maybe store the result of this data into another database
with documents within processed data according to your needs.

Take a look at:
There are a javascript to be inserted into a website (like Google
Analytics). This javascript will store the following JSON in a couchdb

  var location = { "latitude":
           "longitude": navigator.geolocation.getCurrentPosition.longitude,
           "altitude": navigator.geolocation.getCurrentPosition.altitude,
           "accuracy": navigator.geolocation.getCurrentPosition.accuracy,
           "heading": navigator.geolocation.getCurrentPosition.heading,
           "position": navigator.geolocation.getCurrentPosition.position

   var json = {
       "instance": val,
       "date": isoDate(),
       "time": isoTime(),
       "url": window.location.href,
       "urlParams": urlParams(window.location.href),
       "referrer": document.referrer,
       "referrerParams":  urlParams(document.referrer),
       "location": location,
       "appCodeName": navigator.appCodeName,
       "appVersion": navigator.appVersion,
       "cookieEnable": navigator.cookieEnable,
       "language": navigator.language,
       "platform": navigator.platform,
       "product": navigator.product,
       "userAgent": navigator.userAgent,
       "vendor": navigator.vendor,
       "vendorSub": navigator.vendorSub

*Fabio Batalha C. Santos*
Colegiado SciELO

On Tue, May 10, 2011 at 6:05 AM, He Shiming <> wrote:

> Hi,
> I'm working on this project, that needs to count page views. I came up
> with two possible solutions:
> 1. For each page to be counted, use a single count document, and an
> update handler to count on each page view
> 2. Create a new document on each page view, this way I get to record a
> history of views, which I prefer
> I was wondering if the second method will consume too much space and
> CPU on a heavy traffic website. If I need the log of page views, it
> looks like this is the only way. But is it the correct and optimal way
> of doing counters?
> Or should I pick an alternative database for counters?
> --
> Best regards,
> He Shiming

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message