Skocz do zawartości

Web Hosting Talk

  • dhosting.pl

    Partner technologiczny

    Dostarczamy profesjonalne i niezawodne rozwiązania hostingowe dla firm oraz osób prywatnych. Zaufali nam wymagający klienci, którzy cenią sobie nasze indywidualne podejście.
  • Kei.pl

    Partner technologiczny

    Kei.pl działa na polskim rynku internetowym od 2000 roku. Obecnie na blisko 300 serwerach w Centrum Danych Kei.pl znajduje się kilkadziesiąt tysięcy stron WWW.
  • S-NET.info

    Partner technologiczny

    S-NET to dostawca usług dla biznesu. Najważniejsze usługi świadczone przez firmę to usługi Centrum Danych, dostęp do Internetu, transmisja danych oraz tranzyt do różnych operatorów.
  • Network Communication

    Partner technologiczny

    Jest wiodącym dostawcą usług przetwarzania danych, dysponującym własnym, a zarazem jednym z największych komercyjnych obiektów DataCenter w Polsce.

 

Optymalizacja my.cnf


  • Nie możesz odpowiadać w tym temacie
8 odpowiedzi na ten temat

Optymalizacja my.cnf

#1 pitu

    Stały użytkownik

  • Użytkownicy
  • PipPipPipPipPip
  • 150 postów

Napisany 04 marzec 2010 - 12:29

Witam

Prosiłbym o porady dotyczące optymalnego ustawienia my.cnf

Serwer:
2GB pamięci
2x2,8GHz procesor

Bazy danych:
1. ok. 300MB - baza forum vBulletin
2. ok. 150MB - baza forum vBulletin
3. ok. 100MB - baza CMS DataLife Engine
4. ok. 10MB - baza OSCommerce
5. ok. 6MB - baza OSCommerce

Pamięć wolna to ponad 1GB tak więc gdzie mógłbym zwiększyć wartość?

[mysqld]
bind-address=127.0.0.1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=3000
max_user_connections=600
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=128M
join_buffer_size=2M
max_allowed_packet=32M
table_cache=1024
sort_buffer_size=2M
read_buffer_size=2M
read_rnd_buffer_size=1536K
max_connect_errors=10
thread_concurrency=4
myisam_sort_buffer_size=64M
skip-locking
server-id=1

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf
–log-slow-queries=/var/log/slow-queries.log”

#[mysqldump]
#quick
#max_allowed_packet=16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer=128M
sort_buffer=128M
read_buffer=32M
write_buffer=32M

[myisamchk]
key_buffer=128M
sort_buffer=128M
read_buffer=32M
write_buffer=32M

[mysqlhotcopy]
interactive-timeout

Wynik z Tuning Primer
 	-- MYSQL PERFORMANCE TUNING PRIMER --
 	- By: Matthew Montgomery -

MySQL Version 5.0.45 i686

Uptime = 0 days 0 hrs 13 min 12 sec
Avg. qps = 112
Total Questions = 88735
Threads Connected = 6

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

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

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 0 out of 88775 that take longer than 10 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.0/en/point-in-time-recovery.html

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

MAX CONNECTIONS
Current max_connections = 3000
Current threads_connected = 6
Historic max_used_connections = 11
The number of used connections is 0% 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 = 2 M
Current InnoDB data space = 2 M
Current InnoDB buffer pool free = 29 %
Current innodb_buffer_pool_size = 8 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 254 M
Configured Max Per-thread Buffers : 22.48 G
Configured Max Global Buffers : 170 M
Configured Max Memory Limit : 22.65 G
Physical Memory : 1.95 G

nMax memory limit exceeds 90% of physical memory

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

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 9 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 29.44 %
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 = 2.00 M
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 15000 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 = 1024 tables
You have a total of 1508 tables
You have 1024 open tables.
Current table_cache hit rate is 21%
, 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 1382 temp tables, 1% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 4134 : 1
You have a high ratio of sequential access requests to SELECTs
You may benefit from raising read_buffer_size and/or improving your use of indexes.

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


#2 BlueMan

    Programista

  • WHT Pro
  • PipPipPipPipPipPipPipPip
  • 1172 postów
  • Skąd:Sosnowiec
  • Imię:Szymon

Napisany 04 marzec 2010 - 13:03

tuning primer wszystko ci mówi przecież. W czym problem, bo nie rozumiem :|
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Zbieram punkty______________________________________________\/

PS. Co jest do wygrania? xD

#3 hemi

    Nowy użytkownik

  • Użytkownicy
  • 21 postów

Napisany 04 marzec 2010 - 13:42

Uptime = 0 days 0 hrs 13 min 12 sec

