As mentioned by this tweet, I am interested in accelerating web service.
In this article I have done accelerating PHP which is scripting engine of WordPress.
I performed benchmark before and after.
You can see where it is.

Other improvements are in this article.

What I did
I introduced opcache/apcu.
This is easy to introduce because I run php-fpm on docker-compose.
I picked up corresponding parts of RUN.
FROM php:fpm-buster RUN docker-php-ext-install opcache bcmath && \ pecl install apcu && \ echo "extension=apcu.so" > $PHP_INI_DIR/conf.d/apcu.ini && \ cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
You need to restart or reload php-fpm.
– To reload you can kill -SIGUSR2 <process id of php-fpm>
I confirmed by phpinfo()
opcache is OK.

apcu is also good.

Before vs after
I use this article image which runs on Raspberry Pi 4 as “Before”.
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 improved 5 points, Desktop did 9 points!
Mobile is over 150% better than before!
Conclusion
How was it?
Yes, you can do it!
Are you interested in this kind of topic?
Yes, you can refer Nginx improvement by this article!

Comments