Published on

WordPress CMS acceleration and optamization

Authors
  • avatar
    Name
    Predrag TASEVSKI
    Twitter

PURPOSE

The goal of this laboratory test is to evaluate speed-up solution for already mounted clean, by default wordpress CMS platform. The measures were made by custom script for Linux operating system, in our case the server side is Ubuntu server 10.04 LTS running on 32 bit system with 512MB Ram and testing platform Fedora 14 for more details see section appendixes.

The laboratory task is to assist anyone else to be able to perform optimization in easy meaner to their blog, homepage, magazine, etc. without any advantage of technical knowledge.

Presenting stepwise solution with installing firstly wordpress optimization cache plugin, secondary installing PHP solution for increasing the acceleration performance of the server and changing the permalinks settings to the CMS platform for higher optimization. All of the above solutions are free open source, and are taking care of the low budget.

In addition providing measurement results with different scenarios will help us to get wide picture of how affective was optimization.

METHODS

Optimization of the access to wordpress CMS platform is done in behalf of three different scenarios have been proved while performance is getting slightly higher. Test script is measuring the response time of the link provided and it is recording the results in a text file. Which contains the three attends respondent time of the server. For each method we will provide the results in analyses section.

The following steps should be done on the server side.

METHOD 1

Installing procedure [WP-Super-Cache Installation], first method of wordpress plugin: WP Super Cache Version 0.9.9.9

In a terminal please type the following lines:wget -c https://downloads.wordpress.org/plugin/wp-super-cache.0.9.9.9.zipsudo apt-get install unzipunzip wp-super-cache.0.9.9.9.zipmv /home/[user]/wp-super-cache /var/www/wordpress/plugins

In wordpress administration [link](https://192.168.56.102/wordpress/](https://192.168.56.102/wordpress/wp-admin)

wp-admin, log in with the credentials, from the panel select Plugins -) WP-Super-Cache -) Activate. After the activation is done, go to Settings -) WP-Super-Cache, on the first tab activate the cache by selecting the On cache and on the Advance tab select only the “(Recommended)” settings. After your done, select Update Settings and on the bottom of the page you can see a red text that needs to be copy in one of the files that is located on the server. Connect to your server by FTP client and locate the .htaccess file on the wordpress directory and open it and paste the following lines and save the file:

# BEGIN WPSuperCache <IfModule mod_rewrite.c>RewriteEngine On RewriteBase /wordpress/AddDefaultCharset UTF-8RewriteCond %{REQUEST_URI} !^.*[^/]$RewriteCond %{REQUEST_URI} !^.*//.*$ RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{QUERY_STRING} !.*=.*RewriteCond %{https:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$RewriteCond %{https:X-Wap-Profile} !^[a-z0-9\"]+ [NC]RewriteCond %{https:Profile} !^[a-z0-9\"]+ [NC]RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer| Cellphone|Danger|DoCoMo|Elaine/3.0|Eu$ RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird| blac|blaz|brew|cell|cldc|cmd-|dang|doco$ RewriteCond %{https:Accept-Encoding} gzip RewriteCond %{DOCUMENT_ROOT}/wordpress/wp-content/cache/supercache/% {HTTP_HOST}/wordpress/$1/index.html.gz -f RewriteRule ^(.*)"/wordpress/wp-content/cache/supercache/%{HTTP_HOST}/wordpress/ $1/index.html.gz" [L] RewriteCond %{REQUEST_URI} !^.*[^/]$RewriteCond %{REQUEST_URI} !^.*//.*$ RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{QUERY_STRING} !.*=.*RewriteCond %{https:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$RewriteCond %{https:X-Wap-Profile} !^[a-z0-9\"]+ [NC]RewriteCond %{https:Profile} !^[a-z0-9\"]+ [NC]RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer| Cellphone|Danger|DoCoMo|Elaine/3.0|Eu$ RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird| blac|blaz|brew|cell|cldc|cmd-|dang|doco$ RewriteCond %{DOCUMENT_ROOT}/wordpress/wp-content/cache/supercache/% {HTTP_HOST}/wordpress/$1/index.html -f RewriteRule ^(.*) "/wordpress/wp-content/cache/supercache/%{HTTP_HOST}/wordpress/ $1/index.html" [L] </IfModule># END WPSuperCache

METHOD 2

The second approach is to install an PHP accelerator and optimizer [EAccelerator Installing from source]. The main goal is to increases the performance of PHP scripts by caching them in their compiled state. Which will augment the acceleration applied with method 1.

Therefore, please follow the steps to install from source code eAccelerator [2].

sudo apt-get install php-devwget -c https://ignum.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2tar xvfj eaccelerator-0.9.6.1.tar.bz2cd eaccelerator-0.9.6.1phpize./configuremakesudo make installsudo cp /eaccelerator-0.9.6.1 /etc/apache2/php.inisudo mkdir /tmp/eacceleratorsudo chmod 0777 /tmp/eacceleratorsudo /etc/init.d/apache2 restart

After you have completed the above steps it is good way to test the php if the eaccelerator is working and correctly installed. In any case, please create a file called info.php on your wordpress directory with the following code inside:

