You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Sergey Kozlov <sk...@gridgain.com> on 2015/11/11 11:16:30 UTC

Fifo eviction for atomic cache

Hi

I've tested some cache configurations with eviction policy and found a bit
strange behavior.

For instance the cache configuration is following and I want to have only
50 recent entries in cache (swap is disabled):

<bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="name"
value="cache_0001-ATOMIC-B2-PART-FIFO-OFF_VAL-OFFMAX_1024Lx1024L"/>
    <property name="atomicityMode" value="ATOMIC"/>
    <property name="backups" value="2"/>
    <property name="cacheMode" value="PARTITIONED"/>
    <property name="evictionPolicy">
        <bean
class="org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy">
            <property name="maxSize" value="50"/>
        </bean>
    </property>
    <property name="memoryMode" value="OFFHEAP_VALUES"/>
    <property name="offHeapMaxMemory" value="#{1024L*1024L}"/>
</bean>

1. I start 2 data nodes and a client node.
2. The client makes 60 puts (Int, String)
3. The client makes 60 gets for keys from the previous step and got only 40
entries. 20 first entries have been evicted.


I repeated the scenario above for various cache configurations (changing
options: writeSynchronizedMode, atomicityMode, rebalanceMode, cacheMode)
and found that the issue occurs only for atomic caches with
writeSynchronizedMode=ASYNC|PRIMARY_SYNC
Eviction for TX caches and for ATOMIC with writeSynchronizedMode=FULL_SYNC
works fine (always evicted 10 entries)

Could someone take a look and explain such behavior?

-- 
Sergey Kozlov

Re: Fifo eviction for atomic cache

Posted by Sergey Kozlov <sk...@gridgain.com>.
I'm wrong

Correct ticket is https://issues.apache.org/jira/browse/IGNITE-1889

On Wed, Nov 11, 2015 at 3:25 PM, Sergey Kozlov <sk...@gridgain.com> wrote:

> Thanks Andrey for notes!
>
> I've file the ticket https://issues.apache.org/jira/browse/IGNITE-1888
>
>
> On Wed, Nov 11, 2015 at 3:16 PM, Andrey Gura <ag...@gridgain.com> wrote:
>
>> Not quite. Actual the following operations sequence lead to this behavior:
>>
>> 1. put entries
>> 2. remove all entries
>> 3. put entries
>>
>> On Wed, Nov 11, 2015 at 2:59 PM, Sergey Kozlov <sk...@gridgain.com>
>> wrote:
>>
>> > It seems this behavior caused removeAll on empty cache executed before
>> > puts.
>> >
>> > On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <sk...@gridgain.com>
>> > wrote:
>> >
>> > > Hi
>> > >
>> > > I've tested some cache configurations with eviction policy and found a
>> > bit
>> > > strange behavior.
>> > >
>> > > For instance the cache configuration is following and I want to have
>> only
>> > > 50 recent entries in cache (swap is disabled):
>> > >
>> > > <bean class="org.apache.ignite.configuration.CacheConfiguration">
>> > >     <property name="name"
>> > > value="cache_0001-ATOMIC-B2-PART-FIFO-OFF_VAL-OFFMAX_1024Lx1024L"/>
>> > >     <property name="atomicityMode" value="ATOMIC"/>
>> > >     <property name="backups" value="2"/>
>> > >     <property name="cacheMode" value="PARTITIONED"/>
>> > >     <property name="evictionPolicy">
>> > >         <bean
>> > > class="org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy">
>> > >             <property name="maxSize" value="50"/>
>> > >         </bean>
>> > >     </property>
>> > >     <property name="memoryMode" value="OFFHEAP_VALUES"/>
>> > >     <property name="offHeapMaxMemory" value="#{1024L*1024L}"/>
>> > > </bean>
>> > >
>> > > 1. I start 2 data nodes and a client node.
>> > > 2. The client makes 60 puts (Int, String)
>> > > 3. The client makes 60 gets for keys from the previous step and got
>> only
>> > > 40 entries. 20 first entries have been evicted.
>> > >
>> > >
>> > > I repeated the scenario above for various cache configurations
>> (changing
>> > > options: writeSynchronizedMode, atomicityMode, rebalanceMode,
>> cacheMode)
>> > > and found that the issue occurs only for atomic caches with
>> > > writeSynchronizedMode=ASYNC|PRIMARY_SYNC
>> > > Eviction for TX caches and for ATOMIC with
>> > writeSynchronizedMode=FULL_SYNC
>> > > works fine (always evicted 10 entries)
>> > >
>> > > Could someone take a look and explain such behavior?
>> > >
>> > > --
>> > > Sergey Kozlov
>> > >
>> > >
>> >
>> >
>> > --
>> > Sergey Kozlov
>> >
>>
>>
>>
>> --
>> Andrey Gura
>> GridGain Systems, Inc.
>> www.gridgain.com
>>
>
>
>
> --
> Sergey Kozlov
>
>


