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 01A1B1020B for ; Sat, 16 Nov 2013 05:19:33 +0000 (UTC) Received: (qmail 64396 invoked by uid 500); 16 Nov 2013 05:19:25 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 63917 invoked by uid 500); 16 Nov 2013 05:19:21 -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 63909 invoked by uid 99); 16 Nov 2013 05:19:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Nov 2013 05:19:18 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tombrown52@gmail.com designates 74.125.82.182 as permitted sender) Received: from [74.125.82.182] (HELO mail-we0-f182.google.com) (74.125.82.182) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Nov 2013 05:19:12 +0000 Received: by mail-we0-f182.google.com with SMTP id q59so2294144wes.13 for ; Fri, 15 Nov 2013 21:18:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=gXG4kYEz3hKbGXqkOi6eMN+KEo8QfENnCpcuOn/Z+PA=; b=qz7+4eAQ1J2pSfqalT120za1BSK6TeSJt1C1qB6REVbLg1Yx81Px6PEbGXyTkdI0y4 dbQYrVZchknl8xbYbBhP7mIc9uwA++PmGHGQ4+0ezIzc+rsXPY7CVugK3+5jHmrXfXLE huzw1vEEAKUY9MsuUefWObYLITh/QzPem6UrQSagu0DjWnlanm3fd+Uy7uFoDRfQjfHv MN9NKvy4VuKWJCTTUrofard5GH+ylugitCo2ayBkZd6QxMentl9+hPwF4l8rtHk0J8jI m4vNEmGkSjnfPudc5uYe5NIX17kRgQ6fDFcrqe8KKHLIizbvWBpIDM3+V7tslt7+4jMO 6l4w== MIME-Version: 1.0 X-Received: by 10.180.12.12 with SMTP id u12mr9512492wib.48.1384579132454; Fri, 15 Nov 2013 21:18:52 -0800 (PST) Received: by 10.194.47.173 with HTTP; Fri, 15 Nov 2013 21:18:52 -0800 (PST) In-Reply-To: References: Date: Fri, 15 Nov 2013 22:18:52 -0700 Message-ID: Subject: Re: Uneven write request to regions From: Tom Brown To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=001a11c243da5a7b0504eb4473ff X-Virus-Checked: Checked by ClamAV on apache.org --001a11c243da5a7b0504eb4473ff Content-Type: text/plain; charset=ISO-8859-1 We have solved this by prefixing each key with a single byte. The byte is based on a very simple 8-bit hash of the record. If you know exactly which row you are looking for you can rehash your row to create the true key. Scans are a little more complex because you have to issue 256 scans instead of 1 scan, and interpolate the results. Another thing we did us write a utility to compute all the region sizes in a list, and recommend merges of now-empty regions, and splits of hot regions. Together, those two items solve the problem quite nicely for us. We haven't quite got to your scale yet, so YMMV. --Tom On Friday, November 15, 2013, Ted Yu wrote: > bq. you must have your customerId, timestamp in the rowkey since you query > on it > > Have you looked at this API in Scan ? > > public Scan setTimeRange(long minStamp, long maxStamp) > > > Cheers > > > On Fri, Nov 15, 2013 at 1:28 PM, Asaf Mesika > wrote: > > > The problem is that I do know my rowkey design, and it follows people's > > best practice, but generates a really bad use case which I can't seem to > > know how to solve yet. > > > > The rowkey as I said earlier is: > > > > So when ,for example, you have 1000 customer, and bucket ranges from 1 to > > 16, you eventually end up with: > > * 30k regions - What happens, as I presume: you start with one region > > hosting ALL customers, which is just one. As you pour in more customers > and > > more data, the region splitting kicks in. So, after a while, you get to a > > situation in which most regions hosts a specific customerId, bucket and > > time duration. For example: customer #10001, bucket 6, 01/07/2013 00:00 - > > 02/07/2013 17:00. > > * Empty regions - the first really bad consequence of what I told before > is > > that when the time duration is over, no data will ever be written to this > > region. and Worst - when the TTL you set (lets say 1 month) is over and > > it's 03/08/2013, this region gets empty! > > > > The thing is that you must have your customerId, timestamp in the rowkey > > since you query on it, but when you do, you will essentially get regions > > which will not get any more writes to them, and after TTL become zombie > > regions :) > > > > The second bad part of this rowkey design is that some customer will have > > significantly less traffic than other customers, thus in essence their > > regions will get written in a very slow rate compared with the high > traffic > > customer. When this happens on the same RS - bam: the slow region Puts > are > > causing the WAL Queue to get bigger over time, since its region never > gets > > to Max Region Size (256MB in our case) thus never gets flushed, thus > stays > > in the 1st WAL file. Until when? Until we hit max logs file permitted > (32) > > and then regions are flushed forcely. When this happen, we get about 100 > > regions with 3k-3mb store files. You can imagine what happens next. > > > > The weirdest thing here is that this rowkey design is very common - > nothing > > fancy here, so in essence this phenomenon should have happened to a lot > of > > people - but from some reason, I don't see that much writing about it. > > > > Thanks! > > > > Asaf > > > > > > > > On Fri, Nov 15, 2013 at 3:51 AM, Jia Wang wrote: > > > > > Then the case is simple, as i said "check your row key design, you can > > find > > > the start and end row key for each region, from which you can know why > > your > > > request with a specific row key doesn't hit a specified region" > > > > > > Cheers > > > Ramon > > > > > > > > > On Thu, Nov 14, 2013 at 8:47 PM, Asaf Mesika > > > wrote: > > > > > > > It's from the same table. > > > > The thing is that some simply have less data saved in > > HBase, > > > > while others have x50 (max) data. > > > > I'm trying to check how people designed their rowkey around it, or > had > > > > other out-of-the-box solution for it. > > > > > > > > > > > > > > > > On Thu, Nov 14, 2013 at 12:06 PM, Jia Wang > wrote: > > > > > > > > > Hi > > > > > > > > > > Are the regions from the same table? If it was, check your row key > > > > design, > > > > > you can find the start and end row key for each region, from which > > you > > > > can > > > > > know why your request with a specific row key doesn't hit a > specified > > > > > region. > > > > > > > > > > If the regions are for different table, you may consider to combine > > > some > > > > > cold regions for some tables. > > > > > > > > > > Thanks > > > > > Ramon > > > > > > > > > > > > > > > On Thu, Nov 14, 2013 at 4:59 PM, Asaf Mesika < --001a11c243da5a7b0504eb4473ff--