khanbaba

Member
Oct 12, 2006
9
0
151
Hello,

We have websites that are mainly php/mysql driven and website is getting good amount of traffic.

Please suggest changes to improve the performance.

Server Spec is:

Intel Xeon CPU E3-1230 V2 @ 3.30GHz with 8GB of Ram


Code:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_allowed_packet=100M
thread_stack=3M
max_connections=600
max_user_connections=50
ft_min_word_len=3
wait_timeout=50
connect_timeout =30
interactive-timeout = 30
skip-locking
skip-innodb
table_cache = 1500K
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 24M
thread_cache = 8
thread_cache_size = 16M
query_cache_size = 12M
query_cache_min_res_unit = 2K
log-slow-queries = /var/log/slow.log
long_query_time = 2
tmp_table_size=32M
max_heap_table_size=32M
record_buffer=8M
sort_buffer_size=8M ## 1MB for every 1GB of RAM
read_buffer_size=8M ## 1MB for every 1GB of RAM
read_rnd_buffer_size=8M  ## 1MB for every 1GB of RAM

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192

#[mysqldump]
#quick
max_allowed_packet=32M

[mysql]
no-auto-rehash

[isamchk]
key_buffer=16M
sort_buffer=16M
read_buffer=8M
write_buffer=8M

[myisamchk]
key_buffer=16M
sort_buffer=16M
read_buffer=8M
write_buffer=8M

[mysqlhotcopy]
interactive-timeout

local-infile=0
 

Astral God

Well-Known Member
Sep 27, 2010
180
0
66
127.0.0.1
cPanel Access Level
Root Administrator
Have you tried the tool from the post pf Infropro or anoher one like MySQLTuner ?

If no, start from there as it will be impossible to help you without some stats/snapshot of your server - those tools perform these.
 

khanbaba

Member
Oct 12, 2006
9
0
151
Here is result of tunning script:


[email protected] [/usr/local/src]# ./tuning-primer.sh

-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.5.27-cll x86_64

Uptime = 1 days 21 hrs 0 min 49 sec
Avg. qps = 120
Total Questions = 19568532
Threads Connected = 4

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

To find out more information on how each of these
runtime variables effects performance visit:
MySQL :: MySQL 5.5 Reference Manual :: 5.1.4 Server System Variables
Visit MySQL :: MySQL Enterprise Advisors
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 2.000000 sec.
You have 38 out of 19568597 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 NOT enabled.
You will not be able to do point in time recovery
See MySQL :: MySQL 5.5 Reference Manual :: 7.5 Point-in-Time (Incremental) Recovery Using the Binary Log

WORKER THREADS
Current thread_cache_size = 128
Current threads_cached = 26
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 = 3
Historic max_used_connections = 29
The number of used connections is 5% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 240 K
Current InnoDB data space = 272 K
Current InnoDB buffer pool free = 99 %
Current innodb_buffer_pool_size = 1.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 : 2.20 G
Configured Max Per-thread Buffers : 17.21 G
Configured Max Global Buffers : 1.20 G
Configured Max Memory Limit : 18.41 G
Physical Memory : 7.77 G

Max memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 179 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 33211
Key buffer free ratio = 59 %
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 = 64 M
Current query_cache_used = 43 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 68.60 %
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 = 2 M
Current read_rnd_buffer_size = 1 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 12.00 M
You have had 1792 queries where a join could not use an index properly
You have had 969 joins without keys that check for key usage after each row
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 = 2000 tables
You have a total of 1586 tables
You have 1762 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 128 M
Current tmp_table_size = 128 M
Of 644831 temp tables, 21% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 20 M
Current table scan ratio = 2516 : 1
read_buffer_size is over 8 MB there is probably no need for such a large read_buffer

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