30.06.2016 Views

Magento Site Performance Optimization

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2<br />

Configuration tweaks<br />

In the following subsection, we will tweak the Apache configuration in order to<br />

improve its performance. We will see the mod_deflate and keepAlive modules and<br />

set the maximum number of processes that Apache can create.<br />

Using mod_deflate<br />

Apache2 can be configured via the .htaccess files. The .htaccess files are the files<br />

that can configure web servers at the directory level. As such, you can tweak your<br />

configuration depending on the web application you host in each directory. <strong>Magento</strong><br />

does embed a .htaccess file that contains a commented optimization. The first thing<br />

we will do is to uncomment everything between and<br />

. The complete piece of code looks like the following:<br />

<br />

AddOutputFilterByType DEFLATE text/html text/plain text/xml<br />

text/css text/javascript<br />

BrowserMatch ^Mozilla/4 gzip-only-text/html<br />

BrowserMatch ^Mozilla/4.0[678] no-gzip<br />

BrowserMatch bMSIE !no-gzip !gzip-only-text/html SetEnvIfNoCase<br />

Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary Header append<br />

Vary User-Agent env=!dont-vary<br />

<br />

Then, you can activate the deflate mode by typing the following command:<br />

sudo a2enmod deflate<br />

Finally, you can restart Apache2 in order to load the new configuration:<br />

sudo /etc/init.d/apache2 restart<br />

Let's find out if this simple tweak improves our performances. The following is the<br />

result of the test after using mod_deflate:<br />

Document Path:<br />

Document Length:<br />

/magento/index.php/furniture/living-room.html<br />

36634 bytes<br />

Concurrency Level: 5<br />

Time taken for tests: 49.228 seconds<br />

Complete requests: 100<br />

Failed requests: 0<br />

Write errors: 0<br />

[ 21 ]<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!