From user-return-12784-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Wed Feb 02 21:26:28 2011 Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 7993 invoked from network); 2 Feb 2011 21:26:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Feb 2011 21:26:28 -0000 Received: (qmail 19728 invoked by uid 500); 2 Feb 2011 21:26:25 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 19670 invoked by uid 500); 2 Feb 2011 21:26:25 -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 19662 invoked by uid 99); 2 Feb 2011 21:26:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 21:26:25 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jbellis@gmail.com designates 209.85.212.172 as permitted sender) Received: from [209.85.212.172] (HELO mail-px0-f172.google.com) (209.85.212.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 21:26:19 +0000 Received: by pxi6 with SMTP id 6so94719pxi.31 for ; Wed, 02 Feb 2011 13:25:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=9Au16NoNXBWy2TzTsTR0HlCtJehEXTLhu6WkCmG4pxk=; b=PSPb3CX7xzmhNKj+/8iM0nQJ3mYyL3nC3FHOw+XHXI8sM5UIwOK4SPqUHNe2BeamfS ryUiBH+88dH9mfMVgGYwXwgXbT73fD4OqLpWWCshhJDuat1hRKyJaD8yk5IWH5sOB0pi b7KMOw8XZ9Rw+XeEfr3Tmij3mjOwGIYtxFqtU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=GISlD1iLnuC0yMFD5ZL0M6UUxyA7rNIuf2u84OHI9j31ITZwCQKcZbqvO1rku2rraJ 2TbCZOforY2WMQiAqxIYEmK1t5b7Nu/FiJMcpidYeMFIS5uOZ4zKhel8O+J/AgvAljEu 7qtWjB92vOTZsWsR1qZ/9/RSwtGvGXP0W+dM0= Received: by 10.142.161.11 with SMTP id j11mr9354877wfe.60.1296681959228; Wed, 02 Feb 2011 13:25:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.164.19 with HTTP; Wed, 2 Feb 2011 13:25:38 -0800 (PST) In-Reply-To: References: From: Jonathan Ellis Date: Wed, 2 Feb 2011 13:25:38 -0800 Message-ID: Subject: Re: Slow network writes To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You need to use multiple threads to measure throughput. I strongly recommend starting with contrib/stress from the source distribution, which is multithreaded out of the box. On Wed, Feb 2, 2011 at 9:43 AM, ruslan usifov wro= te: > Hello > > I try make little cluster of 2 cassandra (0.7.0) nodes and I make little > test in php: > > > define("LIBPATH", "lib/"); > define("RECORDSSETCOUNT", 100); > > require_once("thrift/Thrift.php"); > require_once("thrift/transport/TSocket.php"); > require_once("thrift/transport/TFramedTransport.php"); > require_once("thrift/protocol/TBinaryProtocol.php"); > > require_once(LIBPATH."cassandra/Cassandra.php"); > require_once(LIBPATH."cassandra/cassandra_types.php"); > > //-----------------------------------------------------------------------= ------ > $transport =3D new TFramedTransport(new TSocket("10.24.84.4", 9160)); > $protocol=A0 =3D new TBinaryProtocolAccelerated($transport); > > $client =3D new CassandraClient($protocol); > $transport->open(); > > $client->set_keyspace("test"); > > //-----------------------------------------------------------------------= ------ > $l_row =3D array("qw" =3D> "12", "as" =3D> "67", "df" =3D> "df", "id" =3D= > "uid", > "uid" =3D> "1212"); > $l_begin =3D microtime(true); > > for($i=3D0; $i < 1000000; ++$i) > { > =A0=A0=A0 $l_columns =3D array(); > > =A0=A0=A0 foreach($l_row as $l_key =3D> $l_value) > =A0=A0=A0 { > =A0=A0=A0 =A0=A0=A0 $l_columns[] =3D new cassandra_Column(array("name" = =3D> $l_key, "value" > =3D> $l_value, "timestamp" =3D> time())); > =A0=A0=A0 }; > > =A0=A0=A0 $l_supercolumn =3D new cassandra_SuperColumn(array("name" =3D> = $l_row["id"], > "columns" =3D> $l_columns)); > =A0=A0=A0 $l_c_or_sc =3D new cassandra_ColumnOrSuperColumn(array("super_c= olumn" =3D> > $l_supercolumn)); > =A0=A0=A0 $l_mutation =3D new cassandra_Mutation(array("column_or_superco= lumn" =3D> > $l_c_or_sc)); > > =A0=A0=A0 $client->batch_mutate(array($l_row["uid"] =3D> array('adsdfsdfs= d' =3D> > array($l_mutation))), cassandra_ConsistencyLevel::ONE); > > =A0=A0=A0 if($i && !($i % 1000)) > =A0=A0=A0 { > =A0=A0=A0=A0=A0=A0 print (microtime(true) - $l_begin)."\n"; > =A0=A0=A0=A0=A0=A0 $l_begin =3D microtime(true); > =A0=A0=A0 }; > }; > > print "done\n"; > sleep(20); > ?> > > > > When i run this test on the same machine=A0 that run cassandra daemon wit= h > ip(10.24.84.4) i got foolow results: > > 0.64255094528198 > 0.53704404830933 > 0.4430079460144 > 0.43299198150635 > > > But when i switch test on the other cassandra daemon with ip(10.24.84.7),= so > test and cassandra daemon work on separates machines i got follow results= : > 2.4974539279938 > 2.3667190074921 > 2.2672221660614 > 2.3015670776367 > 2.2397489547729 > > So in my case performance degrade up to 5 times. Why this happens, and ho= w > can i solve this? Latency of my network is good, ping give: > > PING 10.24.84.7 (10.24.84.7) 56(84) bytes of data. > 64 bytes from 10.24.84.7: icmp_seq=3D1 ttl=3D64 time=3D0.758 ms > 64 bytes from 10.24.84.7: icmp_seq=3D2 ttl=3D64 time=3D0.696 ms > 64 bytes from 10.24.84.7: icmp_seq=3D3 ttl=3D64 time=3D0.687 ms > 64 bytes from 10.24.84.7: icmp_seq=3D4 ttl=3D64 time=3D0.735 ms > 64 bytes from 10.24.84.7: icmp_seq=3D5 ttl=3D64 time=3D0.689 ms > 64 bytes from 10.24.84.7: icmp_seq=3D6 ttl=3D64 time=3D0.631 ms > ^V64 bytes from 10.24.84.7: icmp_seq=3D7 ttl=3D64 time=3D0.379 ms > > PS: my system is Linux 2.6.32-311-ec2 #23-Ubuntu SMP Thu Dec 2 11:14:35 U= TC > 2010 x86_64 GNU/Linux > > > > --=20 Jonathan Ellis Project Chair, Apache Cassandra co-founder of DataStax, the source for professional Cassandra support http://www.datastax.com