You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "javastuff.sam@gmail.com" <ja...@gmail.com> on 2016/10/10 23:26:58 UTC

Near cache

Hi,

Because Ignite always serialize data, we are not able to take advantage of
Near cache where cached object are heavy interms of
serialization/de-serilalization and no requirement of query or eviction. 
We are taking about 5 min vs 2 hours difference, if we do not cache meta
information of frequently accessed small number of objects.   

I am working on Java's standard map based implementation to simulate Near
cache where local heap has non-serialized object backed by partitioned
ignited distributed cache. Cache invalidation is a challenge where one node
invalidates partitioned distributed cache and now we have to invalidate
local copy of same cache form each each node. 

Need experts opinion on my POC -

For a particular cache add EVT_CACHE_OBJECT_REMOVED cache event listener. 
Now remove cache event will be generated on local node and remote node who
own that cache key.  
Remove event handler/actor publish a message to a topic. 
On receiving message on topic each node will remove object from local map
based copy.

Question -
1. Do you see any issue with this kind of implementation when cache
invalidation will be very less, but read will be more frequent?
2. Approximately how much delay one should expect during event generation
and publishing messages to all nodes?   
3. I have observed remove Event is generated only on acting local node or
owner node. So need to combine Event with Topic. Is there any other way this
can be achieved?
4. In terms of performance should we use -
 - Should we use local listener or remote listener? In POC I have added
remote listener.
 - Should we use sendOrderd or send?
4. Is there any specific sizing need to be done for REMOVE event and TOPIC?
We have around 20 such cache and I am planning to have a single topic. 

Regarding topology - At minimum 2 nodes with 20 GB off-heap. 

Thanks,
-Sam  



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Near-cache-tp8192.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Near cache

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hi,

Please clarify, are you enable the event (EVT_CACHE_OBJECT_REMOVED) in
config?
I guess, all node will be get EVT_CACHE_OBJECT_REMOVED in that case.

<bean class="org.apache.ignite.configuration.IgniteConfiguration">
        <!-- Enable task execution events for examples. -->
        <property name="includeEventTypes">
            <list>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
        ...

On Tue, Oct 11, 2016 at 8:56 PM, javastuff.sam@gmail.com <
javastuff.sam@gmail.com> wrote:

> Thank you for your reply. Would like to add more details to 3rd point as
> you
> have not clearly understood it.
>
> Lets assume there are 4 nodes running, node A brings data to distributed
> cache, as concept of Near Cahce I will push data to distributed cache as
> well as Node A will have it on heap in Map implementation. Later each node
> uses data from distributed cache and each node will now bring that data to
> their local heap based map implementation.
> Now comes the case of cache invalidation -  one of the node initiate REMOVE
> call and this will remove local heap copy for this acting node and
> distributed cache. This invokes EVT_CACHE_OBJECT_REMOVED event. However
> this
> event will be generated only on one node have that data in its partition
> (this is what I have observed, remote event for owner node and local event
> for acting node). In that case owner node has the responsibility to
> communicate to all other node to invalidate their local map based copy.
> So I am combining EVENT and TOPIC to implement this.
>
> Is this right approach? or there is a better approach?
>
> Cache remove event is generated only for owner node (node holding data in
> its partition) and node who is initiating remove API. Is this correct or it
> suppose to generate event for all nodes? Conceptually both have their own
> meaning and use, so I think both are correct.
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Near-cache-tp8192p8223.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Re: Near cache

Posted by "javastuff.sam@gmail.com" <ja...@gmail.com>.
Thank you for your reply. Would like to add more details to 3rd point as you
have not clearly understood it.

Lets assume there are 4 nodes running, node A brings data to distributed
cache, as concept of Near Cahce I will push data to distributed cache as
well as Node A will have it on heap in Map implementation. Later each node
uses data from distributed cache and each node will now bring that data to
their local heap based map implementation.
Now comes the case of cache invalidation -  one of the node initiate REMOVE
call and this will remove local heap copy for this acting node and
distributed cache. This invokes EVT_CACHE_OBJECT_REMOVED event. However this
event will be generated only on one node have that data in its partition
(this is what I have observed, remote event for owner node and local event
for acting node). In that case owner node has the responsibility to
communicate to all other node to invalidate their local map based copy.   
So I am combining EVENT and TOPIC to implement this. 

Is this right approach? or there is a better approach? 

Cache remove event is generated only for owner node (node holding data in
its partition) and node who is initiating remove API. Is this correct or it
suppose to generate event for all nodes? Conceptually both have their own
meaning and use, so I think both are correct.
  




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Near-cache-tp8192p8223.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Near cache

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hi,

I think you will get long delay when updated local map entry, and general
issue you will be generate garbage, which increase garbage collector load
and consume of a heap.

The delay will not by long, but depends of communication layer.

I have not understand this. Why can not use one listener for some event
types[1]?

I think in your case, you need to use remote listener (which will invoke
not only in local node). You need use send, because sendOrdered give
additional performance load.

I can not say about this. You need to test implementation.

In general, you must not wait into listeners, because blocks will be bad
affect other task at the same thread pool. Also you always can tune thread
count in specific pool[2].

[1]: https://apacheignite.readme.io/docs/events
[2]:
https://apacheignite.readme.io/docs/performance-tips#tune-cache-data-rebalancing

On Tue, Oct 11, 2016 at 2:26 AM, javastuff.sam@gmail.com <
javastuff.sam@gmail.com> wrote:

> Hi,
>
> Because Ignite always serialize data, we are not able to take advantage of
> Near cache where cached object are heavy interms of
> serialization/de-serilalization and no requirement of query or eviction.
> We are taking about 5 min vs 2 hours difference, if we do not cache meta
> information of frequently accessed small number of objects.
>
> I am working on Java's standard map based implementation to simulate Near
> cache where local heap has non-serialized object backed by partitioned
> ignited distributed cache. Cache invalidation is a challenge where one node
> invalidates partitioned distributed cache and now we have to invalidate
> local copy of same cache form each each node.
>
> Need experts opinion on my POC -
>
> For a particular cache add EVT_CACHE_OBJECT_REMOVED cache event listener.
> Now remove cache event will be generated on local node and remote node who
> own that cache key.
> Remove event handler/actor publish a message to a topic.
> On receiving message on topic each node will remove object from local map
> based copy.
>
> Question -
> 1. Do you see any issue with this kind of implementation when cache
> invalidation will be very less, but read will be more frequent?
> 2. Approximately how much delay one should expect during event generation
> and publishing messages to all nodes?
> 3. I have observed remove Event is generated only on acting local node or
> owner node. So need to combine Event with Topic. Is there any other way
> this
> can be achieved?
> 4. In terms of performance should we use -
>  - Should we use local listener or remote listener? In POC I have added
> remote listener.
>  - Should we use sendOrderd or send?
> 4. Is there any specific sizing need to be done for REMOVE event and TOPIC?
> We have around 20 such cache and I am planning to have a single topic.
>
> Regarding topology - At minimum 2 nodes with 20 GB off-heap.
>
> Thanks,
> -Sam
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Near-cache-tp8192.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov