Link to home
Start Free TrialLog in
Avatar of XK8ER
XK8ERFlag for United States of America

asked on

tuning mysql

hello there,
I run most of my sites using mysql and I would like to know how to tune up the my.cnf
here's what I have in the file and using http://www.day32.com/MySQL/
let me know what are the best options since the server load is average around 6 and im trying to lower it to about 1 or 2.
im using Centos v5.6 and mysql with apache


[mysqld]
socket=/home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock
ft_min_word_len=2
datadir=/var/lib/mysql
skip-locking
skip-innodb
old-passwords = 1
key_buffer = 256M
key_buffer_size = 1350M
table_cache = 2048
sort_buffer_size = 32M
read_buffer_size = 2M
read_rnd_buffer_size = 32M
join_buffer_size = 1M
myisam_sort_buffer_size = 64M
thread_cache_size = 256
query_cache_size = 800M
query_cache_limit = 384M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
thread_cache_size = 8
# log-bin
# server-id=1
max_connections = 500
#Increase max_connect_errors from 10 to 1000
max_connect_errors=1000
 
#this is to log and find out slow query that slow down the server
#log-queries-not-using-indexes
#long_query_time = 5
log-slow-queries=/var/log/mysqld/slow.log
 
#start added on Jan 30, 2009
#record_buffer=1M
#net_buffer_length=16K
#bulk_insert_buffer_size=1M
#thread_cache=20
max_heap_table_size=1800M
tmp_table_size=384M
wait_timeout = 1800
#ended added on Jan 30, 2009
 
connect_timeout = 10
interactive_timeout = 120
 
[mysql.server]
user=mysql
#basedir=/var/lib 

[safe_mysqld] 
err-log=/var/log/mysqld/mysqld.log 
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
 
[mysqldump]
quick
max_allowed_packet=16M
 
[mysql]
no-auto-rehash
#safe-updates
 
[isamchk]
key_buffer = 256M
sort_buffer_size = 32M
read_buffer = 2M
write_buffer = 2M
 
[myisamchk]
ft_min_word_len=2
key_buffer = 256M
sort_buffer_size = 32M
read_buffer = 2M
write_buffer = 2M
 
[mysqlhotcopy]
interactive-timeout
 
[client]
socket=/home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock

Open in new window





[(04:46 AM)][(root@alpha)] [(~)] $ ./tuning-primer.sh

Using login values from ~/.my.cnf
- INITIAL LOGIN ATTEMPT FAILED -
Testing for stored webmin passwords:
 None Found
Could not auto detect login info!
Found potential sockets: /home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock
Using: /var/lib/mysql/mysql.sock
Would you like to provide a different socket?: [y/N] n
Do you have your login handy ? [y/N] : y
User: root
Password: temp123
 
Would you like me to create a ~/.my.cnf file for you? [y/N] : y
 
	-- MYSQL PERFORMANCE TUNING PRIMER --
	     - By: Matthew Montgomery -

MySQL Version 5.1.58-community-log i686

Uptime = 6 days 14 hrs 52 min 7 sec
Avg. qps = 90
Total Questions = 51940860
Threads Connected = 1

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.1/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 enabled.
Current long_query_time = 10.000000 sec.
You have 18736 out of 51940881 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.1/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 7
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

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

No InnoDB Support Enabled!

MEMORY USAGE
Max Memory Ever Allocated : 13.45 G
Configured Max Per-thread Buffers : 32.80 G
Configured Max Global Buffers : 2.09 G
Configured Max Memory Limit : 34.90 G
Physical Memory : 7.92 G

Max memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 1.26 G
Current key_buffer_size = 1.31 G
Key cache miss rate is 1 : 13667
Key buffer free ratio = 43 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is enabled
Current query_cache_size = 800 M
Current query_cache_used = 159 M
Current query_cache_limit = 384 M
Current Query cache Memory fill ratio = 19.91 %
Current query_cache_min_res_unit = 4 K
Query Cache is 26 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 32 M
Current read_rnd_buffer_size = 32 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 1.00 M
You have had 1553861 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 = 8192 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 = 2048 tables
Current table_definition_cache = 256 tables
You have a total of 700 tables
You have 1322 open tables.
The table_cache value seems to be fine
You should probably increase your table_definition_cache value.

TEMP TABLES
Current max_heap_table_size = 1.75 G
Current tmp_table_size = 384 M
Of 196197 temp tables, 13% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 2 M
Current table scan ratio = 217 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 177
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=2'.

[(04:48 AM)][(root@alpha)] [(~)] $ 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Swadhin Ray
Swadhin Ray
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of XK8ER

ASKER

