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 Sun, 30 Jun 2013 15:35:14 GMT
Yes, it is one read request.

Since Cassandra does not support GROUP BY, I was trying to implement it in our application.
Hence the need to read large amount of data.  I guess that was a bad idea.


On Jun 27, 2013, at 9:54 PM, "aaron morton" <<>>

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.
Is this in one read request ?

Reading 80K columns is too many, try reading a few hundred at most.


Aaron Morton
Freelance Cassandra Consultant
New Zealand


On 26/06/2013, at 3:57 PM, Mohammed Guller <<>>

Replication is 3 and read consistency level is one. One of the non-cordinator mode is crashing,
so the OOM is happening before aggregation of the data to be returned.

Thanks for the info about the space allocated to young generation heap. That is helpful.


On Jun 25, 2013, at 1:28 PM, "sankalp kohli" <<>>

Your young gen is 1/4 of 1.8G which is 450MB. Also in slice queries, the co-ordinator will
get the results from replicas as per consistency level used and merge the results before returning
to the client.
What is the replication in your keyspace and what consistency you are reading with.
Also 55MB on disk will not mean 55MB in memory. The data is compressed on disk and also there
are other overheads.

On Mon, Jun 24, 2013 at 8:38 PM, Mohammed Guller <<>>
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