twitter-archive/ostrich

Sync blocks in Histogram

cin opened this issue · 3 comments

cin commented

There are several sync blocks in Ostrich; but the ones that are most troubling are in Histogram, which are used under the covers in the StatsProvider.time* methods. Since these methods are timing function calls and typically shared metrics between threads, this is problematic in that it will cause all threads accessing the metrics to line up on the sync blocks. Is there a way to fix this?

Is this something that has effected your application's latency?

cin commented

I don't have any quantitative evidence of it causing a big impact, but I was using the time method to measure method and socket response times. The application has ~50 threads contending for these metrics. Given that each metric's array update should be locked for a relatively short amount of time, I don't think this is a huge impact. That being said, it will force all my threads to line up on these resources and in turn reduce concurrency. In the short-term, I have disabled all timing calls.

Can you try finagle-stats instead? Its histograms are more accurate, I think.