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 74B61E31C for ; Tue, 15 Jan 2013 22:42:21 +0000 (UTC) Received: (qmail 88380 invoked by uid 500); 15 Jan 2013 22:42:19 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 88323 invoked by uid 500); 15 Jan 2013 22:42:19 -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 88315 invoked by uid 99); 15 Jan 2013 22:42:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 22:42:19 +0000 X-ASF-Spam-Status: No, hits=-2.8 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_HI,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of wtan@us.ibm.com designates 32.97.182.139 as permitted sender) Received: from [32.97.182.139] (HELO e9.ny.us.ibm.com) (32.97.182.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 22:42:07 +0000 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 Jan 2013 17:41:46 -0500 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 15 Jan 2013 17:41:44 -0500 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 347E938C8045 for ; Tue, 15 Jan 2013 17:41:44 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0FMfhLo328348 for ; Tue, 15 Jan 2013 17:41:43 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0FMfhX1028017 for ; Tue, 15 Jan 2013 17:41:43 -0500 Received: from d01ml605.pok.ibm.com (d01ml605.pok.ibm.com [9.63.8.148]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r0FMfgWs027972 for ; Tue, 15 Jan 2013 17:41:43 -0500 In-Reply-To: References: To: user@hbase.apache.org MIME-Version: 1.0 Subject: Re: Coprocessor / threading model X-KeepSent: A63E5E5A:F744F2B5-85257AF4:007C3478; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.3FP2 SHF22 July 19, 2012 Message-ID: From: Wei Tan Date: Tue, 15 Jan 2013 17:41:40 -0500 X-MIMETrack: Serialize by Router on D01ML605/01/M/IBM(Release 8.5.3FP2 ZX853FP2HF2|October 8, 2012) at 01/15/2013 17:41:42, Serialize complete at 01/15/2013 17:41:42 Content-Type: multipart/alternative; boundary="=_alternative 007CA91685257AF4_=" X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13011522-7182-0000-0000-00000475D7EE X-Virus-Checked: Checked by ClamAV on apache.org --=_alternative 007CA91685257AF4_= Content-Type: text/plain; charset="US-ASCII" Thanks Andrew for your detailed clarification. Now I understand that in general, the system is subject to CAP theorem. You want good consistency AND latency, then partition tolerance needs to be sacrificed: this is the "local index" approach, i.e., colocate index and data and avoid RPC. Otherwise, if you can tolerate consistency but not latency, you put RPCs in a queue and process them in the background. By this means you can have a "global" index with some lag. Best Regards, Wei Wei Tan Research Staff Member IBM T. J. Watson Research Center Yorktown Heights, NY 10598 wtan@us.ibm.com; 914-945-4386 From: Andrew Purtell To: "user@hbase.apache.org" , Date: 01/15/2013 02:20 PM Subject: Re: Coprocessor / threading model 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) --=_alternative 007CA91685257AF4_=--