-- 
Sergey Kozlov

Re: Fifo eviction for atomic cache

Posted by Sergey Kozlov <sk...@gridgain.com>.
Thanks Andrey for notes!

I've file the ticket https://issues.apache.org/jira/browse/IGNITE-1888


On Wed, Nov 11, 2015 at 3:16 PM, Andrey Gura <ag...@gridgain.com> wrote:

> Not quite. Actual the following operations sequence lead to this behavior:
>
> 1. put entries
> 2. remove all entries
> 3. put entries
>
> On Wed, Nov 11, 2015 at 2:59 PM, Sergey Kozlov <sk...@gridgain.com>
> wrote:
>
> > It seems this behavior caused removeAll on empty cache executed before
> > puts.
> >
> > On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <sk...@gridgain.com>
> > wrote:
> >
> > > Hi
> > >
> > > I've tested some cache configurations with eviction policy and found a
> > bit
> > > strange behavior.
> > >
> > > For instance the cache configuration is following and I want to have
> only
> > > 50 recent entries in cache (swap is disabled):
> > >
> > > <bean class="org.apache.ignite.configuration.CacheConfiguration">
> > >     <property name="name"
> > > value="cache_0001-ATOMIC-B2-PART-FIFO-OFF_VAL-OFFMAX_1024Lx1024L"/>
> > >     <property name="atomicityMode" value="ATOMIC"/>
> > >     <property name="backups" value="2"/>
> > >     <property name="cacheMode" value="PARTITIONED"/>
> > >     <property name="evictionPolicy">
> > >         <bean
> > > class="org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy">
> > >             <property name="maxSize" value="50"/>
> > >         </bean>
> > >     </property>
> > >     <property name="memoryMode" value="OFFHEAP_VALUES"/>
> > >     <property name="offHeapMaxMemory" value="#{1024L*1024L}"/>
> > > </bean>
> > >
> > > 1. I start 2 data nodes and a client node.
> > > 2. The client makes 60 puts (Int, String)
> > > 3. The client makes 60 gets for keys from the previous step and got
> only
> > > 40 entries. 20 first entries have been evicted.
> > >
> > >
> > > I repeated the scenario above for various cache configurations
> (changing
> > > options: writeSynchronizedMode, atomicityMode, rebalanceMode,
> cacheMode)
> > > and found that the issue occurs only for atomic caches with
> > > writeSynchronizedMode=ASYNC|PRIMARY_SYNC
> > > Eviction for TX caches and for ATOMIC with
> > writeSynchronizedMode=FULL_SYNC
> > > works fine (always evicted 10 entries)
> > >
> > > Could someone take a look and explain such behavior?
> > >
> > > --
> > > Sergey Kozlov
> > >
> > >
> >
> >
> > --
> > Sergey Kozlov
> >
>
>
>
> --
> Andrey Gura
> GridGain Systems, Inc.
> www.gridgain.com
>



-- 
Sergey Kozlov

Re: Fifo eviction for atomic cache

Posted by Andrey Gura <ag...@gridgain.com>.
Not quite. Actual the following operations sequence lead to this behavior:

1. put entries
2. remove all entries
3. put entries

