A First Look at Performance
Throughout this book, especially in the later chapters, we'll look at some performance issues and tweaks associated with Ajax applications. I did want to mention one first, though, and that is HTTP's two-connection limitation that most browsers put on pages pulled from a specific domain.
When you open a web page and download material from the Web, only two parallel connections to the same domain are opened at any one time. This means that if you're downloading images, JavaScript files, and other material embedded into the page, the download will queue based on the number of connections. This becomes a more acute problem when you're using Ajax calls in your script, all of which could be held up waiting on connections to open from processing other calls or downloading other material.
One way to improve performance is to consider offloading some of the incidental material, such as images, to another domain so that you free up connections from the current domain specifically for Ajax calls. The other domain can be on the same server, as the connection limitation built into browsers is based on domain name, not IP address. So you can create CNAME subdomains such as images.sitename.com, js.sitename.com, or database.sitename.com, effectively allowing your browser to create more than two concurrent connections, thus increasing the speed with which the page and the Ajax requests are made.
Warning
Using multiple subdomains to increase the number of parallel HTTP requests ...