[concurrency-interest] Concurrent telemetry gathering

Kasper Nielsen kav at it.edu
Thu Nov 16 04:50:21 EST 2006


Kasper Nielsen wrote:
> Gregg Wonderly wrote:
>> I'm working on collecting telemetry regarding bandwidth utilization through a 
>> "connection".  I've defined the following class, thinking that this should 
>> minimize concurrency for updating the numbers.
>>
>> In addition, there is a 
>> ConcurrentHashMap<OutboundConnection,ConnectionBandwidth> object that is 
>> accessed by threads of execution which are handling the I/O requests through the 
>> system.  That map is lazily initialized with putIfAbsent().  When the first 
>> entry is added, there is a ScheduledThreadPoolExecutor used to schedule a 
>> regular execution of "run" to create a time based running average of bandwidth 
>> usage.
>>
>> Is there anything else I should do differently?
> 
> Have you considered using (single) exponential smoothing instead. What 
> are you using the numbers for?
> 
Having had a second look on the code, I see that you are already using 
exponential smoothing with a smoothing constant of 1/avgIntv. Never mind 
then.

- Kasper


More information about the Concurrency-interest mailing list