Mysql my.cnf settings - Tweak or to not tweak

MRaburn

Active member
Ive got Xen up and running on our new box. It's a dedicated box and currently my.cnf is not setup at all, just has this in it.

Code:
[mysqld]
set-variable = max_connections=500
log-slow-queries
safe-show-database

The box seems to be running fine, but I wonder if some tweaking is in order.

Box Info:

CentOS - Cpanel/WHM
Processor: Intel Xeon E3-1230 (8M Cache, 3.20 GHz)
Memory: 8GB DDR3-1333 ECC
Hard Drives: 4x RE4 500GB SATA2 7200rpm 64MB (RAID-10)

It shows 8 Processors in Top and WHM. Not sure if there is actually 2 CPUs on the box or the view it Hyperthreading look.
 
The CPanel Mysql Tuner reccommended these settings to tweak.

Code:
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.56-log
[OK] Operating on 64-bit architecture
 
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 7G (Tables: 1814)
[--] Data in InnoDB tables: 3G (Tables: 567)
[--] Data in MEMORY tables: 6M (Tables: 34)
[!!] Total fragmented tables: 649
 
-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 1h 19m 39s (56M q [620.176 qps], 378K conn, TX: 90B, RX: 14B)
[--] Reads / Writes: 36% / 64%
[--] Total buffers: 34.0M global + 2.7M per thread (500 max threads)
[OK] Maximum possible memory usage: 1.4G (17% of installed RAM)
[OK] Slow queries: 0% (743/56M)
[OK] Highest usage of available connections: 15% (77/500)
[!!] Key buffer size / total MyISAM indexes: 8.0M/4.5G
[!!] Key buffer hit rate: 93.2% (1B cached / 110M reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (470 temp sorts / 1M sorts)
[!!] Joins performed without indexes: 1518
[!!] Temporary tables created on disk: 41% (14K on disk / 34K total)
[!!] Thread cache is disabled
[!!] Table cache hit rate: 0% (64 open / 126K opened)
[OK] Open file limit used: 0% (22/2K)
[OK] Table locks acquired immediately: 99% (36M immediate / 36M locks)
[!!] InnoDB data size / buffer pool: 3.6G/8.0M
 
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    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
    Set thread_cache_size to 4 as a starting value
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
    key_buffer_size (> 4.5G)
    query_cache_size (>= 8M)
    join_buffer_size (> 128.0K, or always use indexes with joins)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    thread_cache_size (start at 4)
    table_cache (> 64)
    innodb_buffer_pool_size (>= 3G)
 
Is your site running slow? expecting growth? any reason for wanting to optimise other than.. just cuz?

I would look at adding in

thread_concurrency=8

But otherwise, unless your having problems, don't worry about it :)
 
Ya Im having 0 issues really, just knew that on this new box I had not set any variables yet. It seems to do OK. I do have some issues sometimes the way Wordpress acts and the Xen search takes a bit to run.

To tinker or not to tinker. ;)
 
Ya Im having 0 issues really, just knew that on this new box I had not set any variables yet. It seems to do OK. I do have some issues sometimes the way Wordpress acts and the Xen search takes a bit to run.

To tinker or not to tinker. ;)


Well first off, don't rely on any tuning tools. If it were as simple as running a tool to find your perfect configuration, don't you think it would have already been released with the core mysql product?

If you want to find out how to tune your server, you will want a bit more information, you will need to get intimate with your settings and find out where the problem lies.

Put bluntly, the last 3 weeks I have had to help half a dozen customers who have gone tinkering for "optimization" and ended up making things worse than a default config.

We can reccommend things to try, just do a search in this forum, there are more than a few threads already discussing the issue.
 
Thanks Slavic, I will try your thread concurrency and leave the rest alone for now unless I see issues.
 
Thread concurrency is totally useless if you are not using Solaris.

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_thread_concurrency says:
This variable is specific to Solaris systems, for which mysqld invokes the thr_setconcurrency() with the variable value. This function enables applications to give the threads system a hint about the desired number of threads that should be run at the same time
For a xenforo site, innodb_thread_concurrency is important as most of the tables are innodb:
A recommended value is 2 times the number of CPUs plus the number of disks.

Most important variables for a mysql server are key_buffer_size and innodb_buffer_pool_size

Try to increase these values according to the mysql tuner scripts recommendations. But if you don't have enough ram, this may make things worse, because your server may start swapping.
 
I have just left all settings along for the moment, I have not set any variables, so Mysql is in default.

We dropped from a 1.5 or so load on VB running and now run about .30 average with Zen running so I figure leave well enough alone?

Mike
 
Well if you find them then let me know.

If it were as simple as running a tool to find your perfect configuration, don't you think it would have already been released with the core mysql product?
My advice to the OP. Don't mess with anything.
 
If it were as simple as running a tool to find your perfect configuration, don't you think it would have already been released with the core mysql product?
My advice to the OP. Don't mess with anything.

It isn't a tool genius. That script out puts show variables and show status which ARE built in queries to read MySQL performance. Using that data you can make adjustments based on how MySQL is currently running and configured on his server.
 
It isn't a tool genius. That script out puts show variables and show status which ARE built in queries to read MySQL performance. Using that data you can make adjustments based on how MySQL is currently running and configured on his server.

Either way, your wrong. End of discussion. The OP has no need to change any mysql settings at the moment, and should not be advised otherwise. When the OP's site grows to a point where he may notice some site slowdown, that is when he could look to start tweaking mysql.
 
Either way, your wrong. End of discussion. The OP has no need to change any mysql settings at the moment, and should not be advised otherwise. When the OP's site grows to a point where he may notice some site slowdown, that is when he could look to start tweaking mysql.

and we have my first use of the ignore feature of xenForo.

If you would like some advice on tuning MySQL Mike, feel free to ask me. You should at the very least tune your query_cache settings and if you run the file I suggested above you will be able to get a good bearing on how MySQL is currently performing.
 
Top Bottom