On Wed, Nov 11, 2015 at 2:59 PM, Sergey Kozlov <sk...@gridgain.com> wrote:

> It seems this behavior caused removeAll on empty cache executed before
> puts.
>
> On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <sk...@gridgain.com>
> wrote:
>
> > Hi
> >
> > I've tested some cache configurations with eviction policy and found a
> bit
> > strange behavior.
> >
> > For instance the cache configuration is following and I want to have only
> > 50 recent entries in cache (swap is disabled):
> >
> > <bean class="org.apache.ignite.configuration.CacheConfiguration">
> >     <property name="name"
> > value="cache_0001-ATOMIC-B2-PART-FIFO-OFF_VAL-OFFMAX_1024Lx1024L"/>
> >     <property name="atomicityMode" value="ATOMIC"/>
> >     <property name="backups" value="2"/>
> >     <property name="cacheMode" value="PARTITIONED"/>
> >     <property name="evictionPolicy">
> >         <bean
> > class="org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy">
> >             <property name="maxSize" value="50"/>
> >         </bean>
> >     </property>
> >     <property name="memoryMode" value="OFFHEAP_VALUES"/>
> >     <property name="offHeapMaxMemory" value="#{1024L*1024L}"/>
> > </bean>
> >
> > 1. I start 2 data nodes and a client node.
> > 2. The client makes 60 puts (Int, String)
> > 3. The client makes 60 gets for keys from the previous step and got only
> > 40 entries. 20 first entries have been evicted.
> >
> >
> > I repeated the scenario above for various cache configurations (changing
> > options: writeSynchronizedMode, atomicityMode, rebalanceMode, cacheMode)
> > and found that the issue occurs only for atomic caches with
> > writeSynchronizedMode=ASYNC|PRIMARY_SYNC
> > Eviction for TX caches and for ATOMIC with
> writeSynchronizedMode=FULL_SYNC
> > works fine (always evicted 10 entries)
> >
> > Could someone take a look and explain such behavior?
> >
> > --
> > Sergey Kozlov
> >
> >
>
>
> --
> Sergey Kozlov
>



-- 
Andrey Gura
GridGain Systems, Inc.
www.gridgain.com

Re: Fifo eviction for atomic cache

Posted by Sergey Kozlov <sk...@gridgain.com>.
It seems this behavior caused removeAll on empty cache executed before puts.

On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <sk...@gridgain.com> wrote:

> Hi
>
> I've tested some cache configurations with eviction policy and found a bit
> strange behavior.
>
> For instance the cache configuration is following and I want to have only
> 50 recent entries in cache (swap is disabled):
>
> <bean class="org.apache.ignite.configuration.CacheConfiguration">
>     <property name="name"
> value="cache_0001-ATOMIC-B2-PART-FIFO-OFF_VAL-OFFMAX_1024Lx1024L"/>
>     <property name="atomicityMode" value="ATOMIC"/>
>     <property name="backups" value="2"/>
>     <property name="cacheMode" value="PARTITIONED"/>
>     <property name="evictionPolicy">
>         <bean
> class="org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy">
>             <property name="maxSize" value="50"/>
>         </bean>
>     </property>
>     <property name="memoryMode" value="OFFHEAP_VALUES"/>
>     <property name="offHeapMaxMemory" value="#{1024L*1024L}"/>
> </bean>
>
> 1. I start 2 data nodes and a client node.
> 2. The client makes 60 puts (Int, String)
> 3. The client makes 60 gets for keys from the previous step and got only
> 40 entries. 20 first entries have been evicted.
>
>
> I repeated the scenario above for various cache configurations (changing
> options: writeSynchronizedMode, atomicityMode, rebalanceMode, cacheMode)
> and found that the issue occurs only for atomic caches with
> writeSynchronizedMode=ASYNC|PRIMARY_SYNC
> Eviction for TX caches and for ATOMIC with writeSynchronizedMode=FULL_SYNC
> works fine (always evicted 10 entries)
>
> Could someone take a look and explain such behavior?
>
> --
> Sergey Kozlov
>
>


-- 
Sergey Kozlov