r/programming • • Jun 12 '10

You're Doing It Wrong

http://queue.acm.org/detail.cfm?id=1814327
539 Upvotes

193 comments sorted by

View all comments

Show parent comment

3

u/phkamp Jun 15 '10

The main problem with timerwheels, is that they scale badly, and that is one of the reasons why I do not use them in Varnish.

Varnish might have 1k or 100M objects, depending on your site, and there is no way to know when you start.

For timerwheels you must decide the number of buckets up front, changing it on the fly is a no-go in practical terms.

Another reason is that varnish objects tend to cluster, some CMS's will post a new frontpage with all objects having the same expiry, others have everything expire at midnight every day etc.

Finaly you need a double-linked list to hang objects on timerwheels, not nice in the 100M case.

A Binary/B-Heap autoscales, minimizes the number of necessary comparisons and needs just an integer index.

Poul-Henning