[1] Secrets of PHP+MySQL Tuning With Ultrafast WordPress Virtual Machine KUSANAGI

Launch a LAMP Environment and Bench Mark

We will prepare a CentOS 7 standard LAMP environment and perform a benchmark test. Use the same instance and region as the KUSANAGI environment. For the virtual image, select CentOS- based 7.2. Launching a virtual machine follows the same steps regardless of the image you select. If you are using the search feature, look for "centos" to find CentOS-based 7.2.

Selecting CentOS-based 7.2

Once you launch the machine, you need to make port 80 accessible, so make an inbound security rule. On the Portal choose "Resource groups" in the left menu, then "Recent", "Network security group", "Inbound security rules", "Add". Enter "http" for the name, change the protocol to TCP, the port to 80, and click OK.

"Network security groups" screen
"Inbound security rules" screen

Once you have added your security rule, you can access your virtual machine via SSH and enable Apache 2.4 and MySQL (MariaDB 5.5). Since we are only performing a test, we will do the bare minimum to set up our LAMP environment.

[azureuser@CodeZine-CentOS ~]$ sudo su -
[root@CodeZine-CentOS ~]# yum update -y
[root@CodeZine-CentOS ~]# yum install httpd php php-mysqlnd php-gd php-xml php-xmlrpc php-mbstring php-mcrypt mariadb-server wget unzip -y
[root@CodeZine-CentOS ~]# setenforce 0
[root@CodeZine-CentOS ~]# systemctl start httpd
[root@CodeZine-CentOS ~]# systemctl start mariadb

Next, enter the command "mysql_secure_installation" to initialize MariaDB. Generally all you need to do is keep hitting Enter. When it prompts for a password for the root user, please enter a password of your choice.

[root@CodeZine-CentOS ~]# mysql_secure_installation

You are connected to the database when "Thanks for using MariaDB!" appears.

[root@CodeZine-CentOS ~]# mysql -uroot -p

Once you have set the password for the root user and logged in, we will create a database and database user. Enter "wordpress" for the database, "localhost" for the host name, "wpuser" for the database user, and "wppass" for the password.

MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> grant all privileges on wordpress.* to wpuser@localhost identified by 'wppass';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

Finally, download and unzip WordPress.

[root@CodeZine-CentOS ~]# cd /var/www/
[root@CodeZine-CentOS www]# wget https://ja.wordpress.org/wordpress-4.4.2-ja.zip
[root@CodeZine-CentOS www]# unzip wordpress-4.4.2-ja.zip
[root@CodeZine-CentOS www]# cp -rp wordpress/* html/
[root@CodeZine-CentOS www]# chmod 0777 html html/wp-content

If you access your host in a browser, the WordPress installation should begin, so follow the wizard. Once it is completed, display the front page of WordPress. Now we will check the page load time. In our environment it was 168ms.

Check the page load time with Firebug

Return to the console and benchmark using the ab command.

[root@CodeZine-CentOS www]# ab -n 100 -c 10 http://localhost/

In our environment, requests per second was 6.17.