Apache vs Nginx Wordpress post update performance optimization on MariaDB 10.6

have been investigating the performance a rather large Wordpress news site - 170k posts, 300k images, 25million rows in wp_postmeta (due to ACFs).

Following optimizations (via indexes, reducing the size of wp_postmeta, use of WP Rocket, using webp instead of jpgs etc) we have managed to make the site on the front end working extremely fast using apache and nginx in Linode via Cloudways. See performance here: https://www.webpagetest.org/result/221013_AiDcPP_B5D/ https://gtmetrix.com/reports/omega.ometadata.com/yx60VK0j/

However, when it comes to the update of the posts, we are experiencing this rather major performance issue: https://vimeo.com/760671429

With Apache/php7.4-fpm on MariaDB 10.6, post update takes 8 seconds With Nginx/php7.4-fpm on MariaDB 10.6, post update takes 3 seconds

Note that even when using apache3handler (instead of php7.4-fpm) the post update time was also 8 seconds but we changed it to fpm for the sake of comparison.

MariaDB 10.6 has been set up with identical configurations - here is the configuration for our test server (16GB):

sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
innodb_adaptive_hash_index=1

max_allowed_packet=16777216

innodb_buffer_pool_size=8G

tmp_table_size=2G

max_heap_table_size=2G

key_buffer_size=2G

max_length_for_sort_data=4096

max_seeks_for_key=18446744073709551615

max_write_lock_count=18446744073709551615

table_definition_cache=2000

table_open_cache=4000

thread_cache_size=9

table_open_cache_instances=16
Any ideas as to to why there is such a disparity in performance during inserts/updates?

6 Replies

Just to clarify:
We are talking about IDENTICAL systems, DB Engines, Settings on DBs etc. What can explain such a performance variation between nginx and Apache? To be even more specific: which parameters in Apache can/may have impact in the performance during insert/updates?

Which apache2 MPM are you using? If it’s mpm-prefork, it’s going to be really slow. Try mpm-event… it’s multithreaded like nginx.

— sw

I am using the one offered by Linode's Wordpress application.
The version is "event".

There’s another multithreaded MPM — mpm-worker. The differences are explained here:

https://www.looklinux.com/apache-mpms-explained/

Also, try tuning mpm-event & mpm-worker:

https://www.liquidweb.com/kb/apache-performance-tuning-mpm-directives/

— sw

Thank you. I have tried these optimizations but, sadly, refer mainly to capacity planning, rather than the "kick" of the server - how it interacts with the database.

So, let me ask you this…

Does one web server communicate with php-fpm (using FCGI) using internet-domain sockets and the other use local-domain (Unix-domain) sockets?

Or, do they both use the same IPC mechanism (either internet- or local-domain sockets).

You should be able to tell this from the FCGI & php-fpm configurations.

Thanks.

— sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct