You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by nskovpin <ko...@gmail.com> on 2017/04/12 16:18:10 UTC

Repeatable cache updates

Hello, Ignite team!
Assume that i have a big cache A (key - id, value - date, etc ). This cache
is being updated every 5 minutes. My question is: what is the best way to
update my other caches, that were built from cache A (value has a field
"date"). I have some thoughts:
1) I can create broadcast or computeTask, than read A's local entries and
update another caches (but i should read all my entries, even they haven't
updated yet)
2) I can create cacheEvents and update another caches - but i've read that
events are designed more for auditing purposes. 
3) I can create continuous query, but i don't need to query my data:)



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

Re: Repeatable cache updates

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi

2) Also you can subscribe to local node events and update other caches when
event is received on primary node for key to avoid excessive calls.



On Wed, Apr 12, 2017 at 7:35 PM, Andrey Mashenkov <
andrey.mashenkov@gmail.com> wrote:

> Hi,
>
> 3) Initial query is not mandatory, you can set it to null to receive
> updates only.
>
> Also, you can try CacheInterceptor to update other caches synchronously.
> It can cause performance issues as
> CacheInterceptor methods are called from sensitive part of code inside
> synchronized block, but it should be ok,
> if you update same key in another cache and it is one-way cache
> synchronization (so, deadlock is not possible).
>
>
> On Wed, Apr 12, 2017 at 7:18 PM, nskovpin <ko...@gmail.com> wrote:
>
>> Hello, Ignite team!
>> Assume that i have a big cache A (key - id, value - date, etc ). This
>> cache
>> is being updated every 5 minutes. My question is: what is the best way to
>> update my other caches, that were built from cache A (value has a field
>> "date"). I have some thoughts:
>> 1) I can create broadcast or computeTask, than read A's local entries and
>> update another caches (but i should read all my entries, even they haven't
>> updated yet)
>> 2) I can create cacheEvents and update another caches - but i've read that
>> events are designed more for auditing purposes.
>> 3) I can create continuous query, but i don't need to query my data:)
>>
>>
>>
>> --
>> View this message in context: http://apache-ignite-users.705
>> 18.x6.nabble.com/Repeatable-cache-updates-tp11910.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Best regards,
> Andrey V. Mashenkov
>



-- 
Best regards,
Andrey V. Mashenkov

Re: Repeatable cache updates

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi,

There is no need to add some reciever. IgniteDataStreamer.addData() will
send data automatically to affinity node.
Streamer use buffers to fill cache in efficient way, so data may be put to
cache with few delay.
You can flush Streamer buffer manually if needed and do not forget to close
Streamer instance to be sure all data has flushed.

On Thu, Apr 13, 2017 at 3:29 PM, nskovpin <ko...@gmail.com> wrote:

> Thank you for your answer. I have additional question: I wrote code with
> CacheInterceptor and i can easely react on igniteCache.put(key, value)
> method. But what should i do to listen IgniteDataStreamer.addData(k,v)
> method. The only one decision i've found - create receiver and explicitly
> call cache.put. Am i missing something?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Repeatable-cache-updates-tp11910p11943.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Best regards,
Andrey V. Mashenkov

Re: Repeatable cache updates

Posted by nskovpin <ko...@gmail.com>.
Thank you for your answer. I have additional question: I wrote code with
CacheInterceptor and i can easely react on igniteCache.put(key, value)
method. But what should i do to listen IgniteDataStreamer.addData(k,v)
method. The only one decision i've found - create receiver and explicitly
call cache.put. Am i missing something?



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

Re: Repeatable cache updates

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi,

3) Initial query is not mandatory, you can set it to null to receive
updates only.

Also, you can try CacheInterceptor to update other caches synchronously. It
can cause performance issues as
CacheInterceptor methods are called from sensitive part of code inside
synchronized block, but it should be ok,
if you update same key in another cache and it is one-way cache
synchronization (so, deadlock is not possible).


On Wed, Apr 12, 2017 at 7:18 PM, nskovpin <ko...@gmail.com> wrote:

> Hello, Ignite team!
> Assume that i have a big cache A (key - id, value - date, etc ). This cache
> is being updated every 5 minutes. My question is: what is the best way to
> update my other caches, that were built from cache A (value has a field
> "date"). I have some thoughts:
> 1) I can create broadcast or computeTask, than read A's local entries and
> update another caches (but i should read all my entries, even they haven't
> updated yet)
> 2) I can create cacheEvents and update another caches - but i've read that
> events are designed more for auditing purposes.
> 3) I can create continuous query, but i don't need to query my data:)
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Repeatable-cache-updates-tp11910.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Best regards,
Andrey V. Mashenkov