Hallo,
vielen Dank erstmal für den großartigen Support hier,
mir als Newbie haben schon viele Threads hier sehr geholfen!
Hier mein Prob:
Ich habe einen Strato-Rootserver DualCore 1,8 mit 1GB RAM,
darauf laufen einige Joomla CMS. Die normale Last liegt immer
so um 3-4, mit großen Spitzen auch unter Vollast.
Über Plesk Stats sehe ich, dass das RAM all-inkl. nur rund 45% genutzt
wird, es stehen also sicherlich noch 300MB + Overhead zur Verfügung.
Benötigt wird nur Apache / MySQL, Mails + Co. laufen auf einem eigenen Server.
MySQL meldet öfters "too many connects", aber mit einem einfachen
"max_connections = 300" in der my.cnf ist mein Prob wohl noch nicht behoben ;-)
Hier im Forum habe ich den Tuning-Primer entdeckt. Der spuckt
folgendes aus:
Dazu mein TOP:
und die my.cnf:
Das Slow-Log wirft auch einige Einträge aus, an der Query-
Programmierung kann ich aber leider nichts ändern.
Da ich in bezug auf MySQL Optimierung noch ganz am Anfang stehe
und das wohl auch eine ziemliche Kunst ist, bin ich für eine Hilfestellung
von den MySQL-Profis hier sehr dankbar.
Vielen Dank nochmals!
M.
vielen Dank erstmal für den großartigen Support hier,
mir als Newbie haben schon viele Threads hier sehr geholfen!
Hier mein Prob:
Ich habe einen Strato-Rootserver DualCore 1,8 mit 1GB RAM,
darauf laufen einige Joomla CMS. Die normale Last liegt immer
so um 3-4, mit großen Spitzen auch unter Vollast.
Über Plesk Stats sehe ich, dass das RAM all-inkl. nur rund 45% genutzt
wird, es stehen also sicherlich noch 300MB + Overhead zur Verfügung.
Benötigt wird nur Apache / MySQL, Mails + Co. laufen auf einem eigenen Server.
MySQL meldet öfters "too many connects", aber mit einem einfachen
"max_connections = 300" in der my.cnf ist mein Prob wohl noch nicht behoben ;-)
Hier im Forum habe ich den Tuning-Primer entdeckt. Der spuckt
folgendes aus:
HTML:
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 4.1.13-log i686
Uptime = 56 days 7 hrs 52 min 34 sec
Avg. qps = 130
Total Questions = 636940819
Threads Connected = 13
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/4.1/en/server-system-variables.html
SLOW QUERIES
Current long_query_time = 4 sec.
You have 326611 out of 636941301 that take longer than 4 sec. to complete
The slow query log is enabled.
Your long_query_time seems to be fine
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 = 9
Historic max_used_connections = 101
The number of used connections is 101% of the configured maximum.
You should raise max_connections
MEMORY USAGE
Max Memory Ever Allocated : 2 G
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 170 M
Configured Max Memory Limit : 2 G
Total System Memory : 2.97 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 37 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 8104
Key buffer fill ratio = 7.00 %
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 = 32 M
Current query_cache_used = 14 M
Current query_cach_limit = 1 M
Current Query cache fill ratio = 44.23 %
MySQL won't cache query results that are larger than query_cache_limit in size
SORT OPERATIONS
Current sort_buffer_size = 4 M
Current record/read_rnd_buffer_size = 7 M
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 4.00 M
You have had 879004 queries where a join could not use an index properly
You have had 1121 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 = 1024 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_cache value = 256 tables
You have a total of 699 tables
You have 256 open tables.
Current table_cache hit rate is 0%, while 100% of your table cache is in use
You should probably increase your table_cache
TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 4003211 temp tables, 86% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.
TABLE SCANS
Current read_buffer_size = 3 M
Current table scan ratio = 10 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 29
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'
Dazu mein TOP:
HTML:
top - 21:19:18 up 56 days, 10:26, 1 user, load average: 4.62, 3.63, 3.48
Tasks: 261 total, 1 running, 130 sleeping, 1 stopped, 129 zombie
Cpu(s): 38.1% us, 21.8% sy, 0.0% ni, 11.6% id, 27.3% wa, 0.2% hi, 1.0% si
Mem: 1017352k total, 912764k used, 104588k free, 47940k buffers
Swap: 2104496k total, 226748k used, 1877748k free, 221808k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5748 mysql 16 0 275m 75m 3456 S 55.3 7.6 19047:36 mysqld
27821 wwwrun 21 0 286m 20m 10m S 32.8 2.0 0:03.98 httpd2-prefork
27828 wwwrun 15 0 281m 10m 6504 S 4.6 1.1 0:00.14 httpd2-prefork
27704 wwwrun 15 0 286m 24m 15m S 4.0 2.4 0:06.06 httpd2-prefork
27824 wwwrun 16 0 282m 16m 11m S 3.0 1.6 0:00.68 httpd2-prefork
27785 wwwrun 16 0 281m 16m 12m S 2.3 1.7 0:00.21 httpd2-prefork
27814 wwwrun 16 0 281m 13m 9.9m S 2.3 1.4 0:00.26 httpd2-prefork
27840 wwwrun 15 0 280m 10m 7308 S 2.3 1.0 0:00.13 httpd2-prefork
27589 wwwrun 15 0 285m 28m 20m S 2.0 2.9 0:07.28 httpd2-prefork
27703 wwwrun 15 0 286m 24m 15m S 2.0 2.5 0:03.14 httpd2-prefork
27813 wwwrun 16 0 281m 11m 8056 S 2.0 1.2 0:00.31 httpd2-prefork
27765 wwwrun 15 0 285m 26m 18m S 1.7 2.7 0:03.13 httpd2-prefork
27837 wwwrun 15 0 280m 9816 6852 S 1.7 1.0 0:00.05 httpd2-prefork
1485 root 16 0 0 0 0 D 1.3 0.0 229:09.03 kjournald
27778 wwwrun 16 0 281m 15m 12m S 1.3 1.6 0:00.60 httpd2-prefork
27842 wwwrun 16 0 279m 8316 5784 S 0.7 0.8 0:00.02 httpd2-prefork
1474 root 15 0 0 0 0 D 0.3 0.0 215:30.33 md1_raid1
25348 root 16 0 9396 2920 2140 S 0.3 0.3 0:00.82 sshd
27794 wwwrun 15 0 286m 19m 10m S 0.3 2.0 0:01.07 httpd2-prefork
1 root 16 0 688 72 40 S 0.0 0.0 0:03.08 init
2 root RT 0 0 0 0 S 0.0 0.0 0:00.62 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.06 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:21.02 migration/1
5 root 34 19 0 0 0 S 0.0 0.0 0:00.60 ksoftirqd/1
6 root 10 -5 0 0 0 S 0.0 0.0 0:00.37 events/0
7 root 10 -5 0 0 0 S 0.0 0.0 0:00.08 events/1
8 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
9 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
18 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
542 root 10 -5 0 0 0 S 0.0 0.0 8:49.42 kblockd/0
543 root 10 -5 0 0 0 S 0.0 0.0 0:21.72 kblockd/1
593 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0
592 root 15 0 0 0 0 S 0.0 0.0 22:22.72 kswapd0
594 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 aio/1
1185 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod
1237 root 15 0 0 0 0 S 0.0 0.0 0:00.20 kirqd
1311 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 ata/0
1312 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 ata/1
1320 root 24 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0
1321 root 25 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1
1381 root 19 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_2
1383 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_3
1475 root 15 0 0 0 0 S 0.0 0.0 0:00.02 md0_raid1
2388 root 12 -4 2036 288 232 S 0.0 0.0 0:00.54 udevd
2739 root 20 0 0 0 0 S 0.0 0.0 0:00.00 shpchpd_event
2826 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
4324 messageb 16 0 3520 524 428 S 0.0 0.1 0:09.15 dbus-daemon
4840 root 16 0 1524 212 168 S 0.0 0.0 0:01.11 dhcpcd
5041 root 15 0 1892 620 416 S 0.0 0.1 1:13.03 syslog-ng
5044 root 16 0 1628 368 188 S 0.0 0.0 0:00.01 klogd
5075 root 16 0 1492 152 148 S 0.0 0.0 0:00.00 acpid
5301 root 16 0 2220 176 172 S 0.0 0.0 0:01.12 xinetd
5332 ntp 16 0 3972 3972 2940 S 0.0 0.4 0:08.16 ntpd
und die my.cnf:
HTML:
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
key_buffer_size = 128M
sort_buffer_size = 4M
join_buffer_size = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
max_allowed_packet = 16M
thread_cache_size = 8
table_cache = 256
query_cache_type = 1
query_cache_size = 32M
query_cache_limit = 1M
thread_concurrency = 8
local-infile = 0
long_query_time = 4
log_slow_queries
log_long_format
myisam_recover
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 4
skip-locking
skip-networking
skip-name-resolve
skip-external-locking
log-bin
sync_binlog = 1
max_binlog_size = 10M
expire_logs_days = 7
server-id = 1
[safe_mysqld]
err-log=/var/lib/mysql/mysqld.log
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer_size = 4M
write_buffer_size = 4M
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer_size = 4M
write_buffer_size = 4M
[mysqlhotcopy]
interactive-timeout
Das Slow-Log wirft auch einige Einträge aus, an der Query-
Programmierung kann ich aber leider nichts ändern.
Da ich in bezug auf MySQL Optimierung noch ganz am Anfang stehe
und das wohl auch eine ziemliche Kunst ist, bin ich für eine Hilfestellung
von den MySQL-Profis hier sehr dankbar.
Vielen Dank nochmals!
M.