graphite-project/carbon — pull request #266 by avishai-ish-shalom (2014-08-14 19:15:17+00:00)
Title: issue #167: Don't iterate on the cache for every call to size

As mentioned in [issue 167](https://github.com/graphite-project/carbon/issues/167), calculating MetricCache size using reduce creates a large number of futex calls causing high cpu usage. This patch keeps track of MetricCache size using an auxiliary variable. Since data is pushed and popped from different threads size tracking is not accurate, but for the purpose of limiting memory usage i feel this is good enough.