You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Amit Pundir <am...@gmail.com> on 2017/07/19 21:13:26 UTC

Enforcing data to be stored in Heap only

Hello Everyone,

I am using Ignite 2.0 and want to use heap to cache my data. I have enabled
it through the api setOnheapCacheEnabled provided in the CacheConfiguration.

Let's say I have a total RAM size of 12 GB. I have set both Xms and Xmx to 8
GB while starting the Ignite server. The reason I did that is to maximize my
cache get and put operations from the Heap and keep the response time low.

The questions are - 
1. Will Ignite keep only the Cache keys in heap or will it keep the complete
'Entry' i.e. Key and Value both in Heap?
2. Will Ignite still push the application inserted data to off-Heap even if
there is enough space in Heap?
3. In this case, is it fine if I limit my virtual memory
'defaultMemoryPolicySize' to a smaller value like 1 GB?


Thanks





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Enforcing-data-to-be-stored-in-Heap-only-tp15141.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Enforcing data to be stored in Heap only

Posted by Amit Pundir <am...@gmail.com>.
Hi Val,

Would the BinaryObject api improve the performance even if the Key and Value
both are user-defined-objects instead of primitives?

I have a cluster of 8 ignite server nodes and 8 ignite client nodes
(tomcat). My use-case first gets a value for a key to the client node,
updates the state of that object and puts it back to the cache i.e server
node. I don't have a use-case to execute any application code on the server
nodes.

I am using Ignite 2.0.


Thanks




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Enforcing data to be stored in Heap only

Posted by Amit Pundir <am...@gmail.com>.
Hi Val, 

Would the BinaryObject api improve the performance even if the Key and Value 
both are user-defined-objects instead of primitives? 

I have a cluster of 8 ignite server nodes and 8 ignite client nodes 
(tomcat). My use-case first gets a value for a key to the client node, 
updates the state of that object and puts it back to the cache i.e server 
node. I don't have a use-case to execute any application code on the server 
nodes. 

I am using Ignite 2.0. 


Thanks 




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Enforcing data to be stored in Heap only

Posted by vkulichenko <va...@gmail.com>.
Amit Pundir wrote
> Does that mean the on-heap will benefit only when we have more 'get'
> operations but will degrade the performance with 'put' operations?

Yes, I think it's accurate. However, even for reads performance will be
noticeable inly in certain scenarios. As I already mentioned, this is just a
cache, it's not designed to duplicate everything you have off-heap.


Amit Pundir wrote
> Also, why Ignite 2.0 is duplicating data instead of maintaining one copy
> be in on-heap or off-heap?

Because that's the architecture of Ignite 2.0. It uses page memory, so there
are no objects at all. Everything is binary and everything is off-heap where
Ignite allocates memory manually, bypassing JVM and GC. Starting with 2.1
these pages can also be mapped to disk.

-Val




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Enforcing-data-to-be-stored-in-Heap-only-tp15141p15213.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Enforcing data to be stored in Heap only

Posted by Amit Pundir <am...@gmail.com>.
Hi Val,
Does that mean the on-heap will benefit only when we have more 'get'
operations but will degrade the performance with 'put' operations?

Also, why Ignite 2.0 is duplicating data instead of maintaining one copy be
in on-heap or off-heap? Would have been helpful, if the Ignite evicted the
on-heap entries to off-heap based on eviction policy set by the application.

I'll look into Binary Marshaller as well.


Thanks




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Enforcing-data-to-be-stored-in-Heap-only-tp15141p15207.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Enforcing data to be stored in Heap only

Posted by vkulichenko <va...@gmail.com>.
Amit,

Current architecture assumes that all data is stored off-heap. On-heap is
just a cache. I.e., when you update, you update both anyway.

Also serialization overhead exists regardless of whether you use on-heap or
off-heap, because values are always stored in binary format. To reduce this
overhead you can use BinaryObject API:
https://apacheignite.readme.io/docs/binary-marshaller

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Enforcing-data-to-be-stored-in-Heap-only-tp15141p15197.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Enforcing data to be stored in Heap only

Posted by Amit Pundir <am...@gmail.com>.
Hi Val,
Thanks for the response.

The onHeap get performance is better than getting from offHeap especially
for our use-cases. We get the data, update and put it back multiple times.
With every such request, the deserialization overhead from offHeap adds up.
We can't take such an overhead to maintain our SLAs.

Also, the decision to use on-heap vs off-heap should be left to the
application. In our case, we are fine to get a bigger heap (8 GB). But with
Ignite 2.0, the total RAM requirement shoots up drastically because it keeps
a copy of the on-heap data off-heap.

/I am assuming with on-heap enabled, the complete 'Entry<Key, Value>' is
stored on-heap and not just the 'Key'. I will confirm this with heap dump.
/

Thanks.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Enforcing-data-to-be-stored-in-Heap-only-tp15141p15168.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Enforcing data to be stored in Heap only

Posted by vkulichenko <va...@gmail.com>.
Hi Amit,

Primary data storage in 2.0 is off-heap and it always has all the in-memory
data. You can have additional on-heap cache, but its generally limited and
it duplicates the off-heap data. Why don't you want to use off-heap?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Enforcing-data-to-be-stored-in-Heap-only-tp15141p15142.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.