okay here's the requested data.. I have made changes the the mysql configuration file after displaying these outputs..
[(12:59 PM)][(root@alpha)] [(~)] $ mysql -u root -p --password=temp123
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3871977
Server version: 5.1.58-community-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW GLOBAL VARIABLES;
+-----------------------------------------+-------------------------------------------------------------------------------------------+
| Variable_name                           | Value                                                                                     |
+-----------------------------------------+-------------------------------------------------------------------------------------------+
| auto_increment_increment                | 1                                                                                         |
| auto_increment_offset                   | 1                                                                                         |
| autocommit                              | ON                                                                                        |
| automatic_sp_privileges                 | ON                                                                                        |
| back_log                                | 50                                                                                        |
| basedir                                 | /                                                                                         |
| big_tables                              | OFF                                                                                       |
| binlog_cache_size                       | 32768                                                                                     |
| binlog_direct_non_transactional_updates | OFF                                                                                       |
| binlog_format                           | STATEMENT                                                                                 |
| bulk_insert_buffer_size                 | 8388608                                                                                   |
| character_set_client                    | latin1                                                                                    |
| character_set_connection                | latin1                                                                                    |
| character_set_database                  | latin1                                                                                    |
| character_set_filesystem                | binary                                                                                    |
| character_set_results                   | latin1                                                                                    |
| character_set_server                    | latin1                                                                                    |
| character_set_system                    | utf8                                                                                      |
| character_sets_dir                      | /usr/share/mysql/charsets/                                                                |
| collation_connection                    | latin1_swedish_ci                                                                         |
| collation_database                      | latin1_swedish_ci                                                                         |
| collation_server                        | latin1_swedish_ci                                                                         |
| completion_type                         | 0                                                                                         |
| concurrent_insert                       | 1                                                                                         |
| connect_timeout                         | 10                                                                                        |
| datadir                                 | /var/lib/mysql/                                                                           |
| date_format                             | %Y-%m-%d                                                                                  |
| datetime_format                         | %Y-%m-%d %H:%i:%s                                                                         |
| default_week_format                     | 0                                                                                         |
| delay_key_write                         | ON                                                                                        |
| delayed_insert_limit                    | 100                                                                                       |
| delayed_insert_timeout                  | 300                                                                                       |
| delayed_queue_size                      | 1000                                                                                      |
| div_precision_increment                 | 4                                                                                         |
| engine_condition_pushdown               | ON                                                                                        |
| error_count                             | 0                                                                                         |
| event_scheduler                         | DISABLED                                                                                  |
| expire_logs_days                        | 0                                                                                         |
| flush                                   | OFF                                                                                       |
| flush_time                              | 0                                                                                         |
| foreign_key_checks                      | ON                                                                                        |
| ft_boolean_syntax                       | + -><()~*:""&|                                                                            |
| ft_max_word_len                         | 84                                                                                        |
| ft_min_word_len                         | 2                                                                                         |
| ft_query_expansion_limit                | 20                                                                                        |
| ft_stopword_file                        | (built-in)                                                                                |
| general_log                             | OFF                                                                                       |
| general_log_file                        | /var/lib/mysql/alpha.log                                                                  |
| group_concat_max_len                    | 1024                                                                                      |
| have_community_features                 | YES                                                                                       |
| have_compress                           | YES                                                                                       |
| have_crypt                              | YES                                                                                       |
| have_csv                                | YES                                                                                       |
| have_dynamic_loading                    | YES                                                                                       |
| have_geometry                           | YES                                                                                       |
| have_innodb                             | DISABLED                                                                                  |
| have_ndbcluster                         | NO                                                                                        |
| have_openssl                            | DISABLED                                                                                  |
| have_partitioning                       | YES                                                                                       |
| have_query_cache                        | YES                                                                                       |
| have_rtree_keys                         | YES                                                                                       |
| have_ssl                                | DISABLED                                                                                  |
| have_symlink                            | YES                                                                                       |
| hostname                                | alpha.domain.net                                                                          |
| identity                                | 0                                                                                         |
| ignore_builtin_innodb                   | OFF                                                                                       |
| init_connect                            |                                                                                           |
| init_file                               |                                                                                           |
| init_slave                              |                                                                                           |
| insert_id                               | 0                                                                                         |
| interactive_timeout                     | 120                                                                                       |
| join_buffer_size                        | 1048576                                                                                   |
| keep_files_on_create                    | OFF                                                                                       |
| key_buffer_size                         | 1415577600                                                                                |
| key_cache_age_threshold                 | 300                                                                                       |
| key_cache_block_size                    | 1024                                                                                      |
| key_cache_division_limit                | 100                                                                                       |
| language                                | /usr/share/mysql/english/                                                                 |
| large_files_support                     | ON                                                                                        |
| large_page_size                         | 0                                                                                         |
| large_pages                             | OFF                                                                                       |
| last_insert_id                          | 0                                                                                         |
| lc_time_names                           | en_US                                                                                     |
| license                                 | GPL                                                                                       |
| local_infile                            | ON                                                                                        |
| locked_in_memory                        | OFF                                                                                       |
| log                                     | OFF                                                                                       |
| log_bin                                 | OFF                                                                                       |
| log_bin_trust_function_creators         | OFF                                                                                       |
| log_bin_trust_routine_creators          | OFF                                                                                       |
| log_error                               | /var/lib/mysql/alpha.domain.net.err  			                                                |
| log_output                              | FILE                                                                                      |
| log_queries_not_using_indexes           | OFF                                                                                       |
| log_slave_updates                       | OFF                                                                                       |
| log_slow_queries                        | ON                                                                                        |
| log_warnings                            | 1                                                                                         |
| long_query_time                         | 10.000000                                                                                 |
| low_priority_updates                    | OFF                                                                                       |
| lower_case_file_system                  | OFF                                                                                       |
| lower_case_table_names                  | 0                                                                                         |
| max_allowed_packet                      | 1048576                                                                                   |
| max_binlog_cache_size                   | 4294963200                                                                                |
| max_binlog_size                         | 1073741824                                                                                |
| max_connect_errors                      | 1000                                                                                      |
| max_connections                         | 500                                                                                       |
| max_delayed_threads                     | 20                                                                                        |
| max_error_count                         | 64                                                                                        |
| max_heap_table_size                     | 1887436800                                                                                |
| max_insert_delayed_threads              | 20                                                                                        |
| max_join_size                           | 18446744073709551615                                                                      |
| max_length_for_sort_data                | 1024                                                                                      |
| max_long_data_size                      | 1048576                                                                                   |
| max_prepared_stmt_count                 | 16382                                                                                     |
| max_relay_log_size                      | 0                                                                                         |
| max_seeks_for_key                       | 4294967295                                                                                |
| max_sort_length                         | 1024                                                                                      |
| max_sp_recursion_depth                  | 0                                                                                         |
| max_tmp_tables                          | 32                                                                                        |
| max_user_connections                    | 0                                                                                         |
| max_write_lock_count                    | 4294967295                                                                                |
| min_examined_row_limit                  | 0                                                                                         |
| multi_range_count                       | 256                                                                                       |
| myisam_data_pointer_size                | 6                                                                                         |
| myisam_max_sort_file_size               | 2146435072                                                                                |
| myisam_mmap_size                        | 4294967295                                                                                |
| myisam_recover_options                  | OFF                                                                                       |
| myisam_repair_threads                   | 1                                                                                         |
| myisam_sort_buffer_size                 | 67108864                                                                                  |
| myisam_stats_method                     | nulls_unequal                                                                             |
| myisam_use_mmap                         | OFF                                                                                       |
| net_buffer_length                       | 16384                                                                                     |
| net_read_timeout                        | 30                                                                                        |
| net_retry_count                         | 10                                                                                        |
| net_write_timeout                       | 60                                                                                        |
| new                                     | OFF                                                                                       |
| old                                     | OFF                                                                                       |
| old_alter_table                         | OFF                                                                                       |
| old_passwords                           | ON                                                                                        |
| open_files_limit                        | 8192                                                                                      |
| optimizer_prune_level                   | 1                                                                                         |
| optimizer_search_depth                  | 62                                                                                        |
| optimizer_switch                        | index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on |
| pid_file                                | /var/lib/mysql/alpha.domain.net.pid                                                       |
| plugin_dir                              | /usr/lib/mysql/plugin                                                                     |
| port                                    | 3306                                                                                      |
| preload_buffer_size                     | 32768                                                                                     |
| profiling                               | OFF                                                                                       |
| profiling_history_size                  | 15                                                                                        |
| protocol_version                        | 10                                                                                        |
| pseudo_thread_id                        | 0                                                                                         |
| query_alloc_block_size                  | 8192                                                                                      |
| query_cache_limit                       | 402653184                                                                                 |
| query_cache_min_res_unit                | 4096                                                                                      |
| query_cache_size                        | 838860800                                                                                 |
| query_cache_type                        | ON                                                                                        |
| query_cache_wlock_invalidate            | OFF                                                                                       |
| query_prealloc_size                     | 8192                                                                                      |
| rand_seed1                              |                                                                                           |
| rand_seed2                              |                                                                                           |
| range_alloc_block_size                  | 4096                                                                                      |
| read_buffer_size                        | 2097152                                                                                   |
| read_only                               | OFF                                                                                       |
| read_rnd_buffer_size                    | 33554432                                                                                  |
| relay_log                               |                                                                                           |
| relay_log_index                         |                                                                                           |
| relay_log_info_file                     | relay-log.info                                                                            |
| relay_log_purge                         | ON                                                                                        |
| relay_log_space_limit                   | 0                                                                                         |
| report_host                             |                                                                                           |
| report_password                         |                                                                                           |
| report_port                             | 3306                                                                                      |
| report_user                             |                                                                                           |
| rpl_recovery_rank                       | 0                                                                                         |
| secure_auth                             | OFF                                                                                       |
| secure_file_priv                        |                                                                                           |
| server_id                               | 0                                                                                         |
| skip_external_locking                   | ON                                                                                        |
| skip_name_resolve                       | OFF                                                                                       |
| skip_networking                         | OFF                                                                                       |
| skip_show_database                      | OFF                                                                                       |
| slave_compressed_protocol               | OFF                                                                                       |
| slave_exec_mode                         | STRICT                                                                                    |
| slave_load_tmpdir                       | /tmp                                                                                      |
| slave_net_timeout                       | 3600                                                                                      |
| slave_skip_errors                       | OFF                                                                                       |
| slave_transaction_retries               | 10                                                                                        |
| slow_launch_time                        | 2                                                                                         |
| slow_query_log                          | ON                                                                                        |
| slow_query_log_file                     | /var/log/mysqld/slow.log                                                                  |
| socket                                  | /home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock                                    |
| sort_buffer_size                        | 33554432                                                                                  |
| sql_auto_is_null                        | ON                                                                                        |
| sql_big_selects                         | ON                                                                                        |
| sql_big_tables                          | OFF                                                                                       |
| sql_buffer_result                       | OFF                                                                                       |
| sql_log_bin                             | ON                                                                                        |
| sql_log_off                             | OFF                                                                                       |
| sql_log_update                          | ON                                                                                        |
| sql_low_priority_updates                | OFF                                                                                       |
| sql_max_join_size                       | 18446744073709551615                                                                      |
| sql_mode                                |                                                                                           |
| sql_notes                               | ON                                                                                        |
| sql_quote_show_create                   | ON                                                                                        |
| sql_safe_updates                        | OFF                                                                                       |
| sql_select_limit                        | 18446744073709551615                                                                      |
| sql_slave_skip_counter                  |                                                                                           |
| sql_warnings                            | OFF                                                                                       |
| ssl_ca                                  |                                                                                           |
| ssl_capath                              |                                                                                           |
| ssl_cert                                |                                                                                           |
| ssl_cipher                              |                                                                                           |
| ssl_key                                 |                                                                                           |
| storage_engine                          | MyISAM                                                                                    |
| sync_binlog                             | 0                                                                                         |
| sync_frm                                | ON                                                                                        |
| system_time_zone                        | EST                                                                                       |
| table_definition_cache                  | 256                                                                                       |
| table_lock_wait_timeout                 | 50                                                                                        |
| table_open_cache                        | 2048                                                                                      |
| table_type                              | MyISAM                                                                                    |
| thread_cache_size                       | 8                                                                                         |
| thread_handling                         | one-thread-per-connection                                                                 |
| thread_stack                            | 196608                                                                                    |
| time_format                             | %H:%i:%s                                                                                  |
| time_zone                               | SYSTEM                                                                                    |
| timed_mutexes                           | OFF                                                                                       |
| timestamp                               | 1316023175                                                                                |
| tmp_table_size                          | 402653184                                                                                 |
| tmpdir                                  | /tmp                                                                                      |
| transaction_alloc_block_size            | 8192                                                                                      |
| transaction_prealloc_size               | 4096                                                                                      |
| tx_isolation                            | REPEATABLE-READ                                                                           |
| unique_checks                           | ON                                                                                        |
| updatable_views_with_limit              | YES                                                                                       |
| version                                 | 5.1.58-community-log                                                                      |
| version_comment                         | MySQL Community Server (GPL)                                                              |
| version_compile_machine                 | i686                                                                                      |
| version_compile_os                      | pc-linux-gnu                                                                              |
| wait_timeout                            | 1800                                                                                      |
| warning_count                           | 0                                                                                         |
+-----------------------------------------+-------------------------------------------------------------------------------------------+
240 rows in set (0.00 sec)

