Hi Steve,
Here are a few techniques that solve this problem:
1. Gumball technique developed at USC
-
http://abineshtd.blogspot.com/2012/09/gumball-race-condition-prevention.html
- http://dblab.usc.edu/Users/papers/GumballTR.pdf
2. A solution in McDipper developed at Facebook
-
https://www.facebook.com/notes/facebook-engineering/mcdipper-a-key-value-cache-for-flash-storage/10151347090423920
Thanks
Abinesh
On Thursday, February 28, 2013 1:06:43 AM UTC-8, biao zhang wrote:
>
> Hi, everyone
>
> I found a question on Stack Overflow which is about race condition which
> is not easy to solve:
>
> http://stackoverflow.com/questions/7802772/cache-consistency-when-using-memcached-and-a-rdbms-like-mysql
>
> the question is:
>
> I have taken a database class this semester and we are studying about
> maintaining cache consistency between the RDBMS and a cache server such as
> memcached. The consistency issues arise when there are race conditions. For
> example: 1. Suppose I do a get(key) from the cache and their is a cache
> miss. Because I get a cache miss, I fetch the data from the database, and
> then do a put(key,value) into the cache. 2. But, a race condition might
> happen, where some other user might delete the data I fetched from the
> database. This delete might happen before I do a put into the cache.
>
> Thus, ideally the put into the cache should not happen, since the data is
> longer present into the database.
>
> If the cache entry has a TTL, the entry in the cache might expire. But
> still, their is a window where the data in the cache is inconsistent with
> the database.
>
>
> Does anyone know how to prevent race condition in that scenario?
>
> Thanks in advance.
>
> Best Regards,
>
> Steve
>
>
>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.