You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by relax ken <re...@gmail.com> on 2019/03/05 11:42:44 UTC

Why does write behind require to enable write through?

Hi,

I am new to Ignite. When I enable write behind, I always get a warning
"Write-behind mode for the cache store also requires
CacheConfiguration.setWriteThrough(true) property." Why does write behind
require write through when I am using write behind only?

Here is my configuration

CacheConfiguration<String, Document> cconfig = new CacheConfiguration<>();
cconfig.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cconfig.setCacheMode(CacheMode.PARTITIONED);
cconfig.setName(Constants.DocCacheName);
cconfig.setExpiryPolicyFactory(TouchedExpiryPolicy.factoryOf(new
Duration(TimeUnit.SECONDS, cacheConfig.cacheExpirySecs)));

cconfig.setWriteBehindEnabled(true);
cconfig.setWriteBehindFlushFrequency(cacheConfig.writeBehindFlushIntervalSec);
// MS


Thanks

Ken

Re: Why does write behind require to enable write through?

Posted by relax ken <re...@gmail.com>.
Thanks! Very helpful! That is all I wanted to know

On Fri, 8 Mar 2019, 09:04 Павлухин Иван, <vo...@gmail.com> wrote:

> Hi,
>
> Ignite CacheConfiguration inherits setWriteThrough method from JCache
> API [1]. Enabled writeThrough in JCache means that cache is backed by
> some other storage to which writes are propagated along with writes to
> to the cache. Unfortunately (or not?) JCache uses write-through term
> while Ignite supports write-behind write propagation policy. Perhaps
> API is not clear enough but I think that JCache conformance is the
> clue here.
>
> [1]
> https://static.javadoc.io/javax.cache/cache-api/1.1.0/javax/cache/configuration/MutableConfiguration.html#setWriteThrough-boolean-
>
> вт, 5 мар. 2019 г. в 16:59, relax ken <re...@gmail.com>:
> >
> > Thanks Ilya. I guess conceptually there are many explanations and
> definitions about those two on Internet which may agree, disagree, or
> consensus on some point. My question is more about their impact when they
> are true or false in Ignite.
> >
> > For example, if it's always the case, why doesn't Ignite just
> encapsulate this kind assumption, take care it and auto set write through
> true while write behind is set to true. Why does Ignite give this kind of
> option and warning? Will there be any difference when write behind is true
> but write through is not true? try to understand deeper about those options
> to avoid any unexpected behaviour.
> >
> > On Tue, Mar 5, 2019 at 1:46 PM Ilya Kasnacheev <
> ilya.kasnacheev@gmail.com> wrote:
> >>
> >> Hello!
> >>
> >> It is because write-behing is a kind of write-through. Like random
> access memory is a kind of computer memory.
> >>
> >> Regards,
> >> --
> >> Ilya Kasnacheev
> >>
> >>
> >> вт, 5 мар. 2019 г. в 14:43, relax ken <re...@gmail.com>:
> >>>
> >>> Hi,
> >>>
> >>> I am new to Ignite. When I enable write behind, I always get a warning
> "Write-behind mode for the cache store also requires
> CacheConfiguration.setWriteThrough(true) property." Why does write behind
> require write through when I am using write behind only?
> >>>
> >>> Here is my configuration
> >>>
> >>> CacheConfiguration<String, Document> cconfig = new
> CacheConfiguration<>();
> >>> cconfig.setAtomicityMode(CacheAtomicityMode.ATOMIC);
> >>> cconfig.setCacheMode(CacheMode.PARTITIONED);
> >>> cconfig.setName(Constants.DocCacheName);
> >>> cconfig.setExpiryPolicyFactory(TouchedExpiryPolicy.factoryOf(new
> Duration(TimeUnit.SECONDS, cacheConfig.cacheExpirySecs)));
> >>>
> >>> cconfig.setWriteBehindEnabled(true);
> >>>
> cconfig.setWriteBehindFlushFrequency(cacheConfig.writeBehindFlushIntervalSec);
> // MS
> >>>
> >>>
> >>> Thanks
> >>>
> >>> Ken
>
>
>
> --
> Best regards,
> Ivan Pavlukhin
>

Re: Why does write behind require to enable write through?

Posted by Павлухин Иван <vo...@gmail.com>.
Hi,

Ignite CacheConfiguration inherits setWriteThrough method from JCache
API [1]. Enabled writeThrough in JCache means that cache is backed by
some other storage to which writes are propagated along with writes to
to the cache. Unfortunately (or not?) JCache uses write-through term
while Ignite supports write-behind write propagation policy. Perhaps
API is not clear enough but I think that JCache conformance is the
clue here.

[1] https://static.javadoc.io/javax.cache/cache-api/1.1.0/javax/cache/configuration/MutableConfiguration.html#setWriteThrough-boolean-

