langsamer und schneller mysql-server

MySQL, PostgreSQL, SQLite
synoo
Posts: 21
Joined: 2005-03-13 15:42

langsamer und schneller mysql-server

Post by synoo » 2005-07-27 21:28

Hallo,
habe mehrere Millionen daten und normallerweise geht die suche sehr schnell. 400.000 ergebnisse in 2-3 sekunden und die CPU und Mem Power geht auch hoch, was ja gut ist. Jetzt kommt es häufiger vor das die suche sehr lange dauert und die CPU-Power steigt nicht höher alls 3%. Nun weiß ich nicht wieso die datenbank abbremsen.

Habe mysql 4.1.12

Danke in voraus

User avatar
Joe User
Project Manager
Project Manager
Posts: 11139
Joined: 2003-02-27 01:00
Location: Hamburg

Re: langsamer und schneller mysql-server

Post by Joe User » 2005-07-28 09:37

Wieviel RAM hat die Kiste und wie sieht die my.cnf aus?
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

synoo
Posts: 21
Joined: 2005-03-13 15:42

Re: langsamer und schneller mysql-server

Post by synoo » 2005-07-28 17:29

Der server hat 1 Giga Arbeitsspeicher.

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

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

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
port = 3306
set-variable = key_buffer_size = 384M
set-variable = sort_buffer_size = 12M
set-variable = read_buffer_size = 12M
set-variable = max_allowed_packet = 2M
set-variable = max_connections = 2000
set-variable = thread_cache = 1024
set-variable = table_cache = 6048
set-variable = query_cache_type = 1
set-variable = query_cache_size = 12M
set-variable = query_cache_limit = 20M

[mysqldump]
quick
max_allowed_packet = 48M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer_size = 4M
write_buffer_size = 4M

outofbound
Posts: 470
Joined: 2002-05-14 13:02
Location: Karlsruhe City

Re: langsamer und schneller mysql-server

Post by outofbound » 2005-07-28 18:05

a) Speicher (swappt)
b) Platte zu langsam
c) Optimizer kaputt
d) DB- Statistiken im Eimer (Löcher im phys. Datenbestand).
e) Race Conditions
f) Deadlocks

Genauer gehts leider net.

Gruss,

Out

synoo
Posts: 21
Joined: 2005-03-13 15:42

Re: langsamer und schneller mysql-server

Post by synoo » 2005-07-28 18:18

Danke für die antwort,

wie sieht das mit der my.cnf aus, ist die richtig eingestellt oder habt Ihr Verbesserungsvorschläge.

kawfy
Posts: 307
Joined: 2002-08-08 23:45

Slow-Logs

Post by kawfy » 2005-07-29 00:40

:idea: aktiviere das Slow-Log und analysiere die Queries, die im Log landen. (dja-vu?:) )

User avatar
Joe User
Project Manager
Project Manager
Posts: 11139
Joined: 2003-02-27 01:00
Location: Hamburg

Re: langsamer und schneller mysql-server

Post by Joe User » 2005-07-29 09:37

Versuche es mal folgender my.cnf (Pfade anpassen!):

Code: Select all

[client]
port                  = 3306
socket                = /var/run/mysqld/mysqld.sock

[mysqld_safe]
err-log               = /var/log/mysql/mysql.err

[mysqld]
user                  = mysql
pid-file              = /var/run/mysqld/mysqld.pid
socket                = /var/run/mysqld/mysqld.sock
log-error             = /var/log/mysql/mysqld.err
basedir               = /usr
datadir               = /var/lib/mysql
tmpdir                = /tmp
language              = /usr/share/mysql/english
bind-address          = 127.0.0.1
port                  = 3306
server-id             = 1
skip-locking
skip-networking
skip-name-resolve
skip-external-locking
local-infile = 0
key_buffer_size = 64M
sort_buffer_size = 4M
read_buffer_size = 1M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
max_allowed_packet = 16M
net_buffer_length = 8K
thread_stack = 128K
thread_cache = 8
table_cache = 256
query_cache_type = 1
query_cache_size = 16M
query_cache_limit = 1M
thread_concurrency = 2
skip-innodb
innodb_buffer_pool_size = 32M
innodb_additional_mem_pool_size = 4M
innodb_data_home_dir = /var/lib/mysql/
innodb_log_arch_dir = /var/lib/mysql/
innodb_log_group_home_dir = /var/lib/mysql/
innodb_data_file_path = ibdata1:10M:autoextend:max:128M
innodb_log_file_size = 8M
innodb_log_buffer_size = 8M
innodb_log_files_in_group = 2
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
#bdb_cache_size = 4M
#bdb_max_lock = 10000

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
#no-auto-rehash
#safe-updates

[isamchk]
key_buffer_size = 64M
sort_buffer_size = 4M
read_buffer_size = 1M
write_buffer_size = 1M

[myisamchk]
key_buffer_size = 64M
sort_buffer_size = 4M
read_buffer_size = 1M
write_buffer_size = 1M

[mysqlhotcopy]
interactive-timeout
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.