Skip navigation

Tag Archives: simpledb

Trying to figure out how to solve the “eventual consistency” problem with Amazon’s SimpleDB.  Putting an attribute in SimpleDB and immediately reading it can bring back old/stale data and might not reflect the attribute we just “put”. Good reading:

A layer of memcached servers can solve the issue. Here’s the strategy to use for the memcache layer:

  1. readers and writers read from memcache first to determine if something in cache
  2. if reader and nothing in cache (becomes a memcache writer) or if writer, lock the item for writing using add() function (wait until successful add)
  3. once you have lock, get or write from db and write to memcache, then remove the lock

This strategy should insure only one writer at a time to memcache.  The memcache data can then be reliably used by writers.

Advertisements