Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B1210E071 for ; Tue, 15 Jan 2013 19:20:05 +0000 (UTC) Received: (qmail 87012 invoked by uid 500); 15 Jan 2013 19:20:03 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 86778 invoked by uid 500); 15 Jan 2013 19:20:03 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 86767 invoked by uid 99); 15 Jan 2013 19:20:03 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 19:20:03 +0000 Received: from localhost (HELO mail-ob0-f175.google.com) (127.0.0.1) (smtp-auth username apurtell, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 19:20:03 +0000 Received: by mail-ob0-f175.google.com with SMTP id vb8so524128obc.34 for ; Tue, 15 Jan 2013 11:20:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.60.32.147 with SMTP id j19mr56339594oei.68.1358277602392; Tue, 15 Jan 2013 11:20:02 -0800 (PST) Received: by 10.60.1.101 with HTTP; Tue, 15 Jan 2013 11:20:02 -0800 (PST) In-Reply-To: References: Date: Tue, 15 Jan 2013 11:20:02 -0800 Message-ID: Subject: Re: Coprocessor / threading model From: Andrew Purtell To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=e89a8fb1f506ff3aba04d358a57b --e89a8fb1f506ff3aba04d358a57b Content-Type: text/plain; charset=ISO-8859-1 HTable is a blocking interface. When a client issues a put, for example, we do not want to return until we can confirm the store has been durably persisted. For client convenience many additional details of remote region invocation are hidden, for example META table lookups for relocated regions, reconnection, retries. Just about all coprocessor upcalls for the Observer interface happen with the RPC handler context. RPC handlers are drawn from a fixed pool of threads. Your CP code is tying up one of a fixed resource for as long as it has control. And in here you are running the complex HTable machinery. For many reasons your method call on HTable may block (potentially for a long time) and therefore the RPC handler your invocation is executing within will also block. An accidental cycle can cause a deadlock once there are no free handlers somewhere, which will happen as part of normal operation when the cluster is loaded, and the higher the load the more likely. Instead you can do what Anoop has described in this thread and install a CP into the master that insures index regions are assigned to the same regionserver as the primary table, and then call from a region of the primary table into a colocated region of the index table, or vice versa, bypassing HTable and the RPC stack. This is just making an in process method call on one object from another. Or, you could allocate a small executor pool for cross region RPC. When the upcall into your CP happens, dispatch work to the executor and return immediately to release the RPC worker thread back to the pool. This would avoid the possibility of deadlock but this may not give you the semantics you want because that background work could lag unpredictably. On Tue, Jan 15, 2013 at 10:44 AM, Wei Tan wrote: > Andrew, could you explain more, why doing cross-table operation is an > anti-pattern of using CP? > Durability might be an issue, as far as I understand. Thanks, > > > Best Regards, > Wei > -- Best regards, - Andy Problems worthy of attack prove their worth by hitting back. - Piet Hein (via Tom White) --e89a8fb1f506ff3aba04d358a57b--