tuning-primer powie dużo, ale na pewno nie po 13 minutach od włączenia mysql ;)

#4 BlueMan

    Programista

  • WHT Pro
  • PipPipPipPipPipPipPipPip
  • 1172 postów
  • Skąd:Sosnowiec
  • Imię:Szymon

Napisany 04 marzec 2010 - 14:05

Co zresztą sam tuner-primer mówi

Cytuj

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations
Więc czego autorze od nas oczekujesz, skoro sam nie przeczytałeś nawet tego co masz na ekranie?!
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Zbieram punkty______________________________________________\/

PS. Co jest do wygrania? xD

#5 pitu

    Stały użytkownik

  • Użytkownicy
  • PipPipPipPipPip
  • 150 postów

Napisany 04 marzec 2010 - 18:29

Przegapiłem informację, za dwa dni odpalę jeszcze raz i spróbuję sam coś działać oraz dam tutaj wynik.

Pozdrawiam

#6 pitu

    Stały użytkownik

  • Użytkownicy
  • PipPipPipPipPip
  • 150 postów

Napisany 06 marzec 2010 - 21:30

Nowy wynik z Tunera, trochę go przejrzałem nie do końca wiem co mogę poprawić, np. jak piszę, że dana wartość ustawiona za duża na ile zmniejszyć itp.:
 	-- MYSQL PERFORMANCE TUNING PRIMER --
 	- By: Matthew Montgomery -

MySQL Version 5.0.45 i686

Uptime = 2 days 9 hrs 4 min 49 sec
Avg. qps = 108
Total Questions = 22201301
Threads Connected = 2

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.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 69 out of 22201342 that take longer than 10 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.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 128
Current threads_cached = 63
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 3000
Current threads_connected = 3
Historic max_used_connections = 66
The number of used connections is 2% 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 = 2 M
Current InnoDB data space = 2 M
Current InnoDB buffer pool free = 23 %
Current innodb_buffer_pool_size = 8 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 676 M
Configured Max Per-thread Buffers : 22.48 G
Configured Max Global Buffers : 170 M
Configured Max Memory Limit : 22.65 G
Physical Memory : 1.95 G

nMax memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 238 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 36859
Key buffer free ratio = 47 %
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 = 23 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 72.90 %
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 = 2.00 M
You have had 448 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 = 15000 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 = 1024 tables
You have a total of 1508 tables
You have 1024 open tables.
Current table_cache hit rate is 7%
, 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 252749 temp tables, 1% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

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

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


#7 BlueMan

    Programista

  • WHT Pro
  • PipPipPipPipPipPipPipPip
  • 1172 postów
  • Skąd:Sosnowiec
  • Imię:Szymon

Napisany 06 marzec 2010 - 21:48

Wszystko na oko zmniejszaj ;) i testuj co 48 h
Wynik zwraca wartość jaką masz ustawioną i jaką wykorzystujesz. Zmniejsz na tyle, aby było trochę więcej niż wykorzystujesz.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Zbieram punkty______________________________________________\/

PS. Co jest do wygrania? xD

#8 hemi

    Nowy użytkownik

  • Użytkownicy
  • 21 postów

Napisany 06 marzec 2010 - 21:49

Current innodb_buffer_pool_size = 8 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

Current table_cache value = 1024 tables
You have a total of 1508 tables
You have 1024 open tables.
Current table_cache hit rate is 7%
, while 100% of your table cache is in use
You should probably increase your table_cache


Nie rozumiem co tu jest niezrozumiałe ;>. Mógłbyś też włączyć slow query log bo widać, że 69 zapytań trwało dłużej niż 10sek (no chyba, że te zapytania mają się tyle wykonywać?). Skrypt sugeruje też zmniejszenie max_connections, jednak generalnie nie zrobi ci to dużej różnicy.

#9 malu

    Hello Kitty!

  • WHT Pro
  • PipPipPipPipPipPipPipPip
  • 1320 postów
  • Skąd:Leszno
  • Imię:Mateusz
  • Nazwisko:Adach

Napisany 06 marzec 2010 - 23:00

Zobacz posthemicalyaction, o 06 marzec 2010 - 21:49, powiedział:

Skrypt sugeruje też zmniejszenie max_connections, jednak generalnie nie zrobi ci to dużej różnicy.


Różnica będzie taka, że inną wartość maksymalnie zaalokowanej pamięci przyjmie MySQL ;)
I w sumie to dobrze jest ustawiać wartość odpowiednią, a nie zawyżoną.
Polecam:
Hosting współdzielony @ ViPower.pl
Serwery VPS @ ViHost.pl





1 Użytkowników czyta ten temat

0 użytkowników, 1 gości, 0 anonimowych użytkowników