Fifo eviction for atomic cache

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Fifo eviction for atomic cache

Sergey Kozlov
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
Reply | Threaded
Open this post in threaded view
|

Re: Fifo eviction for atomic cache

Sergey Kozlov
It seems this behavior caused removeAll on empty cache executed before puts.

On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Fifo eviction for atomic cache

Andrey Gura
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 <[hidden email]> wrote:

> It seems this behavior caused removeAll on empty cache executed before
> puts.
>
> On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <[hidden email]>
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Fifo eviction for atomic cache

Sergey Kozlov
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 <[hidden email]> 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 <[hidden email]>
> wrote:
>
> > It seems this behavior caused removeAll on empty cache executed before
> > puts.
> >
> > On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <[hidden email]>
> > 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
Reply | Threaded
Open this post in threaded view
|

Re: Fifo eviction for atomic cache

Sergey Kozlov
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>
>> wrote:
>>
>> > It seems this behavior caused removeAll on empty cache executed before
>> > puts.
>> >
>> > On Wed, Nov 11, 2015 at 1:16 PM, Sergey Kozlov <[hidden email]>
>> > 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