You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Maciej Miklas <ma...@googlemail.com> on 2011/10/28 13:21:03 UTC

Row Cache Heap Requirements (Cassandra 1.0)

Hi all,

I've tested row cache, and find out, that it requires large amount of Heap -
I would like to verify this theory.

This is my test key space:
{
     TestCF: {

        row_key_1: {
            { clientKey: "MyTestCluientKey" },
            { tokenSecret: "kd94hf93k423kf44" },
            { verifier: "hfdp7dh39dks9884" },
            { callbackUrl: "http%3A%2F%2Fprinter.test.com%2Fready" },
            { accountId: "234567876545"},
            { mytestResourceId: "ADB112"},
            { dataTimestamp: "1308903420400" },
            { dataType: "ACCESS_PERMANENT"}
        },
        row_key_2: {
            { clientKey: "MyTestCluientKey" },
            { tokenSecret: "qdqergvhetyhvetyh" },
            { verifier: "wtrgvebyjnrnuiucewrqxcc" },
            { callbackUrl: "http%3A%2F%2Fprinter.test.com%2Fready" },
            { accountId: "23456789746534"},
            { mytestResourceId: "DQERGCWRTHB"},
            { dataTimestamp: "130890342333200" },
            { dataType: "ACCESS_LIMITED"}
        },

...
        row_key_x: {
    ....
        },

    }
}

Each row in CF: TestCF contains 8 columns. Row cache is enabled, key cache
is disabled. Row hit rate 0.99 - this is read only test.

My test loads 1.500.000 rows into cache - and this allocates about 3.5GB
heap - this is about 2KB pro single row - this is a lot....

Is it possible, that single row (8 columns) can allocate about 2KB heap?


Thank you,
Maciej

Re: Row Cache Heap Requirements (Cassandra 1.0)

Posted by Maciej Miklas <ma...@googlemail.com>.
this is how I tested it:

1) load cache with 1.500.000 entries
2) execute fill gc
3) mesure heap size (using visual vm)
4) execute flush row cahce over cli
5) execute full gc
6) and again mesure hap usage

The difference between 6) and 3) is the heap size used by cache

On Fri, Oct 28, 2011 at 3:26 PM, Peter Schuller <peter.schuller@infidyne.com
> wrote:

> > Is it possible, that single row (8 columns) can allocate about 2KB heap?
>
> It sounds a bit much, though not extremely so (depending on how much
> overhead there is per-column relative to per-row). Are you definitely
> looking at the live size of the heap (for example, trigger a full GC
> and look at results) and not just how much data there happens to be on
> the heap after your insertion?
>
> In any case, if you are looking for better memory efficiency I advise
> looking at the off-heap row cache
> (
> http://www.datastax.com/dev/blog/whats-new-in-cassandra-1-0-improved-memory-and-disk-space-management
> ).
> It is suposed to be enabled by default. If it's not, do you have JNA
> installed?
>
> The reason I say that is that the off-heap cache stores serialized
> information on the heap rather than the full tree of Java objects. If
> off-heap caching is enabled, 2 kb/row key would be far far more than
> expected (unless I'm missing something, I've actually yet to actually
> measure it myself ;)).
>
> --
> / Peter Schuller (@scode, http://worldmodscode.wordpress.com)
>

Re: Row Cache Heap Requirements (Cassandra 1.0)

Posted by Peter Schuller <pe...@infidyne.com>.
> Is it possible, that single row (8 columns) can allocate about 2KB heap?

It sounds a bit much, though not extremely so (depending on how much
overhead there is per-column relative to per-row). Are you definitely
looking at the live size of the heap (for example, trigger a full GC
and look at results) and not just how much data there happens to be on
the heap after your insertion?

In any case, if you are looking for better memory efficiency I advise
looking at the off-heap row cache
(http://www.datastax.com/dev/blog/whats-new-in-cassandra-1-0-improved-memory-and-disk-space-management).
It is suposed to be enabled by default. If it's not, do you have JNA
installed?

The reason I say that is that the off-heap cache stores serialized
information on the heap rather than the full tree of Java objects. If
off-heap caching is enabled, 2 kb/row key would be far far more than
expected (unless I'm missing something, I've actually yet to actually
measure it myself ;)).

-- 
/ Peter Schuller (@scode, http://worldmodscode.wordpress.com)