mysql> SHOW GLOBAL STATUS;
+--------------------------------+---------------+
| Variable_name                  | Value         |
+--------------------------------+---------------+
| Aborted_clients                | 124           |
| Aborted_connects               | 4             |
| Binlog_cache_disk_use          | 0             |
| Binlog_cache_use               | 0             |
| Bytes_received                 | 15471881846   |
| Bytes_sent                     | 2037811569274 |
| Com_admin_commands             | 1             |
| Com_assign_to_keycache         | 0             |
| Com_alter_db                   | 0             |
| Com_alter_db_upgrade           | 0             |
| Com_alter_event                | 0             |
| Com_alter_function             | 0             |
| Com_alter_procedure            | 0             |
| Com_alter_server               | 0             |
| Com_alter_table                | 46            |
| Com_alter_tablespace           | 0             |
| Com_analyze                    | 0             |
| Com_backup_table               | 0             |
| Com_begin                      | 0             |
| Com_binlog                     | 0             |
| Com_call_procedure             | 0             |
| Com_change_db                  | 5969476       |
| Com_change_master              | 0             |
| Com_check                      | 0             |
| Com_checksum                   | 0             |
| Com_commit                     | 0             |
| Com_create_db                  | 0             |
| Com_create_event               | 0             |
| Com_create_function            | 0             |
| Com_create_index               | 0             |
| Com_create_procedure           | 0             |
| Com_create_server              | 0             |
| Com_create_table               | 375           |
| Com_create_trigger             | 0             |
| Com_create_udf                 | 0             |
| Com_create_user                | 0             |
| Com_create_view                | 0             |
| Com_dealloc_sql                | 0             |
| Com_delete                     | 782197        |
| Com_delete_multi               | 285           |
| Com_do                         | 0             |
| Com_drop_db                    | 0             |
| Com_drop_event                 | 0             |
| Com_drop_function              | 0             |
| Com_drop_index                 | 0             |
| Com_drop_procedure             | 0             |
| Com_drop_server                | 0             |
| Com_drop_table                 | 370           |
| Com_drop_trigger               | 0             |
| Com_drop_user                  | 0             |
| Com_drop_view                  | 0             |
| Com_empty_query                | 0             |
| Com_execute_sql                | 0             |
| Com_flush                      | 0             |
| Com_grant                      | 0             |
| Com_ha_close                   | 0             |
| Com_ha_open                    | 0             |
| Com_ha_read                    | 0             |
| Com_help                       | 0             |
| Com_insert                     | 2013518       |
| Com_insert_select              | 391           |
| Com_install_plugin             | 0             |
| Com_kill                       | 1             |
| Com_load                       | 0             |
| Com_load_master_data           | 0             |
| Com_load_master_table          | 0             |
| Com_lock_tables                | 0             |
| Com_optimize                   | 1             |
| Com_preload_keys               | 0             |
| Com_prepare_sql                | 0             |
| Com_purge                      | 0             |
| Com_purge_before_date          | 0             |
| Com_release_savepoint          | 0             |
| Com_rename_table               | 0             |
| Com_rename_user                | 0             |
| Com_repair                     | 0             |
| Com_replace                    | 28730         |
| Com_replace_select             | 0             |
| Com_reset                      | 0             |
| Com_restore_table              | 0             |
| Com_revoke                     | 0             |
| Com_revoke_all                 | 0             |
| Com_rollback                   | 0             |
| Com_rollback_to_savepoint      | 0             |
| Com_savepoint                  | 0             |
| Com_select                     | 18143799      |
| Com_set_option                 | 2941584       |
| Com_show_authors               | 0             |
| Com_show_binlog_events         | 0             |
| Com_show_binlogs               | 181           |
| Com_show_charsets              | 0             |
| Com_show_collations            | 0             |
| Com_show_column_types          | 0             |
| Com_show_contributors          | 0             |
| Com_show_create_db             | 0             |
| Com_show_create_event          | 0             |
| Com_show_create_func           | 0             |
| Com_show_create_proc           | 0             |
| Com_show_create_table          | 38            |
| Com_show_create_trigger        | 0             |
| Com_show_databases             | 30            |
| Com_show_engine_logs           | 0             |
| Com_show_engine_mutex          | 0             |
| Com_show_engine_status         | 0             |
| Com_show_events                | 0             |
| Com_show_errors                | 0             |
| Com_show_fields                | 29589         |
| Com_show_function_status       | 0             |
| Com_show_grants                | 4             |
| Com_show_keys                  | 74            |
| Com_show_master_status         | 13            |
| Com_show_new_master            | 0             |
| Com_show_open_tables           | 0             |
| Com_show_plugins               | 305           |
| Com_show_privileges            | 0             |
| Com_show_procedure_status      | 0             |
| Com_show_processlist           | 162           |
| Com_show_profile               | 0             |
| Com_show_profiles              | 0             |
| Com_show_slave_hosts           | 0             |
| Com_show_slave_status          | 13            |
| Com_show_status                | 38            |
| Com_show_storage_engines       | 1             |
| Com_show_table_status          | 132           |
| Com_show_tables                | 66            |
| Com_show_triggers              | 0             |
| Com_show_variables             | 156           |
| Com_show_warnings              | 3             |
| Com_slave_start                | 0             |
| Com_slave_stop                 | 0             |
| Com_stmt_close                 | 0             |
| Com_stmt_execute               | 0             |
| Com_stmt_fetch                 | 0             |
| Com_stmt_prepare               | 0             |
| Com_stmt_reprepare             | 0             |
| Com_stmt_reset                 | 0             |
| Com_stmt_send_long_data        | 0             |
| Com_truncate                   | 371           |
| Com_uninstall_plugin           | 0             |
| Com_unlock_tables              | 0             |
| Com_update                     | 3120585       |
| Com_update_multi               | 367           |
| Com_xa_commit                  | 0             |
| Com_xa_end                     | 0             |
| Com_xa_prepare                 | 0             |
| Com_xa_recover                 | 0             |
| Com_xa_rollback                | 0             |
| Com_xa_start                   | 0             |
| Compression                    | OFF           |
| Connections                    | 3872015       |
| Created_tmp_disk_tables        | 32867         |
| Created_tmp_files              | 28742         |
| Created_tmp_tables             | 205649        |
| Delayed_errors                 | 0             |
| Delayed_insert_threads         | 0             |
| Delayed_writes                 | 0             |
| Flush_commands                 | 1             |
| Handler_commit                 | 0             |
| Handler_delete                 | 540970        |
| Handler_discover               | 0             |
| Handler_prepare                | 0             |
| Handler_read_first             | 5051018       |
| Handler_read_key               | 303204498     |
| Handler_read_next              | 3283608656    |
| Handler_read_prev              | 4221747500    |
| Handler_read_rnd               | 59660443      |
| Handler_read_rnd_next          | 1141316724    |
| Handler_rollback               | 0             |
| Handler_savepoint              | 0             |
| Handler_savepoint_rollback     | 0             |
| Handler_update                 | 5860997       |
| Handler_write                  | 46671195      |
| Key_blocks_not_flushed         | 0             |
| Key_blocks_unused              | 598943        |
| Key_blocks_used                | 619119        |
| Key_read_requests              | 8721638783    |
| Key_reads                      | 592948        |
| Key_write_requests             | 7006794       |
| Key_writes                     | 5168353       |
| Last_query_cost                | 0.000000      |
| Max_used_connections           | 173           |
| Not_flushed_delayed_rows       | 0             |
| Open_files                     | 1876          |
| Open_streams                   | 0             |
| Open_table_definitions         | 699           |
| Open_tables                    | 1322          |
| Opened_files                   | 176140        |
| Opened_table_definitions       | 2330          |
| Opened_tables                  | 4001          |
| Prepared_stmt_count            | 0             |
| Qcache_free_blocks             | 92657         |
| Qcache_free_memory             | 617128984     |
| Qcache_hits                    | 17778766      |
| Qcache_inserts                 | 16317169      |
| Qcache_lowmem_prunes           | 594007        |
| Qcache_not_cached              | 1820921       |
| Qcache_queries_in_cache        | 173683        |
| Qcache_total_blocks            | 441272        |
| Queries                        | 54683554      |
| Questions                      | 54683554      |
| Rpl_status                     | NULL          |
| Select_full_join               | 1633946       |
| Select_full_range_join         | 0             |
| Select_range                   | 4530137       |
| Select_range_check             | 0             |
| Select_scan                    | 3705345       |
| Slave_open_temp_tables         | 0             |
| Slave_retried_transactions     | 0             |
| Slave_running                  | OFF           |
| Slow_launch_threads            | 0             |
| Slow_queries                   | 19994         |
| Sort_merge_passes              | 14378         |
| Sort_range                     | 177545        |
| Sort_rows                      | 1011380274    |
| Sort_scan                      | 150114        |
| Ssl_accept_renegotiates        | 0             |
| Ssl_accepts                    | 0             |
| Ssl_callback_cache_hits        | 0             |
| Ssl_cipher                     |               |
| Ssl_cipher_list                |               |
| Ssl_client_connects            | 0             |
| Ssl_connect_renegotiates       | 0             |
| Ssl_ctx_verify_depth           | 0             |
| Ssl_ctx_verify_mode            | 0             |
| Ssl_default_timeout            | 0             |
| Ssl_finished_accepts           | 0             |
| Ssl_finished_connects          | 0             |
| Ssl_session_cache_hits         | 0             |
| Ssl_session_cache_misses       | 0             |
| Ssl_session_cache_mode         | NONE          |
| Ssl_session_cache_overflows    | 0             |
| Ssl_session_cache_size         | 0             |
| Ssl_session_cache_timeouts     | 0             |
| Ssl_sessions_reused            | 0             |
| Ssl_used_session_cache_entries | 0             |
| Ssl_verify_depth               | 0             |
| Ssl_verify_mode                | 0             |
| Ssl_version                    |               |
| Table_locks_immediate          | 50810533      |
| Table_locks_waited             | 292776        |
| Tc_log_max_pages_used          | 0             |
| Tc_log_page_size               | 0             |
| Tc_log_page_waits              | 0             |
| Threads_cached                 | 6             |
| Threads_connected              | 2             |
| Threads_created                | 86264         |
| Threads_running                | 1             |
| Uptime                         | 601405        |
| Uptime_since_flush_status      | 601405        |
+--------------------------------+---------------+
249 rows in set (0.00 sec)

