Web site performance is an expansive topic. Like just about any aspect of Web development, a career can be made out of becoming knowledgeable on performance. A career can even be made out of becoming a Drupal performance expert (David Strauss is doing just that). I find for single-server sites there are 4 must-dos for performance. These are the biggest bang-for-the-buck performance improving techniques.
For a top-100 site like Facebook or Amazon, performance optimization can yield savings measured in millions of dollars per year. For smaller sites, there is a tipping point where it makes sense to hire a knowledgeable professional in performance. For many projects, however, the costs of high level performance optimization cannot justified. Fortunately, for most sites that run on a single Web server the things that can have the biggest effect on performance are often the easiest to implement.
Use an opcode caching
system like APC
PHP is an interpreted language as opposed to a compiled language. This means that code written in PHP must be translated from PHP to bytecode that a microprocessor can understand each and every time a PHP script runs. A page served from a typical Drupal site will not only require interpreting PHP from Drupal core but also interpreting code from many contributed module There are costs and benefits to interpreted languages. One significant cost is in performance. An opcode caching system like APC stores compiled bytecode in memory which eliminates the overhead compilation. Opcode caching will noticeably speed up performance on even extremely low trafficked sites.
I have found that in practice this reduces time to first byte by about 0.5 seconds to a full second.
Enable and configure mod_deflate
is an Apache module that enables the Web server to gzip compress files before serving them to the Web client.
element in an HTML document must be served before the browser starts rendering the page. Unlike an image within an HTML page, your browser will not begin to draw anything to the screen until all elements in the document head are served. Reduction in filesize of head elements will result in a noticeable performance increase.
Use Drupal performance settings for production sites
In admin/settings/performance you have several performance related settings.
You can have Drupal cache pages and blocks. This can result in a significant reduction in database reads. Drupal stores this cache in cache tables in the Drupal database. The upside to this is that no extra server software or configuration is needed for this performance boost. Any Drupal site can use it regardless of hosting.
Educate sitebuilders, themers and content creators on performance issues
Site builders, themers and content creators need to be aware that files they create and upload will affect performance.
Drupal has an imageapi that can use GD or ImageMagick to automatically reduce image file sizes uploaded by content creators. Photoshop and GIMP have excellent tools optimize images for Web use, allowing creators to use a slider to visually gauge the trade-off between image quality and file size.
Bloggers like to include images in teasers because they know that it has a subtle but positive affect on readership. Knowing that each teaser may have one or more images, sitebuilders need to consider how many posts should display on one page. The more posts, the heavier the page, the lower the performance.
All people involved with creating a Web site, not just developers, need to have a certain awareness of how their work can negatively impact the performance of the site.
There are plenty of other techniques that can be done for single server sites. These include database optimization, resource reduction, use of CSS sprites, use of content delivery networks, code optimization, reverse proxy caching, using a performance-tuned distribution like PressFlow and Web server turning. These techniques aren't as easy to implement and don't have as great of an impact as the techniques discussed above. Several of these options are worth looking into for higher traffick sites.