[ https://issues.apache.org/jira/browse/HDFS-5276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13793917#comment-13793917 ]
Binglin Chang commented on HDFS-5276: ------------------------------------- My test env (Macbook Pro i7 4core 8 thread hyperthreading) Original AtomicLong: Thread 1, Time: 1107 Thread 2, Time: 11391 Thread 3, Time: 23813 Thread 4, Time: 37780 Disable statistics: Thread 1, Time: 62 Thread 2, Time: 67 Thread 3, Time: 231 Thread 4, Time: 248 Thread 5, Time: 264 Thread 6, Time: 271 Thread 7, Time: 279 Thread 8, Time: 297 Thread 9, Time: 329 With ThreadLocal patch: Thread 1, Time: 901 Thread 2, Time: 1056 Thread 3, Time: 2473 Thread 4, Time: 2525 Thread 5, Time: 2689 Thread 6, Time: 2634 Thread 7, Time: 2938 Thread 8, Time: 3499 Thread 9, Time: 3551 With sychornized method Thread 1, Time: 2837 Thread 2, Time: 8630 Thread 3, Time: 11961 Thread 4, Time: 16026 Thread 5, Time: 19917 Thread 6, Time: 24423 Thread 7, Time: 28467 > FileSystem.Statistics got performance issue on multi-thread read/write. > ----------------------------------------------------------------------- > > Key: HDFS-5276 > URL: https://issues.apache.org/jira/browse/HDFS-5276 > Project: Hadoop HDFS > Issue Type: Bug > Affects Versions: 2.0.4-alpha > Reporter: Chengxiang Li > Assignee: Colin Patrick McCabe > Attachments: DisableFSReadWriteBytesStat.patch, HDFS-5276.001.patch, > HDFS-5276.002.patch, HDFSStatisticTest.java, hdfs-test.PNG, jstack-trace.PNG, > TestFileSystemStatistics.java, ThreadLocalStat.patch > > > FileSystem.Statistics is a singleton variable for each FS scheme, each > read/write on HDFS would lead to a AutomicLong.getAndAdd(). AutomicLong does > not perform well in multi-threads(let's say more than 30 threads). so it may > cause serious performance issue. during our spark test profile, 32 threads > read data from HDFS, about 70% cpu time is spent on > FileSystem.Statistics.incrementBytesRead(). -- This message was sent by Atlassian JIRA (v6.1#6144)