title: Cassandra Nodes dying frequently with Heap Space Error
body: <p>I have a problem with Cassandra Nodes dying regulary with 'java.lang.OutOfMemoryError: Java heap space' exceptions.</p>
  
  <p>My Setup consists of 5 Cassandra 2.0.11 Nodes running on 5 VM's.
  Each VM has 8GB RAM, 100GB disk capacity and a reasonably fast CPU.</p>
  
  <p>I already experimented with increasing the heap-size. Currently it is set to the default value (1/4th of 8GB=2GB).</p>
  
  <p>Memory is filled really fast and seams to be the limiting factor. How can I force cassandra to use less memory? I can tolerate slower write-operations in exchange for stability. </p>
  
  <p>Currently I only write with no updates, reads or deletes.
  I write time series with ~100000 values per file. Concurrency-level is QUORUM, replication-factor is 3. I use the java-driver from datastax.</p>
  
  <p>Tables are created like this:</p>
  
  <pre><code>"CREATE TABLE IF NOT EXISTS %s.%s(\n" +
          "ts_type text,\n" +
          "ts_name text,\n" +
          "year int,\n" +
          "time timestamp,\n" +
          "value double,\n" +
          "PRIMARY KEY((ts_type, ts_name), year, time));"
  </code></pre>
  
  <p>Data is written like this:</p>
  
  <pre><code>for (final Double value : data) {
      final Insert insertStatement = (Insert) QueryBuilder.insertInto(keyspace, tableName)
              .value("ts_type", tsType)
              .value("ts_name", tsName)
              .value("time", timestampAsDate)
              .value("year", timestamp.getYear())
              .value("value", value)
              .setConsistencyLevel(consistencyLevel);
      batch.add(insertStatement);
      zeitpunkt = zeitpunkt.plus(period);
      if (index++ % 200 == 0) {
          sets.add(client.executeAsync(batch));
          batch = (Batch) QueryBuilder.unloggedBatch().setConsistencyLevel(consistencyLevel);
      }
  }
  </code></pre>
  
  <p>Here is a stacktrace of a dying node:
  <a href="http://pastebin.com/tTNRgJMP" rel="nofollow">http://pastebin.com/tTNRgJMP</a></p>
  
  <p>As you see, GC took a really long time here.</p>
  
  <p>Here is a heap dump of a dying node:
  <a href="http://i.imgur.com/rOJ3MIl.jpg" rel="nofollow">http://i.imgur.com/rOJ3MIl.jpg</a></p>
  
  <p>Any idea what I am doing wrong?</p>
  
  <p>Thanks in advance for your help.</p>