Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-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 69FB59D4E for ; Fri, 4 Nov 2011 14:28:33 +0000 (UTC) Received: (qmail 41704 invoked by uid 500); 4 Nov 2011 14:28:31 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 41675 invoked by uid 500); 4 Nov 2011 14:28:31 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 41667 invoked by uid 99); 4 Nov 2011 14:28:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 14:28:31 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sylvain@datastax.com designates 209.85.213.44 as permitted sender) Received: from [209.85.213.44] (HELO mail-yw0-f44.google.com) (209.85.213.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 14:28:23 +0000 Received: by ywt2 with SMTP id 2so2931078ywt.31 for ; Fri, 04 Nov 2011 07:28:02 -0700 (PDT) Received: by 10.236.114.83 with SMTP id b59mr21235314yhh.10.1320416882067; Fri, 04 Nov 2011 07:28:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.154.133 with HTTP; Fri, 4 Nov 2011 07:27:41 -0700 (PDT) X-Originating-IP: [88.183.33.171] In-Reply-To: References: From: Sylvain Lebresne Date: Fri, 4 Nov 2011 15:27:41 +0100 Message-ID: Subject: Re: Why SSTable is sorted by tokens instead of row keys? To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 4, 2011 at 1:49 PM, Gary Shi wrote: > I want to save time series event logs into Cassandra, and I need to load > them by key range (row key is time-based). But we can't use > RandomPartitioner in this way, while OrderPreservingPartitioner leads to hot > spot problem. > > So I wonder why Cassandra save SSTable by sorted row tokens instead of keys: > if rows in SSTable are sorted by keys, it should be quite easy to return > rows by key range -- token should be used to determine which node contains > the data. For key range requests, Cassandra could ask every node for that > range of rows, merge them and return to the caller. Without going for exhaustiveness: - Requesting every node is not too scalable. Cassandra is built to target the 'lots of cheap machines' kind of cluster, so that kind of operation is going the exact opposite way. In other words, that would be slow enough that you're better off modeling this using columns for time series. - That would make topology operations (bootstrap, move, decommission) much more costly, because we wouldn't be able to tell which keys to move unless we iterate over all the data each time. -- Sylvain > > -- > regards, > Gary Shi >