• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

my.cnf guidance, Xenforo locking up

#1
Hello, I just imported from VB4 to Xenforo the import process went smoothly but I'm noticing lag issues ATM.

After about a few hours going live, the server would lock up, and would only work again after restarting mysql. I'm guessing I need to optimize mysql now but I don't have much experience in this area, hope someone here could help get me started.

Hopefully the below is enough info to provide some guidance. Thanks!

200-500 users online on average

Server Specs
Dedicated Server
Quad Core - Intel Xeon E3 1230v3
16 GB DDR3 RAM
250GB HDD x2 Raid 1

my.cnf
[mysqld]
innodb_file_per_table=1
max_allowed_packet=268435456
max_connections=500
thread_cache_size=50
key_buffer_size=512M
tuner-primer.sh results
Code:
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.5.37-cll x86_64

Uptime = 0 days 1 hrs 59 min 16 sec
Avg. qps = 44
Total Questions = 317764
Threads Connected = 108

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 533 out of 317785 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 50
Current threads_cached = 0
Current threads_per_sec = 1
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 500
Current threads_connected = 110
Historic max_used_connections = 131
The number of used connections is 26% of the configured maximum.
Your max_connections variable seems to be fine.

INNODB STATUS
Current InnoDB index space = 224 M
Current InnoDB data space = 937 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 128 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 1.11 G
Configured Max Per-thread Buffers : 1.34 G
Configured Max Global Buffers : 656 M
Configured Max Memory Limit : 1.98 G
Physical Memory : 15.53 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 77 M
Current key_buffer_size = 512 M
Key cache miss rate is 1 : 1918
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is supported but not enabled
Perhaps you should set the query_cache_size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 1422 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 2500 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 400 tables
Current table_definition_cache = 400 tables
You have a total of 788 tables
You have 400 open tables.
Current table_cache hit rate is 0%
, while 100% of your table cache is in use
You should probably increase your table_cache
You should probably increase your table_definition_cache value.

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 22815 temp tables, 31% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 385 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 1130
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=ALWAYS'.
mysqltuner results
Code:
 >>  MySQLTuner 1.4.4 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.5.37-cll
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 174M (Tables: 326)
[--] Data in InnoDB tables: 938M (Tables: 413)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 621K (Tables: 7)
[!!] Total fragmented tables: 95
ERROR 1102 (42000) at line 1: Incorrect database name '#mysql50# WHMSonic v2.1.13 Testing-ECHO http:'

-------- Security Recommendations  -------------------------------------------
[OK] There is no anonymous account in all database users
[OK] All database users have passwords assigned
[!!] There is not basic password file list !
-------- Performance Metrics -------------------------------------------------
[--] Up for: 2h 13m 57s (358K q [44.663 qps], 23K conn, TX: 17B, RX: 179M)
[--] Reads / Writes: 84% / 16%
[--] Total buffers: 672.0M global + 2.8M per thread (500 max threads)
[OK] Maximum possible memory usage: 2.0G (12% of installed RAM)
[OK] Slow queries: 0% (1K/358K)
[OK] Highest usage of available connections: 35% (178/500)
[OK] Key buffer size / total MyISAM indexes: 512.0M/77.4M
[OK] Key buffer hit rate: 99.9% (76M cached / 43K reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (7 temp sorts / 23K sorts)
[!!] Joins performed without indexes: 1457
[!!] Temporary tables created on disk: 46% (10K on disk / 23K total)
[OK] Thread cache hit rate: 98% (312 created / 23K connections)
[!!] Table cache hit rate: 0% (400 open / 50K opened)
[OK] Open file limit used: 5% (132/2K)
[OK] Table locks acquired immediately: 99% (530K immediate / 531K locks)

-------- InnoDB Metrics -----------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB BufferPool Size :128.0M
[--] InnoDB BufferPool Inst :1
[!!] InnoDB  buffer pool / data size: 128.0M/938.1M
[OK] InnoDB buffer pool instances: 1
[OK] InnoDB log waits: 0

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Enable the slow query log to troubleshoot bad queries
    Adjust your join queries to always utilize indexes
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
    query_cache_size (>= 8M)
    join_buffer_size (> 128.0K, or always use indexes with joins)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    table_open_cache (> 400)
    innodb_buffer_pool_size (>= 938M)
 

Solidus

Well-known member
#2
Try this, it's just mine adjusted for your amount of users online,

Code:
[mysqld]
skip-external-locking
query_cache_type = 0
query_cache_size = 256M
query_cache_limit = 1M
query_cache_strip_comments = 0
thread_cache_size = 256
max_heap_table_size = 128M
tmp_table_size = 128M
connect_timeout = 10
max_connections = 500
interactive_timeout = 300
wait_timeout = 300
#thread_stack = 256k
table_open_cache = 24000
open_files_limit = 24000
key_buffer_size = 768M
max_allowed_packet = 4M
sort_buffer_size = 1M
join_buffer_size = 128k
#net_buffer_length = 64K
read_buffer_size = 512K
#read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 128M
innodb_buffer_pool_size = 8G
innodb_thread_concurrency = 0
innodb_buffer_pool_instances = 4
innodb_flush_method=O_DIRECT
innodb_file_per_table=1
innodb_log_buffer_size=8M
 

Set3sh

Active member
#4
Hello,

After taking a first look at the information you provided please modify these settings in your my.cnf file:

innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances = 1
query_cache_type = 1
key_buffer_size = 128M
max_connections = 256
join_buffer_size = 1M
table_open_cache = 1500
query_cache_size = 128M
thread_cache_size = 128
innodb_thread_concurrency = 4


Kind regards,
George.