Codex tools: Log in
Before using WordPress for a high-traffic site, you need to make sure the site is ready for the expected amount of traffic. WordPress is certainly capable of managing large amounts of traffic, but there are limitations on what any website platform can do by itself. When you make changes to your web hosting/server, caching system, or file sizes, you must ensure your site will not crash after receiving 1000 hits.
See also WordPress Optimization
Like any other web application, WordPress is only able to handle as much traffic as can be supported by the hardware which runs it.
Two physical barriers can prevent your site from functioning under a high volume of traffic:
You will need to contend with the demands of high traffic on your server's internal resources. Ensure the general demand on your server is met by sufficient processor power and memory resources.
There may be more dependencies than these for publishing your WordPress site, however these are the default requirements for WordPress.
As with many blogging and web applications, WordPress depends on MySQL to store data for producing output. Every request WordPress makes to MySQL, for reading or writing data, creates a respective load on the server.
WordPress is continuously optimized to reduce the functions required to perform. Issues may arise from the developmental practices in the plugins or theme used with your WordPress installation. Each may also play a role in the amount of MySQL usage. In high-traffic situations, many simultaneous database connections can cause excessive strain on the server. If the connection to the server is not complete, it causes the "Connection timed out" response in the visitor's browser.
MySQL connection rates are often improved by either adjusting settings for MySQL, or providing more memory and processing power to the overworked server. Additionally, usage of query caching and proper indexing will help improve MySQL performance. There is no single solution for every case because all sites are different.
WordPress is a web-server-neutral application, meaning that it can run on many different platforms. Apache and Linux are the most robust platforms for running WordPress, but any server that supports PHP and MySQL will do.
Make sure your host features the most up-to-date and stable version of these platforms to create a strong environment in which to run WordPress.
Choosing the best method to run PHP, the language that interprets the WordPress code, can also affect your server's performance. In CGI mode, the server creates a new instance of the PHP program for every PHP file that a visitor requests. In shared module mode (or ISAPI), a single library instance is used for each PHP request. There are also many misconceptions about the benefits of multi-threaded implementations of Apache 2. Make sure to do your own testing before deploying. In general, prefork performance of Apache 2 with mod_php is the most stable. There are advantages and drawbacks to each method - while choosing the method for your server, be sure to keep in mind traffic and its demands on the server.
Depending on the quality of your server's connection to the Internet, you may not be able to serve as many pages as you want to as fast as you want to serve them.
Your server's network provider (your host or ISP) will usually connect your server to their internal network via an ethernet adapter. Adapters typically operate at certain standard maximum speeds, usually 10Mb/s, 100Mb/s, or 1Gb/s. Your server is physically incapable of transferring files of any kind in excess of this speed. There are additional barriers to your transfer rate that will likely reduce your server's speed even more.
First, it is important to note that many of these numbers (especially the speed of your server's network adapter) are theoretical. In practice, your server will never transfer files at the maximum rate specified by the adapter, because in addition to the actual data being transferred, the server is also sending and receiving routing information of different kinds that the internet requires to get data to your site visitors. Because of this "network overhead", only a fraction of the full bandwidth is available for actually transferring files.
Second, your server is likely connected to various devices in your network provider's facilities that will limit your transfer rates more than the limits on your server's network adapter. These devices are in place because your network provider has to fraction out its limited bandwidth to many servers at its location, and all of the bandwidth must be shared.
Certain network providers allow you to "burst" data -- temporarily exceed a pre-set transfer speed limit -- in special cases when demand for your site content is high. The network provider's hardware is specially designed to know when this is required. Some providers charge extra for this feature, some do not, and others do not offer this feature at all. It's up to you to find out.
To determine why the bandwidth of the connection is important to a high-traffic site, let's look at the math.
Assume your site receives 100,000 hits in a day. For the purpose of this computation, we will say that one "hit" is a single data transfer, whether that is a single file or a whole page and its supporting files. Averaged out, 100,000 hits in a day equates to 1.16 hits every second.
Also assume the average hit generates 160KB of transferred data; HTML, images, CSS, downloaded files, etc. Every second, your site is transferring 190KB of data (160KB/hit * 1.16 hits/s). The total, 190KB/s, equals about 1.5Mb/s of sustained throughput. (Note that KB = Kilobytes and Mb = Megabits. Most network speeds are rated in bits per second, whereas file sizes are measured in bytes.) Many network providers cap the transfer rate of a site to about this level; some higher, some lower. However, only if each user visits in a nice succession will this steady rate be maintained.
Usually, more than one user at a time will access your site. Sometimes during the day, nobody might access your site at all. If 10 people hit the site simultaneously per second, and that hit rate is sustained over a lengthy period -- not uncommon for a high-traffic site -- then you would need a 15Mb/s connection just to keep up with the simultaneous connections.
If your network adapters maximum theoretical speed is only 10Mb/s, your demand has already exceeded your capacity. WordPress has nothing to do with it.
It is not necessary to receive 100,000 hits to cause this problem. Sustaining this rate of connectivity for a mere hour generates only 36,000 hits. If visitors concentrate their access to a certain time of day (or an automated comment spam script attempts to access your system multiple concurrent times while posting comments) then you could be left with many dropped requests.
A 100Mb/s connection could handle up to 70 simultaneous connections at the same rate of download, but it is not likely that your network provider would offer the bandwidth that could fully use this speed without paying a premium. This is generally not something you can get with current shared hosting plans.
If you are hosting large files such as videos, podcasts, or large photo archives is transfer overages. Hosting services often provide a fixed amount of overall transfer with their hosting plans. A plan may include only so many MB of transferred data. After your account has reached that amount, you will be charged for any extra data that is transferred. Depending on the host, this could be as much as $1/MB.
At that rate, a single download of a 20MB file after you've reached your limit could cost you $20 extra on your hosting bill!
Usually, the higher the transfer limit, the more costly your hosting plan will be. Some hosting services offer plans with no transfer limitations, which can be quite costly, but certainly less costly than paying for transfer overages on a high-traffic site.
A popular method to maximize the performance of your web site and avoid overages is to use a Content Delivery Network (CDN) with your site. There are may affordable pay-as-you go solutions that help you avoid expensive overages and the bandwidth limitations of some hosting providers. Learn more about CDNs and offloading here.
Like Kobe beef, WordPress will only be at its best when raised in the proper conditions. Here are a few things to try if you find that your WordPress site is not performing as well as it could due to high traffic issues.
W3 Total Cache (W3TC) is the latest generation in WordPress performance plugins, which combines the research of web development authorities to provide an optimal user experience for WordPress sites. W3TC is unique in its ability to optimize server side and client side performance, adding functionality otherwise not natively available:
For one or more servers, no matter if shared or dedicated hosting, W3TC provides the options to fully optimize WordPress. Upon activation it starts working with safe default settings.
WP Super Cache is a (static) page caching plugin for WordPress. It generates html files that are served directly by Apache without processing comparatively heavy PHP scripts. By using this plugin you will speed up your WordPress blog significantly.
This plugin is a fork of the excellent WP Cache by Ricardo Galli Granada. WP Cache caches the pages of your WordPress blog and delivers them without accessing the database. Unfortunately it still requires loading the PHP engine to serve the cached files, so use of WP Cache is no longer recommended.
WP Super Cache gets around that. When it is installed, html files are generated and are served without ever invoking a single line of PHP. How fast can your site serve graphic files? That's how fast it will be able to serve these cached .html files. If your site is struggling to cope with the daily number of visitors, or if your site appears on Digg.com, Slashdot.org or any other popular site, then this plugin is for you.
When the traffic increases on your WordPress blog, all aspects of your blog's code and design elements also increase.
For example, let's say the front page of your blog calls upon 8 graphics to create the "look" of your blog's design. Add to this number the various WordPress template files it takes to build your page. You've got the header, sidebar, footer, and post content area at a minimum. That's four more "calls" to files on your site. For 100 visitors, those files get loaded 1200 times. For 1000 visitors, those files are accessed and loaded 12000 times. This increases your bandwidth and server activity.
WordPress Plugins are also files that are "called" by your WordPress Theme. In turn, these make queries to your database to generate the information on your blog. The more WordPress Plugins, the more queries to your database. Combine all these access files and database queries with an exponential increase in visitors, and you have a lot of demand on your site.
You can lower the number of files accessed and the queries to your database during heavy traffic times by:
Keep the access to files and your database to a minimum as much as possible. After the heavy traffic volume has died down a bit, then you can reactivate and restore these features.
As painful as it may be to hear it, you might simply require a more powerful server.
Here is a simple outline of upgrade steps for a site that is having high-traffic problems. If you are having trouble with:
In all cases, your server is only as capable as your network provider. If your provider does not provide the bandwidth you require, you may need to negotiate an increase with them, or find a different provider that can provide you with the bandwidth that your traffic requires.