Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 44124 invoked from network); 15 Oct 2009 15:38:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Oct 2009 15:38:50 -0000 Received: (qmail 20708 invoked by uid 500); 15 Oct 2009 15:38:49 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 20682 invoked by uid 500); 15 Oct 2009 15:38:49 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 20673 invoked by uid 99); 15 Oct 2009 15:38:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Oct 2009 15:38:49 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jakers@gmail.com designates 209.85.219.209 as permitted sender) Received: from [209.85.219.209] (HELO mail-ew0-f209.google.com) (209.85.219.209) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Oct 2009 15:38:47 +0000 Received: by ewy5 with SMTP id 5so600417ewy.12 for ; Thu, 15 Oct 2009 08:38:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:x-mailer :mime-version:subject:date:references; bh=jpc0RP+dc3Ts63KndowkaHHiZJ4yWNYXApL6TTm+qhU=; b=RFb0KRWjzf6vUjHxct2jduUW4d08AGZZ7t9YG6/AnXhcLTqL9ZfC5VCQkZVFodHZCB hTptruXpbfrJSImqVQTjPnT6kZWBG9lf1iWI9kVqYtple6MQldF/BE4xZSDdCkhbj+5A KuZYtWxyZTb+EvN1ozhoTJoPVg4II8r/9cjbY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:x-mailer:mime-version:subject:date :references; b=eVhTNxN0J3RJlw12jgGjXdOBnU4ZHhHG2lmf1eA2AhuFz399xLa/ra2GjW80PZWZZl wNTp7TtuBejeeH4HZQj1yqa7ILcz32K18bo0224fICFDWqfmhpqRxe2gAE5MGt74q4X3 rPRu1yfl+uisRobpQU0eOzHKTXCyEaMYuME3M= Received: by 10.216.88.6 with SMTP id z6mr66328wee.52.1255621105945; Thu, 15 Oct 2009 08:38:25 -0700 (PDT) Received: from ?10.137.174.204? (mobile-166-137-134-146.mycingular.net [166.137.134.146]) by mx.google.com with ESMTPS id t2sm446883gve.12.2009.10.15.08.38.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 15 Oct 2009 08:38:24 -0700 (PDT) Message-Id: <08976DB1-1089-402E-998F-9BC65ACCBD7C@gmail.com> From: Jake Luciani To: "cassandra-user@incubator.apache.org" In-Reply-To: <91882eb0910150826w16dc4e08g62ec1d279b458255@mail.gmail.com> Content-Type: multipart/alternative; boundary=Apple-Mail-7-288487192 Content-Transfer-Encoding: 7bit X-Mailer: iPhone Mail (7C144) Mime-Version: 1.0 (iPhone Mail 7C144) Subject: Re: Thrift Perl API Timeout Issues Date: Thu, 15 Oct 2009 11:37:57 -0400 References: <91882eb0910150826w16dc4e08g62ec1d279b458255@mail.gmail.com> --Apple-Mail-7-288487192 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit You need to call $socket->setRecvTimeout() With a higher number in ms. On Oct 15, 2009, at 11:26 AM, Eric Lubow wrote: > Using the Thrift Perl API into Cassandra, I am running into what is > endearingly referred to as the 4 bytes of doom: > > TSocket: timed out reading 4 bytes from localhost:9160 > > The script I am using is fairly simple. I have a text file that has > about 3.6 million lines that are formatted like: foo@bar.com 1234 > > The Cassandra dataset is a single column family called Users in the > Mailings keyspace with a data layout of: > Users = { > 'foo@example.com': { > email: 'foo@example.com', > person_id: '123456', > send_dates_2009-09-30: '2245', > send_dates_2009-10-01: '2247', > }, > } > There are about 3.5 million rows in the Users column family and each > row has no more than 4 columns (listed above). Some only have 3 > (one of the send_dates_YYYY-MM-DD isn't there). > > The script parses it and then connects to Cassandra and does a > get_slice and counts the return values adding that to a hash: > my ($value) = $client->get_slice( > 'Mailings', > $email, > Cassandra::ColumnParent->new({ > column_family => 'Users', > }), > Cassandra::SlicePredicate->new({ > slice_range => Cassandra::SliceRange->new({ > start => 'send_dates_2009-09-29', > finish => 'send_dates_2009-10-30', > }), > }), > Cassandra::ConsistencyLevel::ONE > ); > $counter{($#{$value} + 1)}++; > > For the most part, this script times out after 1 minute or so. > Replacing the get_slice with a get_count, I can get it to about 2 > million queries before I get the timeout. Replacing the get_slice > with a get, I make it to about 2.5 million before I get the > timeout. The only way I could get it to run all the way through was > to add a 1/100 of a second sleep during every iteration. I was able > to get the script to complete when I shut down everything else on > the machine (and it took 177m to complete). But since this is a > semi-production machine, I had to turn everything back on afterwards. > > So for poops and laughs (at the recommendation of jbellis), I > rewrote the script in Python and it has since run (using get_slice) > 3 times fully without timing out (approximately 130m in Python) with > everything else running on the machine. > > My question is, having seen this same thing in the PHP API and it is > my understanding that the Perl API was based on the PHP API, could http://issues.apache.org/jira/browse/THRIFT-347 > apply to Perl here too? Is anyone else seeing this issue? If so, > have you gotten around it? > > Thanks. > > -e --Apple-Mail-7-288487192 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
You need to call
$socket->setRecvTimeout()

With a higher number in ms. 


On Oct 15, 2009, at 11:26 AM, Eric Lubow <eric.lubow@gmail.com> wrote:

Using the Thrift Perl API into Cassandra, I am running into what is endearingly referred to as the 4 bytes of doom:

 TSocket: timed out reading 4 bytes from localhost:9160

The script I am using is fairly simple.  I have a text file that has about 3.6 million lines that are formatted like:  foo@bar.com  1234

The Cassandra dataset is a single column family called Users in the Mailings keyspace with a data layout of:
Users = { 
    'foo@example.com': {
        email: 'foo@example.com',
        person_id: '123456',
        send_dates_2009-09-30: '2245',
        send_dates_2009-10-01: '2247',
    },
}
There are about 3.5 million rows in the Users column family and each row has no more than 4 columns (listed above).  Some only have 3 (one of the send_dates_YYYY-MM-DD isn't there).

The script parses it and then connects to Cassandra and does a get_slice and counts the return values adding that to a hash:
     my ($value) = $client->get_slice(
         'Mailings',
         $email,
         Cassandra::ColumnParent->new({
                 column_family => 'Users',
             }),
         Cassandra::SlicePredicate->new({
                 slice_range => Cassandra::SliceRange->new({
                         start => 'send_dates_2009-09-29',
                         finish => 'send_dates_2009-10-30',
                     }),
             }),
         Cassandra::ConsistencyLevel::ONE
     );
     $counter{($#{$value} + 1)}++;

For the most part, this script times out after 1 minute or so. Replacing the get_slice with a get_count, I can get it to about 2 million queries before I get the timeout.  Replacing the get_slice with a get, I make it to about 2.5 million before I get the timeout.  The only way I could get it to run all the way through was to add a 1/100 of a second sleep during every iteration.  I was able to get the script to complete when I shut down everything else on the machine (and it took 177m to complete).  But since this is a semi-production machine, I had to turn everything back on afterwards.

So for poops and laughs (at the recommendation of jbellis), I rewrote the script in Python and it has since run (using get_slice) 3 times fully without timing out (approximately 130m in Python) with everything else running on the machine.

My question is, having seen this same thing in the PHP API and it is my understanding that the Perl API was based on the PHP API, could http://issues.apache.org/jira/browse/THRIFT-347 apply to Perl here too?  Is anyone else seeing this issue?  If so, have you gotten around it?

Thanks.

-e
--Apple-Mail-7-288487192--