[
https://issues.apache.org/jira/browse/HADOOP-12475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Walter Su updated HADOOP-12475:
-------------------------------
Attachment: HADOOP-12475.03.patch
bq. And in java8, there is a computeIfAbsent method in ConcurrentHashMap which
does the same thing with guava cache. I think we could add a comment here like
'use computeIfAbsent instead if we decide to drop support of java7'?
Done. I didn't know it. Thanks! It is much cleaner.
bq. I would use ConcurrentMap instead of ConcurrentHashMap as the type. Also
line 130 has the checkstyle violation. It'd be good to fix it too.
Done.
Thanks again, [~Apache9], [~sjlee0]! And {{TestDNS}} failed recently and not
related. Uploaded 03 patch.
> Replace guava Cache with ConcurrentHashMap for caching Connection in ipc
> Client
> -------------------------------------------------------------------------------
>
> Key: HADOOP-12475
> URL: https://issues.apache.org/jira/browse/HADOOP-12475
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: conf, io, ipc
> Reporter: Walter Su
> Assignee: Walter Su
> Attachments: HADOOP-12475.01.patch, HADOOP-12475.02.patch,
> HADOOP-12475.03.patch
>
>
> quote [~daryn] from HADOOP-11772:
> {quote}
> CacheBuilder is obscenely expensive for concurrent map, and it requires
> generating unnecessary garbage even just to look up a key. Replace it with
> ConcurrentHashMap.
> I identified this issue that impaired my own perf testing under load. The
> slowdown isn't just the sync. It's the expensive of Connection's ctor
> stalling other connections. The expensive of ConnectionId#equals causes
> delays. Synch'ing on connections causes unfair contention unlike a sync'ed
> method. Concurrency simply hides this.
> {quote}
> BTW, guava Cache is heavyweight. Per local test, ConcurrentHashMap has better
> overal performance.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)