top | item 42939213

(no title)

Squid_Tamer | 1 year ago

I think probabilistic counters are really interesting for this situation, as long as you don't need exact numbers.

  if random.randint(1, 100) == 1:
      db.increment(row)
Then, looking at the database, you can know that the actual count is approximately 100x the number of times the row was incremented.

There's an even more aggressive version that I've seen called a 'Morris Counter' which uses just a few bits to build an order-of-magnitude estimate of the number of events: https://en.wikipedia.org/wiki/Approximate_counting_algorithm

discuss

order

No comments yet.