WordPress 中文文档

WordPress Optimization/Offloading

From WordPress Chinese

Jump to: navigation, search

This article is part of a series on WordPress Optimization

目录

Static Content

Any static files can be offloaded to another server. For example, any static images, javascript or CSS files can be moved to a different server. This is a common technique in very high performance systems (Google, Flickr, YouTube, etc) but can also be helpful for smaller sites where a single server is struggling. Also, moving this content onto different hostnames can lay the groundwork for multiple servers in the future.

Some web servers are optimized to serve static files and can do so far more efficiently than more complex web servers like Apache, for example publicfile or lighttpd.

Multiple Hostnames

There can also be user improvements by splitting static files between multiple hostnames. Most browser will only make 2 simultaneous requests to a server, so if you page requires 16 files they will be requested 2 at a time. If you spread that between 4 host names they will be requested 8 at a time. This can reduce page loading times for the user, but it can increase server load by creating more simultaneous requests.

Offloading images is the easiest and simplest place to start. All images files could be evenly split between three hostnames (assets1.yoursite.com, assets2.yoursite.com, assets3.yoursite.com for example). As traffic grows, these hostnames could be moved to your own server. Note: Avoid picking a hostname at random as this will affect browser caching and result in more traffic.

Likewise any static javascript and CSS files can be offloaded to separate hostnames or servers.

Feeds

Your feeds can quite easily be offloaded to an external service. Feed tracking services like FeedBurner will do this automatically, the Feedburner servers will handle all the feed traffic and only update the feed from your site every few minutes. This can be a big traffic saver.

Likewise you could offload your own feeds to a separate server (feeds.yoursite.com for example) and then handle your own feed stats / advertising.

Free Hosting Services

It may be possible to host some of your files on external servers for free. For example, popular image hosting web sites like flickr provide image hosting at no cost. Even offloading your most popular images to a free service could significantly reduce the impact on your main server.

However, there is a very important issue to consider when using a free service to offload your images. Since most of the popular services are actually photo sharing sites, copyright becomes a concern. Be sure to read the service disclaimer and decide if it suits you. Moreover, you may not want your images exposed to the users of the photo sharing site.

Consider that free image hosting services are recently becoming a less viable choice since traffic from them is often blocked by corporate networks.

Commercial Services

Amazon S3 is a dedicated static file hosting service on a pay-per-usage basis. With no minimum costs, it might be practical for lower traffic sites which are reaching the peak that a single server can handle.

SteadyOffload offers a convenient and subtle mechanism to offload static content including images, documents and other binary data. Rather than having to upload files, subscribers' static content gets mirrored transparently to the SteadyOffload cache servers. Additional features such as remote image manipulation and thumbnail creation are provided. On a pay-as-you-go model, subscribers only pay for the bandwidth they utilize.

External Resources

用户