title: Cassandra Amazon EC2, Read Performance experiments
body: <p>I need some help improving Cassandra read performance. I am concerned about degradation of read performance as the size of the column family increases. We have the following stats on single-node Cassandra.</p>
  
  <p><strong>Operating System:</strong> Linux  -  CentOS release 5.4 (Final)<br>
  <strong>Cassandra version:</strong> apache-cassandra-1.1.0 <br>
  <strong>Java version:</strong> "1.6.0_14"
  Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
  Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)</p>
  
  <p><strong>Cassandra Configuration:</strong> (cassandra.yaml) <br></p>
  
  <ul>
  <li>rpc_server_type: hsha</li>
  <li>disk_access_mode: mmap</li>
  <li>concurrent_reads: 64</li>
  <li>concurrent_writes: 32</li>
  </ul>
  
  <p><strong>Platform:</strong> Amazon-ec2/Rightscale m1.Xlarge instance with 4 ephemeral disks with raid0. (15 GB Total Memory, 4 Virtual Cores, 2 ECU , Total ECU = 8)</p>
  
  <hr>
  
  <p><strong>Experiment configurations:</strong>
  I have tried to do some experiments with GC</p>
  
  <p>Cassandra config:<br>
  10 GB RAM is allocated to Cassandra Heap, 3500MB is Heap NEW size.</p>
  
  <p>JVM Config:<br>
  JVM_OPTS="$JVM_OPTS -XX:+UseParNewGC"<br>
  JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC"<br>
  JVM_OPTS="$JVM_OPTS -XX:+CMSParallelRemarkEnabled"<br>
  JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=1000"<br>
  JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=0"<br>
  JVM_OPTS="$JVM_OPTS -XX:CMSInitiatingOccupancyFraction=40"<br>
  JVM_OPTS="$JVM_OPTS -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseCompressedOops"<br>
  <hr>
  <br><strong>Result stats from OpsCenter community 2.0:</strong><br></p>
  
  <p>Read Requests 208 to 240 per second<br>
  Write Requests 18 to 28 per second<br>
  OS Load 24.5 to 25.85<br>
  Write Request Latency 127 to 160 micros<br>
  Read Request Latency 82202 to 94612 micros<br>
  OS Sent Network Traffic 44646 KB avg per second<br>
  OS Recieved Network Traffic 4338 KB avg per second<br>
  OS Disk Queue Size 13 to 15 requests<br>
  Read Requests Pending 25 to 32<br></p>
  
  <p>OS Disk latency 48 to 56 ms<br>
  OS Disk Read Throughput 4.6 Mb per second<br>
  Disk IOPs Reads 420 per second<br></p>
  
  <p>IOWait 80 % CPU avg</p>
  
  <p>Idle 13 %  CPU avg</p>
  
  <p>Rowcache is disabled.</p>
  
  <p><hr>
  <strong>The Column Family</strong><br>
  One of the column family i am only reading from is created through CLI </p>
  
  <pre class="lang-sql prettyprint-override"><code>create column family XColFam 
  with column_type='Standard'  
  and  comparator = CompositeType(BytesType,IntegerType)';"
  </code></pre>
  
  <p>Column family SSTable Size = 7.10 GB, SSTable Count = 2</p>
  
  <p><code>XColFam</code> column family has 59499904 no. of estimated row keys (most are utf8 literal with varying length, estimated through mx4jtools) with columns like thin in nature, with the value 0 bytes.....now. </p>
  
  <p>Most of the rows should have very small number of columns,  maybe 1 to 10, so with approx 20 to 30 bytes of 1st component of column name and 2nd is of 8 bytes integer....2nd component of composite column is dynamic could repeat but probability is low.......1st component repeats in varieties  but number of columns in rows could be different.</p>
  
  <p>I have tried <code>SnappyCompression</code> to compress the column family but there was no change in size.</p>
  
  <p>I have a scheduled service that run for hours with 20 threads and make random read requests for multiple keys (for now its 2 keys per request) to this column family and read full rows, no column slice or etc.</p>
  
  <p>I think it is not performing good now because it is processing too few request per minute. It was working better before when the column family size was not that big. It was around 3 to 4 GB.</p>
  
  <p>I am afraid read performance degrade too fast with the increase in size of the column family.</p>
  
  <p>I have also tried to tweak some GC and memory stuff, because before that I was having lots GC and CPU usage. When data size was smaller and there was very small iowait in wave form.</p>
  
  <p><hr>
  How can I increase the Cassandra performance. Your suggestions will be appreciated.</p>