incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohammed Guller <>
Subject Re: Cassandra terminates with OutOfMemory (OOM) error
Date Tue, 25 Jun 2013 00:38:00 GMT
No deletes. In my test, I am just writing and reading data.

There is a lot of GC, but only on the younger generation. Cassandra terminates before the
GC for old generation kicks in.

I know that our queries are reading an unusual amount of data. However, I expected it to throw
a timeout exception instead of crashing. Also, don't understand why 1.8 Gb heap is getting
full when the total data stored in the entire Cassandra cluster is less than 55 MB.


On Jun 21, 2013, at 7:30 PM, "sankalp kohli" <<>>

Looks like you are putting lot of pressure on the heap by doing a slice query on a large row.
Do you have lot of deletes/tombstone on the rows? That might be causing a problem.
Also why are you returning so many columns as once, you can use auto paginate feature in Astyanax.

Also do you see lot of GC happening?

On Fri, Jun 21, 2013 at 1:13 PM, Jabbar Azam <<>>
Hello Mohammed,

You should increase the heap space. You should also tune the garbage collection so young generation
objects are collected faster, relieving pressure on heap We have been using jdk 7 and it uses
G1 as the default collector. It does a better job than me trying to optimise the JDK 6 GC

Bear in mind though that the OS will need memory, so will the row cache and the filing system.
Although memory usage will depend on the workload of your system.

I'm sure you'll also get good advice from other members of the mailing list.


Jabbar Azam

On 21 June 2013 18:49, Mohammed Guller <<>>
We have a 3-node cassandra cluster on AWS. These nodes are running cassandra 1.2.2 and have
8GB memory. We didn't change any of the default heap or GC settings. So each node is allocating
1.8GB of heap space. The rows are wide; each row stores around 260,000 columns. We are reading
the data using Astyanax. If our application tries to read 80,000 columns each from 10 or more
rows at the same time, some of the nodes run out of heap space and terminate with OOM error.
Here is the error message:

java.lang.OutOfMemoryError: Java heap space
        at java.nio.HeapByteBuffer.duplicate(
        at org.apache.cassandra.db.marshal.AbstractCompositeType.getBytes(
        at org.apache.cassandra.db.marshal.AbstractCompositeType.getWithShortLength(
        at org.apache.cassandra.db.marshal.AbstractCompositeType.split(
        at org.apache.cassandra.db.filter.ColumnCounter$GroupByPrefix.count(
        at org.apache.cassandra.db.filter.SliceQueryFilter.collectReducedColumns(
        at org.apache.cassandra.db.filter.QueryFilter.collateColumns(
        at org.apache.cassandra.db.filter.QueryFilter.collateOnDiskAtom(
        at org.apache.cassandra.db.CollationController.collectAllData(
        at org.apache.cassandra.db.CollationController.getTopLevelColumns(
        at org.apache.cassandra.db.ColumnFamilyStore.getTopLevelColumns(
        at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(
        at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(
        at org.apache.cassandra.db.Table.getRow(
        at org.apache.cassandra.db.SliceFromReadCommand.getRow(
       at org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(
        at org.apache.cassandra.service.StorageProxy$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

ERROR 02:14:05,351 Exception in thread Thread[Thrift:6,5,main]
java.lang.OutOfMemoryError: Java heap space
        at java.lang.Long.toString(
        at java.lang.Long.toString(
        at org.apache.cassandra.dht.Murmur3Partitioner$1.toString(
        at org.apache.cassandra.service.StorageService.describeRing(
        at org.apache.cassandra.thrift.CassandraServer.describe_ring(
        at org.apache.cassandra.thrift.Cassandra$Processor$describe_ring.getResult(
        at org.apache.cassandra.thrift.Cassandra$Processor$describe_ring.getResult(
        at org.apache.thrift.ProcessFunction.process(
        at org.apache.thrift.TBaseProcessor.process(
        at org.apache.cassandra.thrift.CustomTThreadPoolServer$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

The data in each column is less than 50 bytes. After adding all the column overheads (column
name + metadata), it should not be more than 100 bytes. So reading 80,000 columns from 10
rows each means that we are reading 80,000 * 10 * 100 = 80 MB of data. It is large, but not
large enough to fill up the 1.8 GB heap. So I wonder why the heap is getting full. If the
data request is too big to fill in a reasonable amount of time, I would expect Cassandra to
return a TimeOutException instead of terminating.

One easy solution is to increase the heapsize. However that means Cassandra can still crash
if someone reads 100 rows.  I wonder if there some other Cassandra setting that I can tweak
to prevent the OOM exception?


View raw message