Need help optimizing MariaDB (and possibly Nginx/Php-fpm) for very busy WordPress site

December 13, 2018 3.1k views
Nginx MariaDB Ubuntu WordPress

Hello!
I have a very busy WordPress site (3M pageviews/month) currently running elsewhere that I’m in the process of moving over to Digital Ocean. I have two 32GB standard droplets set up, one running MariaDB and one running Nginx and Php7-fpm. It’s all working but it’s slow - the page load time is almost twice the old servers and I’m not sure exactly what I’ve got wrong in the config, or if it’s something else I’m missing. It would appear from new relic that it’s the database that’s slowing it down. The servers themselves seem like they’re not using much resources - memory and cpu usage is low.

Here’s my MariaDB config:

[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
skip-name-resolve=1
performance_schema=ON
bind-address            = 0.0.0.0

key_buffer_size         = 64M
max_connections         = 1500
connect_timeout         = 5
wait_timeout            = 600
max_allowed_packet      = 16M
thread_cache_size       = 50
sort_buffer_size        = 4M
bulk_insert_buffer_size = 16M
tmp_table_size          = 64M
max_heap_table_size     = 64M

query_cache_type        = 0
query_cache_size        = 0

log_error = /var/log/mysql/error.log
slow_query_log_file     = /var/log/mysql/mariadb-slow.log
long_query_time = 10
log_slow_rate_limit     = 1000
expire_logs_days        = 10
max_binlog_size   = 100M


default_storage_engine          = InnoDB
innodb_buffer_pool_size         = 26G
innodb_buffer_pool_instances    = 24
innodb_file_per_table           = 1
innodb_log_file_size            = 512M
innodb_log_files_in_group       = 2
innodb_log_buffer_size  = 256M

character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

Any ideas welcome. Thank you!

2 comments
  • what was previous server hardware specs ? DigitalOcean standard droplets use slower clocked cpus than their high cpu optimised droplets. So there’s always a chance that your previous server had faster clocked/better cpus than what you’re currently uisng on DigitalOcean droplets

    Also are server’s geographic location the same as previous server - as distance matters if you testing response time from your location and DO droplet is farther away from your than previous server.

  • @eva2000 The previous database server’s hardware was set up back in Jan 2013, and is a 2 x Intel Xeon E5620 2.40 GHz quad-core 8 threads, 24 GB ram, and 250 GB SATA drive. It would appear that the CPU used on the standard droplet is more than twice the speed of the one set up on the old server.

    The webserver is a little newer, set up in July of 2015, and is a 2 x Intel Xeon E5-2630 2.3Ghz 6-core 12 threads, 32 GB ram, 480 GB SATA SSD. So digital ocean’s standard droplet CPU is maybe 40% faster than this one.

    Both servers were dedicated to running this site, and were not running anything else.

1 Answer

I would use something like CemtminMod. It will do most of the work for you.

Have another answer? Share your knowledge.