Design a hit counter

Read this.

The basic idea is to count the number of unique users. Since the complexity of the problem grows with the users maintaining a count of unique users becomes a space issues.

Apart from what’s written in the blog I would suggest having a look at the hyeprloglog algo or having a bloom filer.

If we want to maintain a list of users who have been active at what time – in that case we can make buckets for each second or one bucket for each minutes and store the user ids corresponding to the bucket.

Read this as well – http://stackoverflow.com/questions/17562089/how-to-count-number-of-requests-in-last-second-minute-and-hour

Advertisements

One thought on “Design a hit counter

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s