If your site needs to wait for responses from multiple external resources, and those requests are not dependent on each other, initiate those requests in one go and wait for all responses in parallel instead of one after the other. If you need information from three web services, each taking five seconds to respond, you'll now wait for five seconds only, instead of 3*5=15 seconds.
You can easily implement this using asynchronous code, as discussed in Chapter 6, Thread Usage in the Asynchronous web service access section, the Asynchronous version subsection. When you register each asynchronous task, pass
true in the
executeInParallel parameter of the
PageAsyncTask constructor, as shown in the following code:
bool executeInParallel ...