Wednesday, January 13, 2016

Impact of hardware components on MySQL / WordPress performance

Recently, I had problems with a slow running WordPress site on my old Linux machine.
TTFB time was around 10 seconds on average!

On the other computer, the same page has about 1 second TTFB.

So I decided to put MySQL on fire , and test it in 3 different environments.

I used this command to perform tests on 3 systems (all 3 Ubuntu):

Command 1 (preapre mysql test db):

sysbench --test=oltp --oltp-table-size=100 --mysql-user=[user] --mysql-password=[pass] --mysql-db=test1 prepare

Command 2 (run the test)

sysbench --test=oltp --oltp-table-size=100 --mysql-user=[user] --mysql-password=[pass] --mysql-db=test1  --oltp-test-mode=complex --num-threads=16 run


Here are  the results:

Machine #1 (Virtual Machine on a Lenovo i7 with 8GB SSD cache and 4GB RAM):

Avg. request:
17 ms

Total test time:
11.7 seconds



Machine #2 (Host Machine on a Core2Duo 2GB 2GB RAM ):

Avg. request:
99 ms

Total test time:
63 seconds


Machine #3 (Vagrant Virtual Machine on a Core2Duo 2GB 2GB RAM ):

Avg. request:
292 ms

Total test time:
182 seconds



It's clearly indicated that hardware is a very important factor in WordPress / MySQL performance.


Edit:
Upon transferring Vagrant to i7 machine, results improved, but not that much as expected. In case of the WP, theme seems to be the bottle neck for performance.

What provided a significant improvement on my i7  was replacing Vagran'ts php-fpm with HHVM.
It could be that nginx / php-fpm combination is poorly configured in the default vagrant box?

Also, adding more CPUs and memory to Vagrant box helps.

UPDATE:
For Vagrant performance, and associated nginx performance, the disk access speed is crucial. In case of non-NFS Shared Folders , site load speed is reduced 10x times!! NFS makes it fly!

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...