You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Timay <to...@trustwave.com> on 2017/10/18 01:30:19 UTC

Near Cache Topoolgy change causes NearCache to always miss.

Hey all,
</br>
</br>
Versions: 2.1 & 2.3-SNAPSHOT</br>
Setup: 1 client, 1+ servers
</br>
</br>
I found an issue with Near Caching. When a topology change occurs the
GridNearCacheEntry.valid method will update the GridNearCacheEntry.topVer to
None. This version then never gets "reset". Causing the state of the
GridNearCacheEntry.valid to always be false because the None check is done
before the update of the version. This will cause all future request to miss
the near cache and make a remote call to the cluster
</br></br>
From what i can see, the the AffinityTopologyVersion get set in a few spots
so i was unsure where to patch this. For testing i added a compare check to
the GridNearCacheEntry.loadedValue which set the topVer to the latest.

</br></br>
This is fairly large issue for us, as the performance goes from <1
millisecond to +40 milliseconds.
</br></br>
Let me know if you have questions.
        





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Near Cache Topoolgy change causes NearCache to always miss.

Posted by "slava.koptilin" <sl...@gmail.com>.
Hi Tim,

I was able to reproduce the issue.
I've created the following jira ticket in order to track this:
https://issues.apache.org/jira/browse/IGNITE-6767

Thanks,
S.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Near Cache Topoolgy change causes NearCache to always miss.

Posted by Timay <to...@trustwave.com>.
Hey Slave, 

Just some more details, it looks like the GridNearCacheEntry.primaryNode is
the suspect. That is what updates the topVer. If you create 2 nodes, then X
clients. Using one of the clients to create a cache with a near cache config
it seems to work as expected. However, if you create a cache on the node
instance then populate that cache, but try to get from a near cache created
through the client the change of a topology will cause the setting of the
topVer to none, then the primaryNode never get to reset the topVer causing
the 
GridNearCacheEntry.valid to return false. 

Hope that makes some sense, but attached is a test i used. It's crude but
should at least show what i am trying to convey. The good test  to what is
expected with a miss count being the initial call and the one after the
invalidation of the topology change, the bad has almost all read marked as
misses which causes the hard hit to the cluster. 

GridCacheNearClientMissTest.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t1401/GridCacheNearClientMissTest.java>  

Thanks
Tim(ay)



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Near Cache Topoolgy change causes NearCache to always miss.

Posted by "slava.koptilin" <sl...@gmail.com>.
Hi Timay,

I will try to reproduce the issue on my side.

Thanks!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Near Cache Topoolgy change causes NearCache to always miss.

Posted by Timay <to...@trustwave.com>.
Hey Slava,

Here they are. 

  @Bean(name ="cache" )
    public IgniteCache<Object, Object> getCache() throws IOException {
   
        CacheConfiguration<K, V> config = new CacheConfiguration<>();
        config.setAtomicityMode(CacheAtomicityMode.ATOMIC);
        config.setCacheMode(CacheMode.REPLICATED);
        config.setCopyOnRead(false);
        config.setName("cache");
      
        NearCacheConfiguration<K, V> nearCfg = new
NearCacheConfiguration<>();
        nearCfg.setNearEvictionPolicy(new LruEvictionPolicy<>(25000));    

       return _igniteSpringBean.getOrCreateCache(config,nearCfg);
    }



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Near Cache Topoolgy change causes NearCache to always miss.

Posted by "slava.koptilin" <sl...@gmail.com>.
Hi Timay,

Could you please share the configuration of cache and near cache?

Thanks!.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/