Sample Header Ad - 728x90

How to optimize MariaDB for large WordPress/WooCommerce site?

1 vote
0 answers
499 views
I have moderate experience in working with WordPress and WooCommerce sites but I'm now for the first time working on a site which is a bit bigger and I'm facing issues where the MariaDB process gets killed if I open up too many tabs too quickly for example browsing the admin side or sometimes it crashes when people are browsing the public site. I have done a temporary "fix" for keeping the site going with a cron job that runs every minute and it checks if MariaDB is running and restarts it if it's not. That seems to work but it still would be better to diagnose and fix the actual issue. My server is Ubuntu 22.04 with 4 cpu cores and 8GB of RAM I'm using Plesk Obsidian 18.0.60 to host my WordPress sites on the server. There's a couple other sites which barely get any traffic and then there is this one WooCommerce site which gets 95% of the traffic on the server. The RAM usage is around 2GB average constantly so there's plenty of room to use. I'm just not sure how to optimize the MariaDB settings for this large site. **kern.log** has this:
Apr 23 23:29:18 srv02 kernel: [561268.061478] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=init.scope,mems_allowed=0,global_oom,task_memcg=/system.slice/mariadb.service,task=mariadbd,pid=612094,uid=114
Apr 23 23:29:18 srv02 kernel: [561268.061534] Out of memory: Killed process 612094 (mariadbd) total-vm:2539808kB, anon-rss:703116kB, file-rss:0kB, shmem-rss:0kB, UID:114 pgtables:1692kB oom_score_adj:0
Not sure which variables I should list so here's all of them.
alter_algorithm DEFAULT
analyze_sample_percentage       100.000000
aria_block_size 8192
aria_checkpoint_interval        30
aria_checkpoint_log_activity    1048576
aria_encrypt_tables     OFF
aria_force_start_after_recovery_failures        0
aria_group_commit       none
aria_group_commit_interval      0
aria_log_dir_path       /var/lib/mysql/
aria_log_file_size      1073741824
aria_log_purge_type     immediate
aria_max_sort_file_size 9223372036853727232
aria_page_checksum      ON
aria_pagecache_age_threshold    300
aria_pagecache_buffer_size      134217728
aria_pagecache_division_limit   100
aria_pagecache_file_hash_size   512
aria_recover_options    BACKUP,QUICK
aria_repair_threads     1
aria_sort_buffer_size   268434432
aria_stats_method       nulls_unequal
aria_sync_log_dir       NEWFILE
aria_used_for_temp_tables       ON
auto_increment_increment        1
auto_increment_offset   1
autocommit      ON
automatic_sp_privileges ON
back_log        80
basedir /usr
big_tables      OFF
bind_address    127.0.0.1
binlog_annotate_row_events      ON
binlog_cache_size       32768
binlog_checksum CRC32
binlog_commit_wait_count        0
binlog_commit_wait_usec 100000
binlog_direct_non_transactional_updates OFF
binlog_expire_logs_seconds      864000
binlog_file_cache_size  16384
binlog_format   MIXED
binlog_optimize_thread_scheduling       ON
binlog_row_image        FULL
binlog_row_metadata     NO_LOG
binlog_stmt_cache_size  32768
bulk_insert_buffer_size 8388608
character_set_client    utf8mb3
character_set_connection        utf8mb3
character_set_database  utf8mb4
character_set_filesystem        binary
character_set_results   utf8mb3
character_set_server    utf8mb4
character_set_system    utf8mb3
character_sets_dir      /usr/share/mysql/charsets/
check_constraint_checks ON
collation_connection    utf8mb3_general_ci
collation_database      utf8mb4_general_ci
collation_server        utf8mb4_general_ci
column_compression_threshold    100
column_compression_zlib_level   6
column_compression_zlib_strategy        DEFAULT_STRATEGY
column_compression_zlib_wrap    OFF
completion_type NO_CHAIN
concurrent_insert       AUTO
connect_timeout 10
core_file       OFF
datadir /var/lib/mysql/
date_format     %Y-%m-%d
datetime_format %Y-%m-%d %H:%i:%s
deadlock_search_depth_long      15
deadlock_search_depth_short     4
deadlock_timeout_long   50000000
deadlock_timeout_short  10000
debug_no_thread_alarm   OFF
default_master_connection
default_password_lifetime       0
default_regex_flags
default_storage_engine  InnoDB
default_tmp_storage_engine
default_week_format     0
delay_key_write ON
delayed_insert_limit    100
delayed_insert_timeout  300
delayed_queue_size      1000
disconnect_on_expired_password  OFF
div_precision_increment 4
encrypt_binlog  OFF
encrypt_tmp_disk_tables OFF
encrypt_tmp_files       OFF
enforce_storage_engine
eq_range_index_dive_limit       200
error_count     0
event_scheduler OFF
expensive_subquery_limit        100
expire_logs_days        10.000000
explicit_defaults_for_timestamp OFF
external_user
extra_max_connections   1
extra_port      0
flush   OFF
flush_time      0
foreign_key_checks      ON
ft_boolean_syntax       + ->
optimizer_trace enabled=off
optimizer_trace_max_mem_size    1048576
optimizer_use_condition_selectivity     4
performance_schema      OFF
performance_schema_accounts_size        -1
performance_schema_digests_size -1
performance_schema_events_stages_history_long_size      -1
performance_schema_events_stages_history_size   -1
performance_schema_events_statements_history_long_size  -1
performance_schema_events_statements_history_size       -1
performance_schema_events_transactions_history_long_size        -1
performance_schema_events_transactions_history_size     -1
performance_schema_events_waits_history_long_size       -1
performance_schema_events_waits_history_size    -1
performance_schema_hosts_size   -1
performance_schema_max_cond_classes     90
performance_schema_max_cond_instances   -1
performance_schema_max_digest_length    1024
performance_schema_max_file_classes     80
performance_schema_max_file_handles     32768
performance_schema_max_file_instances   -1
performance_schema_max_index_stat       -1
performance_schema_max_memory_classes   320
performance_schema_max_metadata_locks   -1
performance_schema_max_mutex_classes    210
performance_schema_max_mutex_instances  -1
performance_schema_max_prepared_statements_instances    -1
performance_schema_max_program_instances        -1
performance_schema_max_rwlock_classes   50
performance_schema_max_rwlock_instances -1
performance_schema_max_socket_classes   10
performance_schema_max_socket_instances -1
performance_schema_max_sql_text_length  1024
performance_schema_max_stage_classes    160
performance_schema_max_statement_classes        222
performance_schema_max_statement_stack  10
performance_schema_max_table_handles    -1
performance_schema_max_table_instances  -1
performance_schema_max_table_lock_stat  -1
performance_schema_max_thread_classes   50
performance_schema_max_thread_instances -1
performance_schema_session_connect_attrs_size   -1
performance_schema_setup_actors_size    -1
performance_schema_setup_objects_size   -1
performance_schema_users_size   -1
pid_file        /run/mysqld/mysqld.pid
plugin_dir      /usr/lib/mysql/plugin/
plugin_maturity gamma
port    3306
preload_buffer_size     32768
profiling       OFF
profiling_history_size  15
progress_report_time    5
protocol_version        10
proxy_protocol_networks
proxy_user
pseudo_slave_mode       OFF
pseudo_thread_id        26517
query_alloc_block_size  16384
query_cache_limit       1048576
query_cache_min_res_unit        4096
query_cache_size        1048576
query_cache_strip_comments      OFF
query_cache_type        OFF
query_cache_wlock_invalidate    OFF
query_prealloc_size     24576
rand_seed1      979786629
rand_seed2      14782398
range_alloc_block_size  4096
read_binlog_speed_limit 0
read_buffer_size        131072
read_only       OFF
read_rnd_buffer_size    262144
relay_log
relay_log_basename
relay_log_index
relay_log_info_file     relay-log.info
relay_log_purge ON
relay_log_recovery      OFF
relay_log_space_limit   0
replicate_annotate_row_events   ON
replicate_do_db
replicate_do_table
replicate_events_marked_for_skip        REPLICATE
replicate_ignore_db
replicate_ignore_table
replicate_wild_do_table
replicate_wild_ignore_table
report_host
report_password
report_port     3306
report_user
require_secure_transport        OFF
rowid_merge_buff_size   8388608
rpl_semi_sync_master_enabled    OFF
rpl_semi_sync_master_timeout    10000
rpl_semi_sync_master_trace_level        32
rpl_semi_sync_master_wait_no_slave      ON
rpl_semi_sync_master_wait_point AFTER_COMMIT
rpl_semi_sync_slave_delay_master        OFF
rpl_semi_sync_slave_enabled     OFF
rpl_semi_sync_slave_kill_conn_timeout   5
rpl_semi_sync_slave_trace_level 32
secure_auth     ON
secure_file_priv
secure_timestamp        NO
server_id       1
session_track_schema    ON
session_track_state_change      OFF
session_track_system_variables  autocommit,character_set_client,character_set_connection,character_set_results,time_zone
session_track_transaction_info  OFF
skip_external_locking   ON
skip_name_resolve       OFF
skip_networking OFF
skip_parallel_replication       OFF
skip_replication        OFF
skip_show_database      OFF
slave_compressed_protocol       OFF
slave_ddl_exec_mode     IDEMPOTENT
slave_domain_parallel_threads   0
slave_exec_mode STRICT
slave_load_tmpdir       /tmp
slave_max_allowed_packet        1073741824
slave_net_timeout       60
slave_parallel_max_queued       131072
slave_parallel_mode     optimistic
slave_parallel_threads  0
slave_parallel_workers  0
slave_run_triggers_for_rbr      NO
slave_skip_errors       OFF
slave_sql_verify_checksum       ON
slave_transaction_retries       10
slave_transaction_retry_errors  1158,1159,1160,1161,1205,1213,1429,2013,12701
slave_transaction_retry_interval        0
slave_type_conversions
slow_launch_time        2
slow_query_log  OFF
slow_query_log_file     srv02-slow.log
socket  /run/mysqld/mysqld.sock
sort_buffer_size        2097152
sql_auto_is_null        OFF
sql_big_selects ON
sql_buffer_result       OFF
sql_if_exists   OFF
sql_log_bin     ON
sql_log_off     OFF
sql_mode        ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_notes       ON
sql_quote_show_create   ON
sql_safe_updates        OFF
sql_select_limit        18446744073709551615
sql_slave_skip_counter  0
sql_warnings    OFF
ssl_ca
ssl_capath
ssl_cert
ssl_cipher
ssl_crl
ssl_crlpath
ssl_key
standard_compliant_cte  ON
storage_engine  InnoDB
stored_program_cache    256
strict_password_validation      ON
sync_binlog     0
sync_frm        ON
sync_master_info        10000
sync_relay_log  10000
sync_relay_log_info     10000
system_time_zone        EEST
system_versioning_alter_history ERROR
system_versioning_asof  DEFAULT
table_definition_cache  400
table_open_cache        2000
table_open_cache_instances      8
tcp_keepalive_interval  0
tcp_keepalive_probes    0
tcp_keepalive_time      0
tcp_nodelay     ON
thread_cache_size       151
thread_handling one-thread-per-connection
thread_pool_dedicated_listener  OFF
thread_pool_exact_stats OFF
thread_pool_idle_timeout        60
thread_pool_max_threads 65536
thread_pool_oversubscribe       3
thread_pool_prio_kickup_timer   1000
thread_pool_priority    auto
thread_pool_size        4
thread_pool_stall_limit 500
thread_stack    299008
time_format     %H:%i:%s
time_zone       SYSTEM
timestamp       1713944384.242827
tls_version     TLSv1.2,TLSv1.3
tmp_disk_table_size     18446744073709551615
tmp_memory_table_size   16777216
tmp_table_size  16777216
tmpdir  /tmp
transaction_alloc_block_size    8192
transaction_prealloc_size       4096
tx_isolation    REPEATABLE-READ
tx_read_only    OFF
unique_checks   ON
updatable_views_with_limit      YES
use_stat_tables PREFERABLY_FOR_QUERIES
userstat        OFF
version 10.6.16-MariaDB-0ubuntu0.22.04.1
version_comment Ubuntu 22.04
version_compile_machine x86_64
version_compile_os      debian-linux-gnu
version_malloc_library  system
version_source_revision
version_ssl_library     OpenSSL 3.0.2 15 Mar 2022
wait_timeout    28800
warning_count   0
wsrep_osu_method        TOI
wsrep_sr_store  table
wsrep_auto_increment_control    ON
wsrep_causal_reads      OFF
wsrep_certification_rules       strict
wsrep_certify_nonpk     ON
wsrep_cluster_address
wsrep_cluster_name      my_wsrep_cluster
wsrep_convert_lock_to_trx       OFF
wsrep_data_home_dir     /var/lib/mysql/
wsrep_dbug_option
wsrep_debug     NONE
wsrep_desync    OFF
wsrep_dirty_reads       OFF
wsrep_drupal_282555_workaround  OFF
wsrep_forced_binlog_format      NONE
wsrep_gtid_domain_id    0
wsrep_gtid_mode OFF
wsrep_gtid_seq_no       0
wsrep_ignore_apply_errors       7
wsrep_load_data_splitting       OFF
wsrep_log_conflicts     OFF
wsrep_max_ws_rows       0
wsrep_max_ws_size       2147483647
wsrep_mode
wsrep_mysql_replication_bundle  0
wsrep_node_address
wsrep_node_incoming_address     AUTO
wsrep_node_name srv02.xxx.xxx
wsrep_notify_cmd
wsrep_on        OFF
wsrep_patch_version     wsrep_26.22
wsrep_provider  none
wsrep_provider_options
wsrep_recover   OFF
wsrep_reject_queries    NONE
wsrep_replicate_myisam  OFF
wsrep_restart_slave     OFF
wsrep_retry_autocommit  1
wsrep_slave_fk_checks   ON
wsrep_slave_uk_checks   OFF
wsrep_slave_threads     1
wsrep_sst_auth
wsrep_sst_donor
wsrep_sst_donor_rejects_queries OFF
wsrep_sst_method        rsync
wsrep_sst_receive_address       AUTO
wsrep_start_position    00000000-0000-0000-0000-000000000000:-1
wsrep_strict_ddl        OFF
wsrep_sync_wait 0
wsrep_trx_fragment_size 0
wsrep_trx_fragment_unit bytes
What would be the first thing to look at for debugging this?
Asked by user1589375 (111 rep)
Apr 24, 2024, 07:55 AM