mysql> exit
Bye
[(12:59 PM)][(root@alpha)] [(~)] $ iostat -idx 10
Usage: iostat [ options... ] [ <interval> [ <count> ] ]
Options are:
[ -c | -d ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -n ] [ -h ] [ -N ]
[ <device> [ ... ] | ALL ] [ -p [ <device> | ALL ] ]
[(12:59 PM)][(root@alpha)] [(~)] $ vmstat 5 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0 755212 979748 523140 4389960    0    1    21   675    3   17 40 11 46  3  0
 1  0 755212 929024 523168 4397840    0    0     0   632 1285  928 30  5 64  1  0
 2  0 755212 921944 523240 4507584    0    0     2 16794 1514 1859 30 17 46  7  0
 1  1 755212 932944 523296 4505868    0    0     0  2244 1579 2385 25 11 63  1  0
 0  0 755212 1050448 523316 4390132    0    0     0   531 1286  921  7  3 89  1  0
 0  0 755212 1049220 523340 4390172    0    0     0   737 1428 1078  3  1 95  1  0
 0  0 755212 1049316 523392 4390584    0    0    94   550 1395 1045  1  1 95  3  0
 0  0 755212 1048388 523396 4390636    0    0     0   747 1513 1005  1  1 97  1  0
 0  0 755212 1051380 523532 4390648    0    0    25   235 1243  802  1  0 97  2  0
 0  0 755212 1050916 523532 4390656    0    0     0    34 1156  568  1  0 99  0  0
