Hacker News new | ask | show | jobs
by lgas 3374 days ago
For scaling view counters on the pages of popular videos Youtube increments the counter by N views with 1/N probability for each actual view. Or so I've been told.
2 comments

I've seen similar approaches used to enforce rate limit checks on APIs that get lots of traffic and are distributed amongst many different servers.
This is really neat. You need to take only 1/N of the locks. Maybe the N can be started small and changed gradually as the views increase.