Make Fewer and Smaller HTTP Requests

Making fewer HTTP requests that return less content is the single most effective technique for improving front-end performance. Each HTTP request usually takes at least 10 milliseconds to send and additional time to return the page. Reducing the number of HTTP requests you make is often one of the most effective ways to improve site performance.

Reduce the Size and Number of Cookies

Cookies are always sent with each request for the same host/domain, so reduce the size and amount of cookies to make requests quicker.

Reduce the Number of Images

If you have many small icons, make it one image or use CSS sprites. This is only one HTTP request. Header information, corners, button or background images can be transferred using one or two CSS sprites. The exception to this is extremely large images, which might take more time to transfer.

This improves performance because instead of sending 10 requests for 1 KB each, you might send one request for 10KB. In the first case, the minimum amount of time to load the page is 100 ms and the second, the minimum amount of time to load the page is 10 ms. Also, using compression (gif, jpg), the single file compressed might be smaller than 10 files compressed, further saving loading time.

Consider Hidden Requests Carefully

Be aware of hidden requests, such as using @import statements in CSS files. The @import statement is a client-side statement, so each import adds another request to the request for the main file.

You can generate additional requests through calls to JavaScript. For example, if you include Omniture or Google Analytics, the first call goes out to the server as a request to get the JavaScript, the browser processes the JavaScript makes another request to the server to transfer the information. If you include two analytics engines, you actually have to make four calls. Temporary redirects are not cached, so the request is always issued. Redirects are always an additional HTTP request

Using GET vs. POST Requests

For GET requests, all parameters are passed in the URL. For POST requests, everything is in the header information. GET requests can be cached very easily, because it's assumed that the request doesn't change the server state. POST is never cached, because it changes the state on the server.

For Salesforce B2C Commerce, only GET can be placed in the page cache. POST requests are never cached and are therefore slower than other requests. POST is useful for specific operations, such as login or interacting with the shopping cart. Most requests, however, should use a GET request. For AJAX components, POST requests are also not cached.

Iframes

Salesforce recommends that you generally avoid Iframes if possible. Iframes block the browser onload event and they always have performance cost even if they are empty. This is because each Iframe is a separate HTTP request, which might not be cached. However, Iframes are useful for decoupling the page impression from external services.

Expires and Conditional Headers

Expires and conditional headers are currently not supported in B2C Commerce.

Related Links

Tools for Improving Site Performance

Techniques for Improving Site Performance

Testing Site Performance

Optimizing First Pages

Optimizing General Site Pages

Reduce and Reuse Scripts

Reduce URL and Page Size

404 Errors and 404 Pages

Performance and Stability Coding Standards