Managing Asychronous Calls

For example, the home page of an e-commerce website lets returning customers
sign in. Part of the benefit for customers who sign in is that, after signing in,
the site then customizes itself to their particular preferences. To make this
happen:

The customer must log in and be validated with their user name and password.

The customer's preferences are requested from a customer database.

The database provides the customer's preferences that are used to customize the site
before
the page loads.

If these tasks execute synchronously, then each must finish before the next
can start. The web page would be unable to finish loading until the customer
preferences return from the database. However, after the database query is sent to
the server, receipt of the customer data can be delayed or even fail due to network
bottlenecks, exceptionally high database traffic, or a poor mobile device
connection.

To keep the website from freezing under those conditions, call the database
asychronously. After the database call executes, sending your asynchronous request,
your code continues to execute as expected. If you don't properly manage the
response of an asynchronous call, your code can attempt to use information it
expects back from the database when that data isn't available yet.

Javascript is disabled or is unavailable in your browser.

To use the AWS Documentation, Javascript must be enabled. Please refer to your browser's
Help pages for instructions.