Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 361713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:10:31+00:00 2026-05-12T13:10:31+00:00

We’re building a web app on top of the Amazon Web Services stack, and

  • 0

We’re building a web app on top of the Amazon Web Services stack, and I’m loving it so far.

We’re also making full use of test driven development and that is also proving to be fantastic.

I’m just hoping someone can help me out with an issue I’ve come across which relates to Amazon SimpleDB’s “eventual consistency”.

The best example of the issue arising is in a unit test which adds a user and then checks that the user was added successfully by making a call to fetch that newly added user.

I could easily go ahead and just write the tests for that and it could all work fine, but I’m aware of “eventual consistency” and the possibility that when I make the call to fetch the user, the user might not have actually been added yet. Obviously if the fetch user function is called and the user is not in the system, it will return false or failure.

What I’d like to know is what is the best way to handle this? I’ve seen suggestions of making a function which sleeps for 5 seconds between requests and tries 10 times. I’ve also seen solutions with exponential backoff. What is the optimal solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:10:31+00:00Added an answer on May 12, 2026 at 1:10 pm

    I recommend against using the actual SimpleDB service for unit testing your own code. You will be testing your code + the SimpleDB client + the network + SimpleDB itself. What you need is mock SimpleDB client to run unit tests against. This way you are only testing the code that needs to be tested. Test driven development call upon you to not test if the database works in the unit tests for your code.

    If you are testing your own SimpleDB client code you can use a mock SimpleDB service or something like M/DB which is a SimpleDB clone you can run locally.

    But this brings up a larger issue because SimpleDB provides eventual-consistency and not read-your-writes consistency. Your code will absolutely need to be able to deal with the fact that a newly added item will not immediately be returned from a get or a query.

    I have no reason to think that your code can’t handle it. I’m just saying that as a general rule when you run into problems like these with tests, it hints at issues that need to be considered with the code being tested. You may find that you want either a general layer of caching between your app code and SimpleDB or you may want a session cache that can provide read-your-writes consistency.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.