The bottleneck here is the memory limit for PHP scripts. Older PHP versions came with a fairly low memory limit of 8 or 16 Megabyte. Edit your php.ini file and look for the following line:
Code: Select all
memory_limit = 8M
Code: Select all
ini_set('memory_limit', '128M');
Code: Select all
php_value memory_limit 128M
Optimising MySQL
Very big potential for speed gains offers MySQL. Since database applications like Magento often use the same SQL queries over and over again, MySQL offers a query cache that is set with the have_query_cache and query_cache_size parameters. The cache is disabled by default, but enabling can result in massive speed improvements. There is already an excellent article at Crucial Web Hosting about the importance of query caching and how to enable it, so I’ll skip the details here and recommend you check it out.
Optimising Apache
Magento offers an option to enable ZIP (Deflate) compression for Apache. You can imagine that a big part of a typical Magento page (as the user can see it) actually consists of text: HTML, CSS and Javascript. Text files offer excellent compression ratios, so it only makes sense to run Apache with compression enabled to reduce the amount of data that needs to be transferred to the user. You can enable it from Magento’s .htaccess file. Look for the following section:
Code: Select all
<IfModule mod_deflate.c>
############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter on all content
###SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems...
#BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
#BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
#BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
#SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
#Header append Vary User-Agent env=!dont-vary
</IfModule>
Code: Select all
<IfModule mod_deflate.c>
############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
Optimising Magento
Last but not least there is potential to improve Magento itself, by enabling the built-in caches. Under System > Cache Management you should make sure that all caches are enabled. Usually caches should be disabled completely during development, but on a production server it is essential to enable all of them. Server load would otherwise increase significantly.