You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "steve.hostettler" <st...@gmail.com> on 2017/04/08 07:28:57 UTC

Identical objects on the same node

Hello,

I would to understand Ignite's behavior when I put identical objects (from
strings up to graphs of objects) in the same cache (as part of the graph of
different values) on the same node. In other words, is there some sort of
flyweight pattern implemented to reduce memory consumption?

Many thanks for your answer



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Identical-objects-on-the-same-node-tp11830.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Identical objects on the same node

Posted by "steve.hostettler" <st...@gmail.com>.
Hi Val,

I definitly consider this alternative ("normalizing" the objects like with
foreign keys) but it requires more work from my side to cope with graphes of
objects. In other terms, if I want to see data from the cache as "pure"
objects, I do have to implement the "ORM" layer on top of it with some sort
of lazy loading.  Therefore, I would have prefered to have it done at the
ignite level :)


Thanks for the advice.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Identical-objects-on-the-same-node-tp11830p11845.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Identical objects on the same node

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

The rational is simple - Ignite is a key-value storage. Locks, read and
write operations, etc. - all done on per entry level, and applying
optimizations like this would complicate things drastically, even if they
are possible.

If you want to avoid duplication, you should normalize the data. I.e. if
there are two objects referencing the same third object, store the latter as
a separate entry, and save its key in first two (similar to foreign key in
relational DB). You can then use SQL to query the data.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Identical-objects-on-the-same-node-tp11830p11841.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Identical objects on the same node

Posted by "steve.hostettler" <st...@gmail.com>.
Hello Val, 

thanks for the answer. Would it be theoritecally possible from your point of
view?
I mean having some sort of serialized pointers to other byte arrays on the
same node?

What is the rational of serializing everything on the node? I get that
internode communication requires serialization but if I optimize my
algorithms to be highly local then this inter-node communication is reduced
to a minimum. 


Steve



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Identical-objects-on-the-same-node-tp11830p11839.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Identical objects on the same node

Posted by vkulichenko <va...@gmail.com>.
If you're talking about values, then all of them are serialized and stored
separately. There are no optimizations like you described.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Identical-objects-on-the-same-node-tp11830p11834.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.