Le lundi 19 septembre 2016 17:00:03 UTC+2, Cédric Krier a écrit :
>
> On 2016-09-19 05:32, Ali Kefia wrote: 
> > May be I missed something but it is worth asking a question: 
> > When we have 2 workers, W1 and W2, working on an instance (call it a 
> > product), how to manage this situation: 
> > 
> >    - W1 added product to cache (from database) 
> >    - W2 modified product and cleared ITS product cache 
> >    - W1 makes get on product cache => hit an invalid version 
> > 
> > We can not check db on each cache.get call? 
>
> You can not add to Cache Model instance because they are linked to the 
> transaction.  

The Cache objects only store base type and the invalidation is managed 
> by the developer with the call to clear.


We do not set instances, we set flat data (msgpack serialization)

It is all the cache that is 
> cleared so it is quite raw but normally Cache should only be used for 
> data that almost never change. 
>

cached data get changed rarely, but it could (if not, invalidation mecanism 
has no reason to exist)
the issue with cache on multi workers is that invalidation does not 
propagate. And since using db is counter cache principle, we took Redis.
side effect advantages were:

   - less locks on Python code
   - less memory usage (shared memory)
   - faster worker startup (since cache is already up and loaded)

 

>
> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: cedric...@b2ck.com <javascript:> 
> Tel: +32 472 54 46 59 
> Website: http://www.b2ck.com/ 
>

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/8d2122cd-3c4f-4199-a02a-deca832c241c%40googlegroups.com.

Reply via email to