Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0756107C7 for ; Thu, 12 Dec 2013 06:19:29 +0000 (UTC) Received: (qmail 81069 invoked by uid 500); 12 Dec 2013 06:19:21 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 80994 invoked by uid 500); 12 Dec 2013 06:19:19 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 80914 invoked by uid 99); 12 Dec 2013 06:19:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Dec 2013 06:19:15 +0000 Date: Thu, 12 Dec 2013 06:19:15 +0000 (UTC) From: "stack (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-8755) A new write thread model for HLog to improve the overall HBase write throughput MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-8755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13846090#comment-13846090 ] stack commented on HBASE-8755: ------------------------------ Pardon me. This is taking a while; hardware issues and now I trunk seems to have issue where it hangs syncing, pre-patch I believe... investigating. Here is what I see. Lots of threads BLOCKED here: {code} "RpcServer.handler=0,port=60020" daemon prio=10 tid=0x00000000012f1800 nid=0x3cb5 waiting for monitor entry [0x00007fdb0eb55000] java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.hadoop.hbase.regionserver.wal.FSHLog.append(FSHLog.java:1006) - waiting to lock <0x0000000456c00390> (a java.lang.Object) at org.apache.hadoop.hbase.regionserver.wal.FSHLog.appendNoSync(FSHLog.java:1054) at org.apache.hadoop.hbase.regionserver.HRegion.doMiniBatchMutation(HRegion.java:2369) at org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2087) at org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2037) at org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2041) at org.apache.hadoop.hbase.regionserver.HRegionServer.doBatchOp(HRegionServer.java:4175) at org.apache.hadoop.hbase.regionserver.HRegionServer.doNonAtomicRegionMutation(HRegionServer.java:3424) at org.apache.hadoop.hbase.regionserver.HRegionServer.multi(HRegionServer.java:3328) at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:28460) at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2008) at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:92) at org.apache.hadoop.hbase.ipc.SimpleRpcScheduler.consumerLoop(SimpleRpcScheduler.java:160) at org.apache.hadoop.hbase.ipc.SimpleRpcScheduler.access$000(SimpleRpcScheduler.java:38) at org.apache.hadoop.hbase.ipc.SimpleRpcScheduler$1.run(SimpleRpcScheduler.java:110) at java.lang.Thread.run(Thread.java:744) {code} Then the fella w/ the lock is doing this: {code} "regionserver60020.logRoller" daemon prio=10 tid=0x0000000001159800 nid=0x3ca7 in Object.wait() [0x00007fdb0f964000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:503) at org.apache.hadoop.hbase.regionserver.wal.FSHLog.syncer(FSHLog.java:1307) - locked <0x0000000456bf37a8> (a java.util.concurrent.atomic.AtomicLong) at org.apache.hadoop.hbase.regionserver.wal.FSHLog.syncer(FSHLog.java:1299) at org.apache.hadoop.hbase.regionserver.wal.FSHLog.sync(FSHLog.java:1412) at org.apache.hadoop.hbase.regionserver.wal.FSHLog.cleanupCurrentWriter(FSHLog.java:760) at org.apache.hadoop.hbase.regionserver.wal.FSHLog.rollWriter(FSHLog.java:566) - locked <0x0000000456c00390> (a java.lang.Object) - locked <0x0000000456c00330> (a java.lang.Object) at org.apache.hadoop.hbase.regionserver.LogRoller.run(LogRoller.java:96) at java.lang.Thread.run(Thread.java:744) {code} Server is bound up. > A new write thread model for HLog to improve the overall HBase write throughput > ------------------------------------------------------------------------------- > > Key: HBASE-8755 > URL: https://issues.apache.org/jira/browse/HBASE-8755 > Project: HBase > Issue Type: Improvement > Components: Performance, wal > Reporter: Feng Honghua > Assignee: stack > Priority: Critical > Attachments: 8755-syncer.patch, 8755trunkV2.txt, HBASE-8755-0.94-V0.patch, HBASE-8755-0.94-V1.patch, HBASE-8755-0.96-v0.patch, HBASE-8755-trunk-V0.patch, HBASE-8755-trunk-V1.patch, HBASE-8755-trunk-v4.patch, HBASE-8755-trunk-v6.patch, HBASE-8755-trunk-v7.patch, HBASE-8755-v5.patch > > > In current write model, each write handler thread (executing put()) will individually go through a full 'append (hlog local buffer) => HLog writer append (write to hdfs) => HLog writer sync (sync hdfs)' cycle for each write, which incurs heavy race condition on updateLock and flushLock. > The only optimization where checking if current syncTillHere > txid in expectation for other thread help write/sync its own txid to hdfs and omitting the write/sync actually help much less than expectation. > Three of my colleagues(Ye Hangjun / Wu Zesheng / Zhang Peng) at Xiaomi proposed a new write thread model for writing hdfs sequence file and the prototype implementation shows a 4X improvement for throughput (from 17000 to 70000+). > I apply this new write thread model in HLog and the performance test in our test cluster shows about 3X throughput improvement (from 12150 to 31520 for 1 RS, from 22000 to 70000 for 5 RS), the 1 RS write throughput (1K row-size) even beats the one of BigTable (Precolator published in 2011 says Bigtable's write throughput then is 31002). I can provide the detailed performance test results if anyone is interested. > The change for new write thread model is as below: > 1> All put handler threads append the edits to HLog's local pending buffer; (it notifies AsyncWriter thread that there is new edits in local buffer) > 2> All put handler threads wait in HLog.syncer() function for underlying threads to finish the sync that contains its txid; > 3> An single AsyncWriter thread is responsible for retrieve all the buffered edits in HLog's local pending buffer and write to the hdfs (hlog.writer.append); (it notifies AsyncFlusher thread that there is new writes to hdfs that needs a sync) > 4> An single AsyncFlusher thread is responsible for issuing a sync to hdfs to persist the writes by AsyncWriter; (it notifies the AsyncNotifier thread that sync watermark increases) > 5> An single AsyncNotifier thread is responsible for notifying all pending put handler threads which are waiting in the HLog.syncer() function > 6> No LogSyncer thread any more (since there is always AsyncWriter/AsyncFlusher threads do the same job it does) -- This message was sent by Atlassian JIRA (v6.1.4#6159)