вт, 5 мар. 2019 г. в 16:59, relax ken <re...@gmail.com>:
>
> Thanks Ilya. I guess conceptually there are many explanations and definitions about those two on Internet which may agree, disagree, or consensus on some point. My question is more about their impact when they are true or false in Ignite.
>
> For example, if it's always the case, why doesn't Ignite just encapsulate this kind assumption, take care it and auto set write through true while write behind is set to true. Why does Ignite give this kind of option and warning? Will there be any difference when write behind is true but write through is not true? try to understand deeper about those options to avoid any unexpected behaviour.
>
> On Tue, Mar 5, 2019 at 1:46 PM Ilya Kasnacheev <il...@gmail.com> wrote:
>>
>> Hello!
>>
>> It is because write-behing is a kind of write-through. Like random access memory is a kind of computer memory.
>>
>> Regards,
>> --
>> Ilya Kasnacheev
>>
>>
>> вт, 5 мар. 2019 г. в 14:43, relax ken <re...@gmail.com>:
>>>
>>> Hi,
>>>
>>> I am new to Ignite. When I enable write behind, I always get a warning "Write-behind mode for the cache store also requires CacheConfiguration.setWriteThrough(true) property." Why does write behind require write through when I am using write behind only?
>>>
>>> Here is my configuration
>>>
>>> CacheConfiguration<String, Document> cconfig = new CacheConfiguration<>();
>>> cconfig.setAtomicityMode(CacheAtomicityMode.ATOMIC);
>>> cconfig.setCacheMode(CacheMode.PARTITIONED);
>>> cconfig.setName(Constants.DocCacheName);
>>> cconfig.setExpiryPolicyFactory(TouchedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, cacheConfig.cacheExpirySecs)));
>>>
>>> cconfig.setWriteBehindEnabled(true);
>>> cconfig.setWriteBehindFlushFrequency(cacheConfig.writeBehindFlushIntervalSec); // MS
>>>
>>>
>>> Thanks
>>>
>>> Ken



-- 
Best regards,
Ivan Pavlukhin

Re: Why does write behind require to enable write through?

Posted by relax ken <re...@gmail.com>.
Thanks Ilya. I guess conceptually there are many explanations and
definitions about those two on Internet which may agree, disagree, or
consensus on some point. My question is more about their impact when they
are true or false in Ignite.

For example, if it's always the case, why doesn't Ignite just encapsulate
this kind assumption, take care it and auto set write through true while
write behind is set to true. Why does Ignite give this kind of option and
warning? Will there be any difference when write behind is true but write
through is not true? try to understand deeper about those options to avoid
any unexpected behaviour.

On Tue, Mar 5, 2019 at 1:46 PM Ilya Kasnacheev <il...@gmail.com>
wrote:

> Hello!
>
> It is because write-behing is a kind of write-through. Like random access
> memory is a kind of computer memory.
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> вт, 5 мар. 2019 г. в 14:43, relax ken <re...@gmail.com>:
>
>> Hi,
>>
>> I am new to Ignite. When I enable write behind, I always get a warning
>> "Write-behind mode for the cache store also requires
>> CacheConfiguration.setWriteThrough(true) property." Why does write behind
>> require write through when I am using write behind only?
>>
>> Here is my configuration
>>
>> CacheConfiguration<String, Document> cconfig = new CacheConfiguration<>();
>> cconfig.setAtomicityMode(CacheAtomicityMode.ATOMIC);
>> cconfig.setCacheMode(CacheMode.PARTITIONED);
>> cconfig.setName(Constants.DocCacheName);
>> cconfig.setExpiryPolicyFactory(TouchedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, cacheConfig.cacheExpirySecs)));
>>
>> cconfig.setWriteBehindEnabled(true);
>> cconfig.setWriteBehindFlushFrequency(cacheConfig.writeBehindFlushIntervalSec); // MS
>>
>>
>> Thanks
>>
>> Ken
>>
>

Re: Why does write behind require to enable write through?

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

It is because write-behing is a kind of write-through. Like random access
memory is a kind of computer memory.

Regards,
-- 
Ilya Kasnacheev


вт, 5 мар. 2019 г. в 14:43, relax ken <re...@gmail.com>:

> Hi,
>
> I am new to Ignite. When I enable write behind, I always get a warning
> "Write-behind mode for the cache store also requires
> CacheConfiguration.setWriteThrough(true) property." Why does write behind
> require write through when I am using write behind only?
>
> Here is my configuration
>
> CacheConfiguration<String, Document> cconfig = new CacheConfiguration<>();
> cconfig.setAtomicityMode(CacheAtomicityMode.ATOMIC);
> cconfig.setCacheMode(CacheMode.PARTITIONED);
> cconfig.setName(Constants.DocCacheName);
> cconfig.setExpiryPolicyFactory(TouchedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, cacheConfig.cacheExpirySecs)));
>
> cconfig.setWriteBehindEnabled(true);
> cconfig.setWriteBehindFlushFrequency(cacheConfig.writeBehindFlushIntervalSec); // MS
>
>
> Thanks
>
> Ken
>