You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by lukaszbyjos <lu...@gmail.com> on 2018/02/09 14:50:53 UTC

Ignite with Spring Cache on K8S, eviction problem

Hi. I have k8s cluster with one ignite server and few services as clients.
I have problem with evicting values using spring annotations. 
Apps have cache "example-user" and when one service evict by key another one
still have values. 

There you can find cache config and example repo for spring
https://gist.github.com/Mistic92/8649515ff026e24ca0870ed61739a17c

What should I change or do because currently I don't have any idea :(




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

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by vkulichenko <va...@gmail.com>.
Can you try to reproduce the issue in a smaller project that you would be
able to share? Honestly, issue is absolutely not clear to me.

-Val



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

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by lukaszbyjos <lu...@gmail.com>.
I have something like in this gist. I cant share everything but in get there
is just request to DB. 
Evict is the same and I need to have this in the separate method because
sometimes I need to evict for list of ids. I know that I can't call this
method directly from the same class because of how Spring AOP works so
that's not a problem. Also, this method works for another cache where I have
only one key. 
I was looking at debug log level for Ignite and it was printed correctly
like 
[part=0, val=[PCdXXXXXXXXXXXXXo1, 0], hasValBytes=true]

https://gist.github.com/Mistic92/5043b682aa5742a7d7fad68c7ad8722c



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

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by Vinokurov Pavel <vi...@gmail.com>.
Could you show service methods with cache annotations.

2018-02-19 17:19 GMT+03:00 lukaszbyjos <lu...@gmail.com>:

> I still have a problem with evicting one cache. What's recommended setting
> for partitioned cache?
> From service B I want to evict "ch-current" cache but service A still see
> old values.
> At the same time just after evicting this cache the other one is evicted
> and
> looks like it's working.
> Cache "ch-current" keys are created like this
> "@CacheEvict(value = "ch-current", key = "{#uid.concat('-').concat(0)}"),"
> "@Cacheable(cacheNames = "ch-current", key =
> "{#userId.name().concat('-').concat(#page)}")"
> I changed key creation after your suggestions.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 

Regards

Pavel Vinokurov

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by lukaszbyjos <lu...@gmail.com>.
I still have a problem with evicting one cache. What's recommended setting
for partitioned cache?
From service B I want to evict "ch-current" cache but service A still see
old values. 
At the same time just after evicting this cache the other one is evicted and
looks like it's working. 
Cache "ch-current" keys are created like this 
"@CacheEvict(value = "ch-current", key = "{#uid.concat('-').concat(0)}"),"
"@Cacheable(cacheNames = "ch-current", key =
"{#userId.name().concat('-').concat(#page)}")"
I changed key creation after your suggestions. 



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

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by vkulichenko <va...@gmail.com>.
Pavel,

Can you please elaborate on this? What is generated by Spring and why is it
not suitable for Ignite?

-Val



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

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by Vinokurov Pavel <vi...@gmail.com>.
Spring creates a composite key that might be not suitable for the
distributed Ignite cache.
You could use the custom composite key using concatenation #user+ " - "+#id.


2018-02-09 17:50 GMT+03:00 lukaszbyjos <lu...@gmail.com>:

> Hi. I have k8s cluster with one ignite server and few services as clients.
> I have problem with evicting values using spring annotations.
> Apps have cache "example-user" and when one service evict by key another
> one
> still have values.
>
> There you can find cache config and example repo for spring
> https://gist.github.com/Mistic92/8649515ff026e24ca0870ed61739a17c
>
> What should I change or do because currently I don't have any idea :(
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 

Regards

Pavel Vinokurov

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by lukaszbyjos <lu...@gmail.com>.
No, at k8s I'm using partitioned. Currently I'm testing case with turned off
onheap. I don't know why but it doesn't work for the first time when it's
called but when I call this few minutes later it works. 
Maybe it's because of Atomic mode? 



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

Re: Ignite with Spring Cache on K8S, eviction problem

Posted by vkulichenko <va...@gmail.com>.
Why are using local cache instead of partitioned in dev? If you have local
caches, then you will get behavior exactly like you described - you will
remove from one node, but not remove on others. Can this be the case?

-Val



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