Apache2 speed up
Posted by admin on July 20 2010 00:20:05
According to Apache’s website, “The mod_deflate module provides the DEFLATE output filter that
allows output from your server to be compressed before being sent to the client over the network.”
Basically, it allows you to automatically compress certain file types before the server sends the
files to the browser (html, css, etc). The browser then decompresses the files once it has received them.
Compress everything except images
General rule of thumb for hardware upgrades: For PHP scripts, the main bottleneck is the CPU.
For static HTML/images, the bottleneck is RAM and the network. According to Compaq benchmarks in 1999
(the original article is lost due to bitrot), a slow 400 Mhz Pentium can saturate a T3 line (that's 45 Mbps) with static HTML pages.
Your PHP scripts are recompiled every time unless the scripts are cached. Install a PHP caching product
(I recommend Turck MMCache) to typically increase performance by 25-100% by removing compile times.
Spread the workload. Run your SQL server on another machine. Serve graphics and HTML from another low-end computer.
If all static content is served from another server, then you can turn off KeepAlives in httpd.conf on the PHP server
to speed up disconnects. 1 Feb 2002: I am currently using tux as the static web server, and have set it to pass all
.php files to Apache which resides on the same machine. 15 March 2002: thttpd is another popular static web server.
Accesses to disk affect performance significantly. Although most modern operating systems keep a cache of the most
frequently accessed files, Apache also enables you to explicitly map a file into memory so that access to disk isn't
necessary. The module that performs this mapping is mod_file_cache. You can specify a list of files to memory map by
using the MMapFile directive, which applies to the server as a whole. An additional directive in Apache 2.0, CacheFile,
takes a list of files, caches the file descriptors at startup, and keeps them around between requests, saving time and
resources for frequently requested files.