cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: Slow network writes
Date Wed, 02 Feb 2011 21:25:38 GMT
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 <ruslan.usifov@gmail.com> wrote:
> Hello
>
> I try make little cluster of 2 cassandra (0.7.0) nodes and I make little
> test in php:
>
>
> <?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 = new TFramedTransport(new TSocket("10.24.84.4", 9160));
> $protocol  = new TBinaryProtocolAccelerated($transport);
>
> $client = new CassandraClient($protocol);
> $transport->open();
>
> $client->set_keyspace("test");
>
> //-----------------------------------------------------------------------------
> $l_row = array("qw" => "12", "as" => "67", "df" => "df", "id" => "uid",
> "uid" => "1212");
> $l_begin = microtime(true);
>
> for($i=0; $i < 1000000; ++$i)
> {
>     $l_columns = array();
>
>     foreach($l_row as $l_key => $l_value)
>     {
>         $l_columns[] = new cassandra_Column(array("name" => $l_key, "value"
> => $l_value, "timestamp" => time()));
>     };
>
>     $l_supercolumn = new cassandra_SuperColumn(array("name" => $l_row["id"],
> "columns" => $l_columns));
>     $l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" =>
> $l_supercolumn));
>     $l_mutation = new cassandra_Mutation(array("column_or_supercolumn" =>
> $l_c_or_sc));
>
>     $client->batch_mutate(array($l_row["uid"] => array('adsdfsdfsd' =>
> array($l_mutation))), cassandra_ConsistencyLevel::ONE);
>
>     if($i && !($i % 1000))
>     {
>        print (microtime(true) - $l_begin)."\n";
>        $l_begin = microtime(true);
>     };
> };
>
> print "done\n";
> sleep(20);
> ?>
>
>
>
> When i run this test on the same machine  that run cassandra daemon with
> 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 how
> 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=1 ttl=64 time=0.758 ms
> 64 bytes from 10.24.84.7: icmp_seq=2 ttl=64 time=0.696 ms
> 64 bytes from 10.24.84.7: icmp_seq=3 ttl=64 time=0.687 ms
> 64 bytes from 10.24.84.7: icmp_seq=4 ttl=64 time=0.735 ms
> 64 bytes from 10.24.84.7: icmp_seq=5 ttl=64 time=0.689 ms
> 64 bytes from 10.24.84.7: icmp_seq=6 ttl=64 time=0.631 ms
> ^V64 bytes from 10.24.84.7: icmp_seq=7 ttl=64 time=0.379 ms
>
> PS: my system is Linux 2.6.32-311-ec2 #23-Ubuntu SMP Thu Dec 2 11:14:35 UTC
> 2010 x86_64 GNU/Linux
>
>
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Mime
View raw message