<?php phpinfo(); )

Access the link to your server vie the link https://192.168.56.102/wordpress/info.php. If you see the configuration information and details of PHP, the quickest way is to search for eaccelerator, and if the result is positive, most lightly you have installed eaccelerator correctly.

METHOD 3

After we have completed the first and second methods it is time to grow the interactiveness of our wordpress project. Therefore, we will change setting to wordpress configuration where will speed-up the performance [Using Permalinks]. If can still add more optimization and acceleration applications, yet this laboratory report is performed only with three easy and maintained steps.

Please log in to the wordpress administration panel, and on Settings -) Permalinks select Default. After the step is done, then we need to edit the .htaccess file and add the following lines at the end of the file and please save it:

# BEGIN WordPressIfModule mod_rewrite.c&gt;RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /wordpress/index.php [L]&lt;/IfModule&gt;# END WordPress</pre)

ANALYSIS

After completing each one of the method we should perform analysis of the system, were it will provide results of performance speed and can compare it if it is utter to improve the effectiveness of wordpress. Please refer to the appendix 3 to get the code of the script.

Meanwhile the below show the results served pages per/second with three sets from the automatically created file from the custom script, named results_lab2.txt.

Set1Set2Set3Avg
wordpress default3.153.73.843.56
WP WP-super-cache + eaccelerator26.4844.3445.6838.83
WP WP-super-cache + eaccelerator148.46173.03132.57151.35
.htaccess default permalink + wp-super-cache + eaccelerator158.571734.11117.03136.57

CONCLUSION

From the analysis above we can see that performance has increased and wordpress project is more affectively respondent to our needs.

Illustrations shows that wordpress as a default setting, clean installed and configure response with 3.15, 3.70 and 3.84 pages/per-second, which is not good enough to satisfaction. Similar to, after installation and configuration of wordpress plugin WP-Super-Cache we that notice that the performance slightly has grown but still the performance doesn’t satisfied higher. However after implying the second method, installing eaccelerator the results drastically increased. From the above illustration we can see that the different methods produce different set results. Thus increasing changes performing different methods vs sets of pages/per-second are specified in the illustration 1.

Finally the results were expected and demonstrating example how we can increase the addictiveness of wordpress performance and increase the respondent time pages view per/second.

However, if we need to get higher effectiveness and response time for wordpress than should consider apply nginx[3] server and third party projects, applications to increase the optimization of wordpress. For instance good tutorial is on following blog [Howto hginx+php].

APPENDIXES

Appendix 1 is for installation process of Ubuntu Server 10.04 LTS and wordpress, mysql installation, other appendix 2 is for virtual machines configuration. The last appendix 4 is the custom script that will help us to perform the analysis of the system.

APPENDIX 1

  • Installation media: Ubuntu 10.04 LTS 32bit iso image;
  • HW: Virtualbox, 1CPU 32bit, 512MB RAM, 8GB HD (dynamic allocation);
  • NIC1 NAT;
  • NIC2 host only (for ssh and http access from host);
  • Language used in installation process: English and country Estonia;
  • Keyboard Layout English;
  • Hostname: pece
  • Partition methods: Guided, use entire disk
  • Username: pece
  • no http proxy
  • Default applications
  • sudo apt-get install lamp phpmyadmin
  • wget -c https://wordpress.org/latest.tar.gz
  • tar xvjf latest.tar.gz
  • sudo cp wordpress /var/www/wordpress
  • sudo nano /var/www/wordpress/wp-config.php
  • Change the settings to your needs

APPENDIX 2

Ubuntu Server 10.04 LTS 32bit – Server

  • Base Memory: 512 MB
  • Acceleration: VT-x/AMD-V, Nested Paging
  • Display – Video memory: 12 MB
  • Storage: SATA Controller, Port 0: 8 GB
  • Network:
    • Adapter 1: Intel PRO/1000 MT Desktop (NAT)
    • Adapter 2: Inter PRO/1000 MT Desktop (Host-only adapter, „VirtualBox Host-Only Enternet Adapter“)

Security Fedora 14 32 bit – Client

  • base Memory: 512 MB

  • Acceleration: VT-x/AMD-V, Nested Paging

  • Display – Video memory: 12 MB

  • Storage: SATA Controller, Port 0: 8 GB

  • Network:

  • Adapter 1: Adapter 1: Parvirtualized Network (NAT)

  • Adapter 2: Adapter 2: Inter PRO/1000 MT Desktop (Host-only adapter,„VirtualBox Host- Only Enternet Adapter“)

APPENDIX 3

File called lab2_test.sh. Content of the file:

[Table not displaying]

Bibliography

WP-Super-Cache Installation: WP, Installation, 2011, link

EAccelerator Installing from source: eAccelerator project, Installation from source code, 2011, link

Using Permalinks: WordPress, Using Permalinks, 2011, link

Howto hginx+php: joneslee85, Howto nginx + php5 + mysql + phpmyadmin + ubuntu shortest setup, 2010, link

Footnotes

[1] WP Super Cache [2] eAccelerator [3] Nginx Inc