[ 
https://issues.apache.org/jira/browse/HADOOP-9090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13506686#comment-13506686
 ] 

Mostafa Elhemali commented on HADOOP-9090:
------------------------------------------

*Point about how to synchronize putMetricsImmediate*
Thanks Luke. Yeah I considered waiting on the buffer itself before creating the 
wrapper, but there are a couple of reasons I didn't end up doing that:
1. (Main reason) The sink doesn't own the buffer object, so it doesn't know who 
else is waiting on it or notifying it. Seems wrong to presume to wait on it.
2. Object.wait(timeout) doesn't return the result of the wait, so I wouldn't 
know if that succeeded or failed without additional complex logic.

As for the race being harmless: I'm not sure it's that harmless. For all we 
know the buffers that were just processed from the queue were from ages ago, 
and the values in the new buffer are completely different. I'd much rather play 
it safe and give it an honest attempt to publish what I've just been given.

So, for the reasons above I'd rather go with the wrapper despite the added code 
complexity.

*Point about putting the method in the interface*
OK since me & Luke are two votes to put the method in the interface, and Luke 
made a good point about the interface being evolving, I'll put the method back 
into the interface in a subsequent patch unless anyone else objects (or Ravi 
presses the point with other reasons). Thanks all.
                
> Refactor MetricsSystemImpl to allow for an on-demand publish system
> -------------------------------------------------------------------
>
>                 Key: HADOOP-9090
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9090
>             Project: Hadoop Common
>          Issue Type: New Feature
>          Components: metrics
>            Reporter: Mostafa Elhemali
>            Priority: Minor
>         Attachments: HADOOP-9090.2.patch, 
> HADOOP-9090.justEnhanceDefaultImpl.2.patch, 
> HADOOP-9090.justEnhanceDefaultImpl.3.patch, 
> HADOOP-9090.justEnhanceDefaultImpl.4.patch, 
> HADOOP-9090.justEnhanceDefaultImpl.5.patch, 
> HADOOP-9090.justEnhanceDefaultImpl.patch, HADOOP-9090.patch
>
>
> Updated description based on feedback:
> We have a need to publish metrics out of some short-living processes, which 
> is not really well-suited to the current metrics system implementation which 
> periodically publishes metrics asynchronously (a behavior that works great 
> for long-living processes). Of course I could write my own metrics system, 
> but it seems like such a waste to rewrite all the awesome code currently in 
> the MetricsSystemImpl and supporting classes.
> The way this JIRA solves this problem is adding a new method 
> publishMetricsNow() to the MetricsSystemImpl() class, that does a synchronous 
> out-of-band push of the metrics from the sources to the sink. I also add a 
> method to MetricsSinkAdapter (putMetricsImmediate) to support that change.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to