hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Krogen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-13782) Make MutableRates metrics thread-local write, aggregate-on-read
Date Tue, 08 Nov 2016 19:56:58 GMT

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

Erik Krogen commented on HADOOP-13782:
--------------------------------------

Thanks for the comments Zhe. I made {{snapshot}}/{{init}} {{synchronized}} methods; there
wasn't really a reason they needed to synchronize on {{globalMetrics}} rather than just being
{{synchronized}} methods. I also created {{ThreadSafeSampleStat}}; note that since the collection
of the {{numSamples}}/{{total}} values and the {{reset}} should be done as one atomic step,
I decided to create a wrapper class rather than a subclass. {{threadLocalMetricsMap}} needs
to be a concurrent map since a snapshotting thread may be reading it while the local thread
is doing a {{put}} operation. 

Good catch on the snapshot behavior not fully clearing; the correct behavior was lost between
the v001 and v002 patches. I integrated the correct logic into {{ThreadSafeSampleStat}}. 

Attaching v005 patch. 

> Make MutableRates metrics thread-local write, aggregate-on-read
> ---------------------------------------------------------------
>
>                 Key: HADOOP-13782
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13782
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: metrics
>            Reporter: Erik Krogen
>            Assignee: Erik Krogen
>         Attachments: HADOOP-13782.000.patch, HADOOP-13782.001.patch, HADOOP-13782.002.patch,
HADOOP-13782.003.patch, HADOOP-13782.004.patch, HADOOP-13782.005.patch
>
>
> Currently the {{MutableRates}} metrics class serializes all writes to metrics it contains
because of its use of {{MetricsRegistry.add()}} (i.e., even two increments of unrelated metrics
contained within the same {{MutableRates}} object will serialize w.r.t. each other). This
class is used by {{RpcDetailedMetrics}}, which may have many hundreds of threads contending
to modify these metrics. Instead we should allow updates to unrelated metrics objects to happen
concurrently. To do so we can let each thread locally collect metrics, and on a {{snapshot}},
aggregate the metrics from all of the threads. 
> I have collected some benchmark performance numbers in HADOOP-13747 (https://issues.apache.org/jira/secure/attachment/12835043/benchmark_results)
which indicate that this can bring significantly higher performance in high contention situations.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message