Cache consistency when using memcached and a rdbms like MySQL

前端 未结 4 2052
鱼传尺愫
鱼传尺愫 2021-02-14 03:30

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 issue

4条回答
  •  感情败类
    2021-02-14 04:15

    This article gives you an interesting note on how Facebook (tries to) maintain cache consistency : http://www.25hoursaday.com/weblog/2008/08/21/HowFacebookKeepsMemcachedConsistentAcrossGeoDistributedDataCenters.aspx

    Here's a gist from the article.

    1. I update my first name from "Jason" to "Monkey"
    2. We write "Monkey" in to the master database in California and delete my first name from memcache in California but not Virginia
    3. Someone goes to my profile in Virginia
    4. We find my first name in memcache and return "Jason"
    5. Replication catches up and we update the slave database with my first name as "Monkey." We also delete my first name from Virginia memcache because that cache object showed up in the replication stream
    6. Someone else goes to my profile in Virginia
    7. We don't find my first name in memcache so we read from the slave and get "Monkey"

提交回复
热议问题