Can't seem to get off-heap memory working right...

classic Classic list List threaded Threaded
5 messages Options
javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Can't seem to get off-heap memory working right...

Using Ignite 1.3.0 with Java 1.8_45 on Ubuntu 14.04

Writing a micro service using vertx.io. I can't seem to get the performance right with off_heap memory.

I have the following cache....

private static IgniteCache<String, HashSet<String>> cache;

And it's configured as follows during application startup...

IgniteConfiguration igniteCfg = new IgniteConfiguration();
igniteCfg.setMarshaller(new OptimizedMarshaller(true));
                                                       
CacheConfiguration<String, HashSet<String>> myCfg = new CacheConfiguration<>("cache");
myCfg.setCacheMode(CacheMode.PARTITIONED);
myCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
myCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
myCfg.setOffHeapMaxMemory(16 * 1024L * 1024L * 1024L);
myCfg.setBackups(0);
                                   
ignite = Ignition.start(igniteCfg);
cache = ignite.getOrCreateCache("cache");

Inside my "web/http" handler I have...

String key = body.getString("key");
String value = body.getString("value");
HashSet<String> values = cache.get(key);

if(values == null)
{
        values = new HashSet<String>();
}

values.add(value);
cache.put(key, values);
myWebHandler.reply(new JsonObject().put(key, values.size()));


I start my application with -Xmx1g.
At about 2 million records the application becomes extremely slow. I.e: It goes from 12K requests/sec to not even 30 requests/sec.

If I start with -Xmx2g then I can go to about double the records (4 million) before it gets unresponsive.
-Xmx3g can go to 6 million and so on...

So it doesn't seem that off-heap is used. I'm I configuring something wrong?
Or is off-heap used but it's that much slower?
yakov yakov
Reply | Threaded
Open this post in threaded view
|

Re: Can't seem to get off-heap memory working right...

You created cache configuration, but do not use it. This makes all your entries stored onheap.

Pls do:
cache = ignite.getOrCreateCache("cache", myCfg);

--Yakov

2015-07-30 4:55 GMT+03:00 javadevmtl <[hidden email]>:
Using Ignite 1.3.0 with Java 1.8_45 on Ubuntu 14.04

Writing a micro service using vertx.io. I can't seem to get the performance
right with off_heap memory.

I have the following cache....

private static IgniteCache<String, HashSet&lt;String>> cache;

And it's configured as follows during application startup...

IgniteConfiguration igniteCfg = new IgniteConfiguration();
igniteCfg.setMarshaller(new OptimizedMarshaller(true));

CacheConfiguration<String, HashSet&lt;String>> myCfg = new
CacheConfiguration<>("cache");
myCfg.setCacheMode(CacheMode.PARTITIONED);
myCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
myCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
myCfg.setOffHeapMaxMemory(16 * 1024L * 1024L * 1024L);
myCfg.setBackups(0);

ignite = Ignition.start(igniteCfg);
cache = ignite.getOrCreateCache("cache");

Inside my "web/http" handler I have...

String key = body.getString("key");
String value = body.getString("value");
HashSet<String> values = cache.get(key);

if(values == null)
{
        values = new HashSet<String>();
}

values.add(value);
cache.put(key, values);
myWebHandler.reply(new JsonObject().put(key, values.size()));


I start my application with -Xmx1g.
At about 2 million records the application becomes extremely slow. I.e: It
goes from 12K requests/sec to not even 30 requests/sec.

If I start with -Xmx2g then I can go to about double the records (4 million)
before it gets unresponsive.
-Xmx3g can go to 6 million and so on...

So it doesn't seem that off-heap is used. I'm I configuring something wrong?
Or is off-heap used but it's that much slower?




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Can-t-seem-to-get-off-heap-memory-working-right-tp759.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Can't seem to get off-heap memory working right...

Correction. It should be:

cache = ignite.getOrCreateCache(myCfg);

(cache name is already specified in configuration)

-Val

On Wed, Jul 29, 2015 at 11:11 PM, Yakov Zhdanov <[hidden email]> wrote:
You created cache configuration, but do not use it. This makes all your entries stored onheap.

Pls do:
cache = ignite.getOrCreateCache("cache", myCfg);

--Yakov

2015-07-30 4:55 GMT+03:00 javadevmtl <[hidden email]>:
Using Ignite 1.3.0 with Java 1.8_45 on Ubuntu 14.04

Writing a micro service using vertx.io. I can't seem to get the performance

right with off_heap memory.

I have the following cache....

private static IgniteCache<String, HashSet&lt;String>> cache;

And it's configured as follows during application startup...

IgniteConfiguration igniteCfg = new IgniteConfiguration();
igniteCfg.setMarshaller(new OptimizedMarshaller(true));

CacheConfiguration<String, HashSet&lt;String>> myCfg = new
CacheConfiguration<>("cache");
myCfg.setCacheMode(CacheMode.PARTITIONED);
myCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
myCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
myCfg.setOffHeapMaxMemory(16 * 1024L * 1024L * 1024L);
myCfg.setBackups(0);

ignite = Ignition.start(igniteCfg);
cache = ignite.getOrCreateCache("cache");

Inside my "web/http" handler I have...

String key = body.getString("key");
String value = body.getString("value");
HashSet<String> values = cache.get(key);

if(values == null)
{
        values = new HashSet<String>();
}

values.add(value);
cache.put(key, values);
myWebHandler.reply(new JsonObject().put(key, values.size()));


I start my application with -Xmx1g.
At about 2 million records the application becomes extremely slow. I.e: It
goes from 12K requests/sec to not even 30 requests/sec.

If I start with -Xmx2g then I can go to about double the records (4 million)
before it gets unresponsive.
-Xmx3g can go to 6 million and so on...

So it doesn't seem that off-heap is used. I'm I configuring something wrong?
Or is off-heap used but it's that much slower?




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Can-t-seem-to-get-off-heap-memory-working-right-tp759.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Re: Can't seem to get off-heap memory working right...

Seems to work perfect! Thanks :)

Btw this interface doesn't exist... ignite.getOrCreateCache("cache", myCfg);

Should be ignite.getOrCreateCache(myCfg);
yakov yakov
Reply | Threaded
Open this post in threaded view
|

Re: Can't seem to get off-heap memory working right...

Yes, you are right.

--Yakov

2015-07-30 16:46 GMT+03:00 javadevmtl <[hidden email]>:
Seems to work perfect! Thanks :)

Btw this interface doesn't exist... ignite.getOrCreateCache("cache", myCfg);

Should be ignite.getOrCreateCache(myCfg);



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Can-t-seem-to-get-off-heap-memory-working-right-tp759p771.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.