Optimizing Your Facebook Application

After you have your Facebook application developed, your next step is to see what areas of the app can be optimized to speed up overall performance.

Here are several suggestions to consider when looking to speed up your application:

  1. Reduce the total number of server calls that you need to make from your application by using FQL queries over standard Facebook API calls.

  2. When you need to make several API calls at one time, use the batch.run method to combine up to 20 calls into a single request to the Facebook server.

  3. Use FBML canvas pages rather than iframe pages. According to Facebook, FBML pages are faster.

  4. Move JavaScript and CSS code to external files and then import them into your pages. Facebook caches these files the first time they are accessed and stores them indefinitely.

  5. Use the fb:ref element to store FBML content, particularly when you need to publish to multiple profile boxes. Facebook caches fb:ref references, making them quickly accessible on future usage.

  6. Most Facebook applications call friends.get at some point during their operation, consider making this call during your initial app load to minimize server requests.

  7. As in any Web application, keep your canvas pages manageable in length. If you are displaying multiple rows of data, divide your content over a series of pages. Consider, for example, how the Photos app handles this when viewing an album.

  8. Use AJAX when refreshing page content, limiting the page refresh to part of a page rather than the entire page.

There have been no comments | Subscribe to Comments | Jump to Form »

Post Comment on This Article

Your e-mail address won't be published. If you simply add some value to the original post and stay on the topic, your comment will be approved.

You can use Textile parameters on your comments. For example: _italic_ *bold* bq. quated text "link text":URL — Get your own picture next to your comment with a Gravatar account.