[(01:00 PM)][(root@alpha)] [(~)] $ top -b 10
	top: unknown argument '1'
usage:	top -hv | -bcisSHM -d delay -n iterations [-u user | -U user] -p pid [,pid ...]

[(01:01 PM)][(root@alpha)] [(~)] $

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of XK8ER

ASKER

i dont have InnoDB installed
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I didn't take a look at innodb thing since it is disabled, coming to your requested data will take a day and come back to you on what is happening in your instance with suggestions.
Avatar of XK8ER

ASKER

I have reinstalled mysql v5.1.58 with innodb..

here's the conf file that im using now.. and also the new report using tuning-primer.sh

#BEGIN CONFIG INFO
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO

#
# This is a MySQL example config file for systems with 4GB of memory
# running mostly MySQL using InnoDB only tables and performing complex
# queries with few connections.
# 
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#

#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
#password	= [your_password]
port		= 3306
socket		= /home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock

# *** Application-specific options follow here ***

#
# The MySQL server
#
[mysqld]

# generic configuration options
port		= 3306
socket		= /home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock

# back_log is the number of connections the operating system can keep in
# the listen queue, before the MySQL connection manager thread has
# processed them. If you have a very high connection rate and experience
# "connection refused" errors, you might need to increase this value.
# Check your OS documentation for the maximum value of this parameter.
# Attempting to set back_log higher than your operating system limit
# will have no effect.
back_log = 50

# Don't listen on a TCP/IP port at all. This can be a security
# enhancement, if all processes that need to connect to mysqld run
# on the same host.  All interaction with mysqld must be made via Unix
# sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#skip-networking

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections = 100

# Maximum amount of errors allowed per host. If this limit is reached,
# the host will be blocked from connecting to the MySQL server until
# "FLUSH HOSTS" has been run or the server was restarted. Invalid
# passwords and other errors during the connect phase result in
# increasing this value. See the "Aborted_connects" status variable for
# global counter.
max_connect_errors = 10

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_open_cache = 2048

# Enable external file level locking. Enabled file locking will have a
# negative impact on performance, so only use it in case you have
# multiple database instances running on the same files (note some
# restrictions still apply!) or if you use other software relying on
# locking MyISAM tables on file level.
#external-locking

# The maximum size of a query packet the server can handle as well as
# maximum query size server can process (Important when working with
# large BLOBs).  enlarged dynamically, for each connection.
max_allowed_packet = 16M

# The size of the cache to hold the SQL statements for the binary log
# during a transaction. If you often use big, multi-statement
# transactions you can increase this value to get more performance. All
# statements from transactions are buffered in the binary log cache and
# are being written to the binary log at once after the COMMIT.  If the
# transaction is larger than this value, temporary file on disk is used
# instead.  This buffer is allocated per connection on first update
# statement in transaction
binlog_cache_size = 1M

# Maximum allowed size for a single HEAP (in memory) table. This option
# is a protection against the accidential creation of a very large HEAP
# table which could otherwise use up all memory resources.
max_heap_table_size = 64M

# Size of the buffer used for doing full table scans.
# Allocated per thread, if a full scan is needed.
read_buffer_size = 2M

# When reading rows in sorted order after a sort, the rows are read
# through this buffer to avoid disk seeks. You can improve ORDER BY
# performance a lot, if set this to a high value.
# Allocated per thread, when needed.
read_rnd_buffer_size = 16M

# Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
# queries. If sorted data does not fit into the sort buffer, a disk
# based merge sort is used instead - See the "Sort_merge_passes"
# status variable. Allocated per thread if sort is needed.
sort_buffer_size = 8M

# This buffer is used for the optimization of full JOINs (JOINs without
# indexes). Such JOINs are very bad for performance in most cases
# anyway, but setting this variable to a large value reduces the
# performance impact. See the "Select_full_join" status variable for a
# count of full JOINs. Allocated per thread if full join is found
join_buffer_size = 8M

# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before.  This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size = 8

# This permits the application to give the threads system a hint for the
# desired number of threads that should be run at the same time.  This
# value only makes sense on systems that support the thread_concurrency()
# function call (Sun Solaris, for example).
# You should try [number of CPUs]*(2..4) for thread_concurrency
thread_concurrency = 8

# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size = 64M

# Only cache result sets that are smaller than this limit. This is to
# protect the query cache of a very large result set overwriting all
# other query results.
query_cache_limit = 2M

# Minimum word length to be indexed by the full text search index.
# You might wish to decrease it if you need to search for shorter words.
# Note that you need to rebuild your FULLTEXT index, after you have
# modified this value.
ft_min_word_len = 4

# If your system supports the memlock() function call, you might want to
# enable this option while running MySQL to keep it locked in memory and
# to avoid potential swapping out in case of high memory pressure. Good
# for performance.
#memlock

# Table type which is used by default when creating new tables, if not
# specified differently during the CREATE TABLE statement.
default-storage-engine = innodb

# Thread stack size to use. This amount of memory is always reserved at
# connection time. MySQL itself usually needs no more than 64K of
# memory, while if you use your own stack hungry UDF functions or your
# OS requires more stack for some operations, you might need to set this
# to a higher value.
thread_stack = 192K

# Set the default transaction isolation level. Levels available are:
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation = REPEATABLE-READ

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size = 64M

# Enable binary logging. This is required for acting as a MASTER in a
# replication configuration. You also need the binary log if you need
# the ability to do point in time recovery from your latest backup.
log-bin=mysql-bin

# binary logging format - mixed recommended
binlog_format=mixed

# If you're using replication with chained slaves (A->B->C), you need to
# enable this option on server B. It enables logging of updates done by
# the slave thread into the slave's binary log.
#log_slave_updates

# Enable the full query log. Every query (even ones with incorrect
# syntax) that the server receives will be logged. This is useful for
# debugging, it is usually disabled in production use.
#log

# Print warnings to the error log file.  If you have any problem with
# MySQL you should enable logging of warnings and examine the error log
# for possible explanations. 
#log_warnings

# Log slow queries. Slow queries are queries which take more than the
# amount of time defined in "long_query_time" or which do not use
# indexes well, if log_short_format is not enabled. It is normally good idea
# to have this turned on if you frequently add new queries to the
# system.
slow_query_log

# All queries taking more than this amount of time (in seconds) will be
# trated as slow. Do not use "1" as a value here, as this will result in
# even very fast queries being logged from time to time (as MySQL
# currently measures time with second accuracy only).
long_query_time = 2


# ***  Replication related settings 


# Unique server identification number between 1 and 2^32-1. This value
# is required for both master and slave hosts. It defaults to 1 if
# "master-host" is not set, but will MySQL will not function as a master
# if it is omitted.
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    changes in this file to the variable values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>

# Make the slave read-only. Only users with the SUPER privilege and the
# replication slave thread will be able to modify data on it. You can
# use this to ensure that no applications will accidently modify data on
# the slave instead of the master
#read_only


#*** MyISAM Specific options


# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size = 32M

# MyISAM uses special tree-like cache to make bulk inserts (that is,
# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
# INFILE) faster. This variable limits the size of the cache tree in
# bytes per thread. Setting it to 0 will disable this optimisation.  Do
# not set it larger than "key_buffer_size" for optimal performance.
# This buffer is allocated when a bulk insert is detected.
bulk_insert_buffer_size = 64M

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
myisam_sort_buffer_size = 128M

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size = 10G

