title: How to prevent heap filling up
body: <p>Firstly forgive me for what might be a very naive question.
  I am on a mission to identify the right nosql database for my project.
  I was inserting and updating records in the table (column family) in highly concurrent fashion.</p>
  
  <p>Then i encountered this.</p>
  
  <pre><code>INFO 11:55:20,924 Writing Memtable-scan_request@314832703(496750/1048576 serialized/live bytes, 8204 ops)
   INFO 11:55:21,084 Completed flushing /var/lib/cassandra/data/mykey/scan_request/mykey-scan_request-ic-14-Data.db (115527 bytes) for commitlog position ReplayPosition(segmentId=1372313109304, position=24665321)
   INFO 11:55:21,085 Writing Memtable-scan_request@721424982(1300975/2097152 serialized/live bytes, 21494 ops)
   INFO 11:55:21,191 Completed flushing /var/lib/cassandra/data/mykey/scan_request/mykey-scan_request-ic-15-Data.db (304269 bytes) for commitlog position ReplayPosition(segmentId=1372313109304, position=26554523)
   WARN 11:55:21,268 Heap is 0.829968311377531 full.  You may need to reduce memtable and/or cache sizes.  Cassandra will now flush up to the two largest memtables to free up memory.  Adjust flush_largest_memtables_at threshold in cassandra.yaml if you don't want Cassandra to do this automatically
   WARN 11:55:21,268 Flushing CFS(Keyspace='mykey', ColumnFamily='scan_request') to relieve memory pressure
   INFO 11:55:25,451 Enqueuing flush of Memtable-scan_request@714386902(324895/843149 serialized/live bytes, 5362 ops)
   INFO 11:55:25,452 Writing Memtable-scan_request@714386902(324895/843149 serialized/live bytes, 5362 ops)
   INFO 11:55:25,490 Completed flushing /var/lib/cassandra/data/mykey/scan_request/mykey-scan_request-ic-16-Data.db (76213 bytes) for commitlog position ReplayPosition(segmentId=1372313109304, position=27025950)
   WARN 11:55:30,109 Heap is 0.9017950505664833 full.  You may need to reduce memtable and/or cache sizes.  Cassandra will now flush up to the two largest memtables to free up memory.  Adjust flush_largest_memtables_at threshold in cassandra.yaml if you don't want Cassandra to do this automatically
  
  
  
  java.lang.OutOfMemoryError: Java heap space
  Dumping heap to java_pid8849.hprof ...
  Heap dump file created [1359702396 bytes in 105.277 secs]
   WARN 12:25:26,656 Flushing CFS(Keyspace='mykey', ColumnFamily='scan_request') to relieve memory pressure
   INFO 12:25:26,657 Enqueuing flush of Memtable-scan_request@728952244(419985/1048576 serialized/live bytes, 6934 ops)
  </code></pre>
  
  <p>Its to be noticed that i was able to insert &amp; update around 6 million records before i got this. I am using cassandra on a single node. In-spite of the hint in the logs, i am not able to decide what config to change. I did check into the bin/cassandra shell script and i see they have done lots of manipulation before they came up with the -Xms &amp; -Xmx values.</p>
  
  <p>Kindly advice.</p>