Performace improvement of WordPress by running on M.2 SSD

Raspberry Pi



This post will be the last of improvement?

I switched to use M.2 SSD for boost up Raspbian of course including WordPress.

There is about 5 times faster than USB-HDD!
– According to output by hdparm



This article summarizes how to accelerate WordPress.

What I did

I summarized what I changed.

Before
 - Boots Raspbian from microSD
 - WordPress contents are on USB HDD
 - USB HDD is connected by USB 3.0
After
 - Boots Raspbian from M.2 SSD
 - WordPress contents are on M.2 SSD

 

Of course raspberry Pi doesn’t have M.2 connector so I bought.

You may know this product.
 Argon ONE M.2 Case for Raspberry Pi 4

Here I assembled.



This case has M.2 slot so I can connect M.2 SSD.
– Only SATA protocol supported, PCI-Express cannot!



I bought this SSD.
Western Digital 1TB WD Red SA500 NAS 3D NAND Internal SSD

- TDW value is higher than Blue because this Red edition is for NAS.
- Not very expensive.
- SATA procotol

 

I also run Nextcloud so I selected 1TB model.
– 2TB is much expensive…

Assembly

Let’s do it.
Box isn’t special.



Case is in vinyl bag.



User’s manual is good!
– With picture



They are parts.



This is what I connected M.2 SSD to this case.



You can find air flow is absorbing from Raspberry Pi to outside.
– Can you see arrow on cooling fan?



This case has fan controller.
You can customize how it works.

#MenuSpec
1Always onAlways 100%
2Adjust to temperatures (55C, 60C, and 65C)~55℃: 10%
~60℃: 50%
~65℃: 100%
3Customize behaviorYou can input pairs of (temp, fan speed)
sudo argonone-config
[sudo] password for yasu: 
--------------------------------------
Argon One Fan Speed Configuration Tool
--------------------------------------
WARNING: This will remove existing configuration.
Press Y to continue:Y
Thank you.

Select fan mode:
  1. Always on
  2. Adjust to temperatures (55C, 60C, and 65C)
  3. Customize behavior
  4. Cancel
NOTE: You can also edit /etc/argononed.conf directly
Enter Number (1-4):        



I use 2.
10% is very quiet so I canot hear unless I am next to this case.
– When I set 100% then it is noisy.

Installing OS

M.2 SSD was recognized as /dev/sda

So I could reflash by dd command.

# Download 64bit OS
wget http://ftp.jaist.ac.jp/pub/raspberrypi/raspios_lite_arm64/images/raspios_lite_arm64-2021-05-28/2021-05-07-raspios-buster-arm64-lite.zip
unzip 2021-05-07-raspios-buster-arm64-lite.zip

# Flash to M.2 SSD
sudo dd if=2021-05-07-raspios-buster-arm64-lite.img of=/dev/sda


Usually we create empty file “ssh” and Wi-Fi configuration file “wpa_supplicant.conf but they didn’t work.
Is the root cause 64bit edition which is beta stage yet?

So I connected HDMI cable with Raspberry Pi and monitor, logging in by USB keyboard.
And activated SSH by below command sets.

sudo service ssh start
sudo systemctl enable ssh

After that I logged in by SSH and worked as usual.

When I logged in I saw this msg which indicates Wi-Fi contry code should be configured. 

Wi-Fi is currently blocked by rfkill.
Use raspi-config to set the country before use.

 

As requested I did sudo raspi-config.

 Choose Localisation Options.

Choose WLAN Country.

Choose your country.
After rebooting wlan0 is active.

Default value is DHCP so you need to edit /etc/dhcpcd.conf to assign fixed IP address.

You can find how to edit. 



Copying data

We need to copy all data of WordPress/Nextcloud from USB HDD to M.2 SSD.

Firstly I connected USB HDD and tried copying by cp command.
But cp command failed.
The disk in HDD sounds stopping rotating…
Current from Raspberry Pi to HDD is not enough?

So I connected USB HDD to another laptop(Lubuntu) and copied by SFTP.
It took overnight to copy 80 GB!

Before vs after



I measured with below condition.

- Using LightHouse in Developers Tools of Chrome browser.
  Checking Performance only
- Taking median as representative(n = 5).
- Measuring on secret tab of Chrome.


Before
<—Mobile Desktop—>



After
<—Mobile Desktop—>

Mobile doesn’t change, Desktop is 1 point upper.
Thay don’t seem to be big performance.

I measured disk read speed. 

HDD

sudo hdparm -t /dev/sdb2

/dev/sdb2:
 Timing buffered disk reads: 162 MB in  3.02 seconds =  53.65 MB/sec

SSD

sudo hdparm -t /dev/sda2

/dev/sda2:
 Timing buffered disk reads: 782 MB in  3.04 seconds = 256.97 MB/sec



About 5 times faster.

So I would guess rendering in client side should be done to improve LightHouse score.

Conclusion

How was it?

I am not fully convinced to LightHouse score…

But hdparm is as expected!

Comments

Copied title and URL