# If a table has more than one index, MyISAM can use more than one
# thread to repair them by sorting in parallel. This makes sense if you
# have multiple CPUs and plenty of memory.
myisam_repair_threads = 1

# Automatically check and repair not properly closed MyISAM tables.
myisam_recover

# *** INNODB Specific options ***

# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb

############################################################
basedir=/opt/mysql5158
datadir=/opt/mysql5158/data

event-scheduler=on
general-log
slow-query-log
log-queries-not-using-indexes
log_warnings
skip-locking
skip-federated

innodb_file_per_table=1
innodb_file_format=barracuda
innodb_strict_mode=0
############################################################

# Additional memory pool that is used by InnoDB to store metadata
# information.  If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS.  As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size = 16M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system.  Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size = 2G

# InnoDB stores data in one or more data files forming the tablespace.
# If you have a single logical drive for your data, a single
# autoextending file would be good enough. In other cases, a single file
# per device is often a good choice. You can configure InnoDB to use raw
# disk partitions as well - please refer to the manual for more info
# about this.
innodb_data_file_path = ibdata1:10M:autoextend

# Set this option if you would like the InnoDB tablespace files to be
# stored in another location. By default this is the MySQL datadir.
#innodb_data_home_dir = <directory>

# Number of IO threads to use for async IO operations. This value is
# hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
# larger number.
innodb_file_io_threads = 4

# If you run into InnoDB tablespace corruption, setting this to a nonzero
# value will likely help you to dump your tables. Start from value 1 and
# increase it until you're able to dump the table successfully.
#innodb_force_recovery=1

# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency = 16

# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit = 1

# Speed up InnoDB shutdown. This will disable InnoDB to do a full purge
# and insert buffer merge on shutdown. It may increase shutdown time a
# lot, but InnoDB will have to do it on the next startup instead.
#innodb_fast_shutdown

# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions). 
innodb_log_buffer_size = 8M

# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size = 256M

# Total number of files in the log group. A value of 2-3 is usually good
# enough.
innodb_log_files_in_group = 3

# Location of the InnoDB log files. Default is the MySQL datadir. You
# may wish to point it to a dedicated hard drive or a RAID1 volume for
# improved performance
#innodb_log_group_home_dir

# Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
# If it is reached, InnoDB will start flushing them out agressively to
# not run out of clean pages at all. This is a soft limit, not
# guaranteed to be held.
innodb_max_dirty_pages_pct = 90

# The flush method InnoDB will use for Log. The tablespace always uses
# doublewrite flush logic. The default value is "fdatasync", another
# option is "O_DSYNC".
#innodb_flush_method=O_DSYNC

# How long an InnoDB transaction should wait for a lock to be granted
# before being rolled back. InnoDB automatically detects transaction
# deadlocks in its own lock table and rolls back the transaction. If you
# use the LOCK TABLES command, or other transaction-safe storage engines
# than InnoDB in the same transaction, then a deadlock may arise which
# InnoDB cannot notice. In cases like this the timeout is useful to
# resolve the situation.
innodb_lock_wait_timeout = 120


