This site runs best with JavaScript enabled.

Optimized wordpress website for 1GB memory server

Optimized wordpress website for 1GB memory server

Adjusting PHP-FPM for Performance + Low Memory

PHP-FPM has as a default configuration that uses more memory than necessary. It has spare php-fpm processes ready to go, taking up memory in case there is PHP code to process. While not a problem if you have tons of RAM, it can be an issue for low RAM VPS and if you are using aggressive page caching then it is memory being used unnecessarily that could be used by MariaDB MySQL or other critical processes. I always use nginx with PHP-FPM running PHP 7.0 (or the latest version) so this tutorial explains how to tweak the configuration to use as little RAM as possible.

1sudo vim /etc/php/7.4/fpm/pool.d/www.conf

Change pm = dynamic to pm = ondemand

Comment pm.start_servers, pm.min_spare_servers and pm.max_spare_servers

Then comment out for pm.process_idle_timeout and pm.max_requests

Adjusting Mysql and MariaDB

4key_buffer_size = 32K
5max_allowed_packet = 4M
6table_open_cache = 8
7sort_buffer_size = 128K
8read_buffer_size = 512K
9read_rnd_buffer_size = 512K
10net_buffer_length = 4K
11thread_stack = 480K

Discuss on TwitterEdit post on GitHub

Share article
Kent C. Dodds

Kent C. Dodds is a JavaScript software engineer and teacher. He's taught hundreds of thousands of people how to make the world a better place with quality software development tools and practices. He lives with his wife and four kids in Utah.