[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick

max_allowed_packet = 16M

[mysql]
no-auto-rehash

# Only allow UPDATEs and DELETEs that use keys.
#safe-updates

[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 8192
log-error=/opt/mysql5158/mysqld.log
pid-file=/opt/mysql5158/mysqld.pid

Open in new window

[(10:34 PM)][(root@alpha)] [(~)] $ ./tuning-primer.sh
 
	-- MYSQL PERFORMANCE TUNING PRIMER --
	     - By: Matthew Montgomery -

MySQL Version 5.1.58-log i686

Uptime = 2 days 0 hrs 11 min 3 sec
Avg. qps = 100
Total Questions = 17404948
Threads Connected = 4

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.1/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 enabled.
Current long_query_time = 2.000000 sec.
You have 1060580 out of 17404969 that take longer than 2.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is enabled
The expire_logs_days is not set.
The mysqld will retain the entire binary log until RESET MASTER or PURGE MASTER LOGS commands are run manually
Setting expire_logs_days will allow you to remove old binary logs automatically
See http://dev.mysql.com/doc/refman/5.1/en/purge-master-logs.html
Binlog sync is not enabled, you could loose binlog records during a server crash

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 6
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 5
Historic max_used_connections = 101
The number of used connections is 101% of the configured maximum.
You should raise max_connections

INNODB STATUS
Current InnoDB index space = 1.67 G
Current InnoDB data space = 17.78 G
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 2.00 G
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 : 5.58 G
Configured Max Per-thread Buffers : 3.43 G
Configured Max Global Buffers : 2.11 G
Configured Max Memory Limit : 5.55 G
Physical Memory : 7.92 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 143 K
Current key_buffer_size = 32 M
Key cache miss rate is 1 : 9301
Key buffer free ratio = 88 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 64 M
Current query_cache_used = 23 M
Current query_cache_limit = 2 M
Current Query cache Memory fill ratio = 37.40 %
Current query_cache_min_res_unit = 4 K
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 8 M
Current read_rnd_buffer_size = 16 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 8.00 M
You have had 448721 queries where a join could not use an index properly
join_buffer_size >= 4 M
This is not advised
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.

OPEN FILES LIMIT
Current open_files_limit = 8192 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 = 2048 tables
Current table_definition_cache = 256 tables
You have a total of 700 tables
You have 1098 open tables.
The table_cache value seems to be fine
You should probably increase your table_definition_cache value.

TEMP TABLES
Current max_heap_table_size = 64 M
Current tmp_table_size = 64 M
Of 68624 temp tables, 15% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 2 M
Current table scan ratio = 48 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 2075315
Your table locking seems to be fine

[(10:34 PM)][(root@alpha)] [(~)] $

Open in new window

Avatar of XK8ER

ASKER

mode data with

mysql> SHOW GLOBAL VARIABLES;
[(04:11 PM)][(root@alpha)] [(~)] $ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1585725
Server version: 5.1.58-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW GLOBAL VARIABLES;
+-----------------------------------------+-------------------------------------------------------------------------------------------+
| Variable_name                           | Value                                                                                     |
+-----------------------------------------+-------------------------------------------------------------------------------------------+
| auto_increment_increment                | 1                                                                                         |
| auto_increment_offset                   | 1                                                                                         |
| autocommit                              | ON                                                                                        |
| automatic_sp_privileges                 | ON                                                                                        |
| back_log                                | 50                                                                                        |
| basedir                                 | /opt/mysql5158/                                                                           |
| big_tables                              | OFF                                                                                       |
| binlog_cache_size                       | 1048576                                                                                   |
| binlog_direct_non_transactional_updates | OFF                                                                                       |
| binlog_format                           | MIXED                                                                                     |
| bulk_insert_buffer_size                 | 67108864                                                                                  |
| character_set_client                    | utf8                                                                                      |
| character_set_connection                | utf8                                                                                      |
| character_set_database                  | utf8                                                                                      |
| character_set_filesystem                | binary                                                                                    |
| character_set_results                   | utf8                                                                                      |
| character_set_server                    | utf8                                                                                      |
| character_set_system                    | utf8                                                                                      |
| character_sets_dir                      | /opt/mysql5158/share/mysql/charsets/                                                      |
| collation_connection                    | utf8_general_ci                                                                           |
| collation_database                      | utf8_general_ci                                                                           |
| collation_server                        | utf8_general_ci                                                                           |
| completion_type                         | 0                                                                                         |
| concurrent_insert                       | 1                                                                                         |
| connect_timeout                         | 10                                                                                        |
| datadir                                 | /opt/mysql5158/data/                                                                      |
| date_format                             | %Y-%m-%d                                                                                  |
| datetime_format                         | %Y-%m-%d %H:%i:%s                                                                         |
| default_week_format                     | 0                                                                                         |
| delay_key_write                         | ON                                                                                        |
| delayed_insert_limit                    | 100                                                                                       |
| delayed_insert_timeout                  | 300                                                                                       |
| delayed_queue_size                      | 1000                                                                                      |
| div_precision_increment                 | 4                                                                                         |
| engine_condition_pushdown               | ON                                                                                        |
| error_count                             | 0                                                                                         |
| event_scheduler                         | ON                                                                                        |
| expire_logs_days                        | 0                                                                                         |
| flush                                   | OFF                                                                                       |
| flush_time                              | 0                                                                                         |
| foreign_key_checks                      | ON                                                                                        |
| ft_boolean_syntax                       | + -><()~*:""&|                                                                            |
| ft_max_word_len                         | 84                                                                                        |
| ft_min_word_len                         | 4                                                                                         |
| ft_query_expansion_limit                | 20                                                                                        |
| ft_stopword_file                        | (built-in)                                                                                |
| general_log                             | ON                                                                                        |
| general_log_file                        | /opt/mysql5158/data/alpha.log                                                             |
| group_concat_max_len                    | 1024                                                                                      |
| have_community_features                 | YES                                                                                       |
| have_compress                           | YES                                                                                       |
| have_crypt                              | YES                                                                                       |
| have_csv                                | YES                                                                                       |
| have_dynamic_loading                    | YES                                                                                       |
| have_geometry                           | YES                                                                                       |
| have_innodb                             | YES                                                                                       |
| have_ndbcluster                         | NO                                                                                        |
| have_openssl                            | NO                                                                                        |
| have_partitioning                       | YES                                                                                       |
| have_query_cache                        | YES                                                                                       |
| have_rtree_keys                         | YES                                                                                       |
| have_ssl                                | NO                                                                                        |
| have_symlink                            | YES                                                                                       |
| hostname                                | alpha.site.net                                                                            |
| identity                                | 0                                                                                         |
| ignore_builtin_innodb                   | OFF                                                                                       |
| init_connect                            |                                                                                           |
| init_file                               |                                                                                           |
| init_slave                              |                                                                                           |
| innodb_adaptive_flushing                | ON                                                                                        |
| innodb_adaptive_hash_index              | ON                                                                                        |
| innodb_additional_mem_pool_size         | 16777216                                                                                  |
| innodb_autoextend_increment             | 8                                                                                         |
| innodb_autoinc_lock_mode                | 1                                                                                         |
| innodb_buffer_pool_size                 | 2147483648                                                                                |
| innodb_change_buffering                 | inserts                                                                                   |
| innodb_checksums                        | ON                                                                                        |
| innodb_commit_concurrency               | 0                                                                                         |
| innodb_concurrency_tickets              | 500                                                                                       |
| innodb_data_file_path                   | ibdata1:10M:autoextend                                                                    |
| innodb_data_home_dir                    |                                                                                           |
| innodb_doublewrite                      | ON                                                                                        |
| innodb_fast_shutdown                    | 1                                                                                         |
| innodb_file_format                      | Barracuda                                                                                 |
| innodb_file_format_check                | Barracuda                                                                                 |
| innodb_file_per_table                   | ON                                                                                        |
| innodb_flush_log_at_trx_commit          | 1                                                                                         |
| innodb_flush_method                     |                                                                                           |
| innodb_force_recovery                   | 0                                                                                         |
| innodb_io_capacity                      | 200                                                                                       |
| innodb_lock_wait_timeout                | 120                                                                                       |
| innodb_locks_unsafe_for_binlog          | OFF                                                                                       |
| innodb_log_buffer_size                  | 8388608                                                                                   |
| innodb_log_file_size                    | 268435456                                                                                 |
| innodb_log_files_in_group               | 3                                                                                         |
| innodb_log_group_home_dir               | ./                                                                                        |
| innodb_max_dirty_pages_pct              | 90                                                                                        |
| innodb_max_purge_lag                    | 0                                                                                         |
| innodb_mirrored_log_groups              | 1                                                                                         |
| innodb_old_blocks_pct                   | 37                                                                                        |
| innodb_old_blocks_time                  | 0                                                                                         |
| innodb_open_files                       | 300                                                                                       |
| innodb_read_ahead_threshold             | 56                                                                                        |
| innodb_read_io_threads                  | 4                                                                                         |
| innodb_replication_delay                | 0                                                                                         |
| innodb_rollback_on_timeout              | OFF                                                                                       |
| innodb_spin_wait_delay                  | 6                                                                                         |
| innodb_stats_on_metadata                | ON                                                                                        |
| innodb_stats_sample_pages               | 8                                                                                         |
| innodb_strict_mode                      | OFF                                                                                       |
| innodb_support_xa                       | ON                                                                                        |
| innodb_sync_spin_loops                  | 30                                                                                        |
| innodb_table_locks                      | ON                                                                                        |
| innodb_thread_concurrency               | 16                                                                                        |
| innodb_thread_sleep_delay               | 10000                                                                                     |
| innodb_use_sys_malloc                   | ON                                                                                        |
| innodb_version                          | 1.0.6                                                                                     |
| innodb_write_io_threads                 | 4                                                                                         |
| insert_id                               | 0                                                                                         |
| interactive_timeout                     | 28800                                                                                     |
| join_buffer_size                        | 8388608                                                                                   |
| keep_files_on_create                    | OFF                                                                                       |
| key_buffer_size                         | 33554432                                                                                  |
| key_cache_age_threshold                 | 300                                                                                       |
| key_cache_block_size                    | 1024                                                                                      |
| key_cache_division_limit                | 100                                                                                       |
| language                                | /opt/mysql5158/share/mysql/english/                                                       |
| large_files_support                     | ON                                                                                        |
| large_page_size                         | 0                                                                                         |
| large_pages                             | OFF                                                                                       |
| last_insert_id                          | 0                                                                                         |
| lc_time_names                           | en_US                                                                                     |
| license                                 | GPL                                                                                       |
| local_infile                            | ON                                                                                        |
| locked_in_memory                        | OFF                                                                                       |
| log                                     | ON                                                                                        |
| log_bin                                 | ON                                                                                        |
| log_bin_trust_function_creators         | OFF                                                                                       |
| log_bin_trust_routine_creators          | OFF                                                                                       |
| log_error                               | /opt/mysql5158/mysqld.log                                                                 |
| log_output                              | FILE                                                                                      |
| log_queries_not_using_indexes           | ON                                                                                        |
| log_slave_updates                       | OFF                                                                                       |
| log_slow_queries                        | ON                                                                                        |
| log_warnings                            | 2                                                                                         |
| long_query_time                         | 2.000000                                                                                  |
| low_priority_updates                    | OFF                                                                                       |
| lower_case_file_system                  | OFF                                                                                       |
| lower_case_table_names                  | 0                                                                                         |
| max_allowed_packet                      | 16777216                                                                                  |
| max_binlog_cache_size                   | 4294963200                                                                                |
| max_binlog_size                         | 1073741824                                                                                |
| max_connect_errors                      | 10                                                                                        |
| max_connections                         | 100                                                                                       |
| max_delayed_threads                     | 20                                                                                        |
| max_error_count                         | 64                                                                                        |
| max_heap_table_size                     | 67108864                                                                                  |
| max_insert_delayed_threads              | 20                                                                                        |
| max_join_size                           | 4294967295                                                                                |
| max_length_for_sort_data                | 1024                                                                                      |
| max_long_data_size                      | 16777216                                                                                  |
| max_prepared_stmt_count                 | 16382                                                                                     |
| max_relay_log_size                      | 0                                                                                         |
| max_seeks_for_key                       | 4294967295                                                                                |
| max_sort_length                         | 1024                                                                                      |
| max_sp_recursion_depth                  | 0                                                                                         |
| max_tmp_tables                          | 32                                                                                        |
| max_user_connections                    | 0                                                                                         |
| max_write_lock_count                    | 4294967295                                                                                |
| min_examined_row_limit                  | 0                                                                                         |
| multi_range_count                       | 256                                                                                       |
| myisam_data_pointer_size                | 6                                                                                         |
| myisam_max_sort_file_size               | 10737418240                                                                               |
| myisam_mmap_size                        | 4294967295                                                                                |
| myisam_recover_options                  | DEFAULT                                                                                   |
| myisam_repair_threads                   | 1                                                                                         |
| myisam_sort_buffer_size                 | 134217728                                                                                 |
| myisam_stats_method                     | nulls_unequal                                                                             |
| myisam_use_mmap                         | OFF                                                                                       |
| net_buffer_length                       | 16384                                                                                     |
| net_read_timeout                        | 30                                                                                        |
| net_retry_count                         | 10                                                                                        |
| net_write_timeout                       | 60                                                                                        |
| new                                     | OFF                                                                                       |
| old                                     | OFF                                                                                       |
| old_alter_table                         | OFF                                                                                       |
| old_passwords                           | OFF                                                                                       |
| open_files_limit                        | 8192                                                                                      |
| optimizer_prune_level                   | 1                                                                                         |
| optimizer_search_depth                  | 62                                                                                        |
| optimizer_switch                        | index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on |
| pid_file                                | /opt/mysql5158/data/alpha.site.net.pid                                                    |
| plugin_dir                              | /opt/mysql5158/lib/mysql/plugin                                                           |
| port                                    | 3306                                                                                      |
| preload_buffer_size                     | 32768                                                                                     |
| profiling                               | OFF                                                                                       |
| profiling_history_size                  | 15                                                                                        |
| protocol_version                        | 10                                                                                        |
| pseudo_thread_id                        | 0                                                                                         |
| query_alloc_block_size                  | 8192                                                                                      |
| query_cache_limit                       | 2097152                                                                                   |
| query_cache_min_res_unit                | 4096                                                                                      |
| query_cache_size                        | 67108864                                                                                  |
| query_cache_type                        | ON                                                                                        |
| query_cache_wlock_invalidate            | OFF                                                                                       |
| query_prealloc_size                     | 8192                                                                                      |
| rand_seed1                              |                                                                                           |
| rand_seed2                              |                                                                                           |
| range_alloc_block_size                  | 4096                                                                                      |
| read_buffer_size                        | 2097152                                                                                   |
| read_only                               | OFF                                                                                       |
| read_rnd_buffer_size                    | 16777216                                                                                  |
| relay_log                               |                                                                                           |
| relay_log_index                         |                                                                                           |
| relay_log_info_file                     | relay-log.info                                                                            |
| relay_log_purge                         | ON                                                                                        |
| relay_log_space_limit                   | 0                                                                                         |
| report_host                             |                                                                                           |
| report_password                         |                                                                                           |
| report_port                             | 3306                                                                                      |
| report_user                             |                                                                                           |
| rpl_recovery_rank                       | 0                                                                                         |
| secure_auth                             | OFF                                                                                       |
| secure_file_priv                        |                                                                                           |
| server_id                               | 1                                                                                         |
| skip_external_locking                   | ON                                                                                        |
| skip_name_resolve                       | OFF                                                                                       |
| skip_networking                         | OFF                                                                                       |
| skip_show_database                      | OFF                                                                                       |
| slave_compressed_protocol               | OFF                                                                                       |
| slave_exec_mode                         | STRICT                                                                                    |
| slave_load_tmpdir                       | /tmp                                                                                      |
| slave_net_timeout                       | 3600                                                                                      |
| slave_skip_errors                       | OFF                                                                                       |
| slave_transaction_retries               | 10                                                                                        |
| slow_launch_time                        | 2                                                                                         |
| slow_query_log                          | ON                                                                                        |
| slow_query_log_file                     | /opt/mysql5158/data/alpha-slow.log                                                        |
| socket                                  | /home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock                                    |
| sort_buffer_size                        | 8388608                                                                                   |
| sql_auto_is_null                        | ON                                                                                        |
| sql_big_selects                         | ON                                                                                        |
| sql_big_tables                          | OFF                                                                                       |
| sql_buffer_result                       | OFF                                                                                       |
| sql_log_bin                             | ON                                                                                        |
| sql_log_off                             | OFF                                                                                       |
| sql_log_update                          | ON                                                                                        |
| sql_low_priority_updates                | OFF                                                                                       |
| sql_max_join_size                       | 4294967295                                                                                |
| sql_mode                                |                                                                                           |
| sql_notes                               | ON                                                                                        |
| sql_quote_show_create                   | ON                                                                                        |
| sql_safe_updates                        | OFF                                                                                       |
| sql_select_limit                        | 4294967295                                                                                |
| sql_slave_skip_counter                  |                                                                                           |
| sql_warnings                            | OFF                                                                                       |
| ssl_ca                                  |                                                                                           |
| ssl_capath                              |                                                                                           |
| ssl_cert                                |                                                                                           |
| ssl_cipher                              |                                                                                           |
| ssl_key                                 |                                                                                           |
| storage_engine                          | InnoDB                                                                                    |
| sync_binlog                             | 0                                                                                         |
| sync_frm                                | ON                                                                                        |
| system_time_zone                        | EST                                                                                       |
| table_definition_cache                  | 256                                                                                       |
| table_lock_wait_timeout                 | 50                                                                                        |
| table_open_cache                        | 2048                                                                                      |
| table_type                              | InnoDB                                                                                    |
| thread_cache_size                       | 8                                                                                         |
| thread_handling                         | one-thread-per-connection                                                                 |
| thread_stack                            | 196608                                                                                    |
| time_format                             | %H:%i:%s                                                                                  |
| time_zone                               | SYSTEM                                                                                    |
| timed_mutexes                           | OFF                                                                                       |
| timestamp                               | 1316294017                                                                                |
| tmp_table_size                          | 67108864                                                                                  |
| tmpdir                                  | /tmp                                                                                      |
| transaction_alloc_block_size            | 8192                                                                                      |
| transaction_prealloc_size               | 4096                                                                                      |
| tx_isolation                            | REPEATABLE-READ                                                                           |
| unique_checks                           | ON                                                                                        |
| updatable_views_with_limit              | YES                                                                                       |
| version                                 | 5.1.58-log                                                                                |
| version_comment                         | Source distribution                                                                       |
| version_compile_machine                 | i686                                                                                      |
| version_compile_os                      | pc-linux-gnu                                                                              |
| wait_timeout                            | 28800                                                                                     |
| warning_count                           | 0                                                                                         |
+-----------------------------------------+-------------------------------------------------------------------------------------------+
289 rows in set (0.32 sec)

mysql> exit
Bye
[(04:13 PM)][(root@alpha)] [(~)] $

Open in new window