Server Extrem langsam

meyersudden

New Member
Hallo Leute,

weiß mir langsam nicht mehr mit meinem Server zu helfen. Habe das tuning Script für MySQL drüber laufen lassen und die Einstellungen verbessert. Bei hohen Zugriffszahlen geht der Server immer in die Knie. Ein Seitenaufbau kann sich dann mal bis auf 2 min hinziehen. Ich spreche von ca. 100-200 Usern.

Daten des Servers: AMD Athlon 64 X2 BE-2350, DualCore 64 Bit, 3.072 MB DDR2-RAM, 2x 160 GB SATA-HDD, Betriebssystem: OpenSuSE,

Bei den Einstellungen verwendet der Server auch nicht den zur Verfügung stehenden Ram: 797212k used, 2298192k free

Meine Aktuelle my.conf Einstellung:

Code:
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# 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.

# The following options will be passed to all MySQL clients
[client]
#password	= your_password
port		= 3306
socket		= /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
key_buffer = 1024M
tmp_table_size = 900M
long_query_time = 3
query_cache_size = 2M
max_allowed_packet = 2M
table_cache = 920
thread_cache_size = 256
sort_buffer_size = 8M
join_buffer = 3M
record_buffer = 3M
myisam_sort_buffer_size = 8M
net_buffer_length = 24K
read_buffer_size = 1024K
read_rnd_buffer_size = 2048K
max_connections = 400
connect_timeout = 5
wait_timeout = 120
interactive_timeout = 180

# 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

# Replication Master Server (default)
# binary logging is required for replication
# log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if 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
#    change in this file to the variables' 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>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
#tmpdir		= /tmp/		
#log-update 	= /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

# The safe_mysqld script
[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 = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

Wenn ich den Befehl TOP eingebe wird mir angezeigt das der Server gerademal 750 MB von 3 GB Arbeitsspeicher verwendet. Ich hoffe jemand von Euch kann mir helfen.

Wäre demjenigen zu ewigem Dank verpflichtet. Gerne könnt ihr mich auch per ICQ kontaktieren. 154136066

Tim

Code:
Tasks: 121 total,   1 running, 120 sleeping,   0 stopped,   0 zombie
Cpu(s): 22.2% us,  3.5% sy,  0.0% ni, 74.3% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:   3095404k total,   797212k used,  2298192k free,    62552k buffers
Swap:  2104496k total,        0k used,  2104496k free,   472008k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 8600 mysql     15   0  116m  24m 4768 S   45  0.8   9:18.78 mysqld-max
 8875 wwwrun    15   0 87320  22m 9624 S    2  0.7   0:00.18 httpd2-prefork
 8768 wwwrun    15   0 87468  22m 9660 S    1  0.7   0:02.13 httpd2-prefork
 8769 wwwrun    15   0 88500  23m 9432 S    1  0.8   0:02.50 httpd2-prefork
 8876 wwwrun    16   0 86968  19m 7640 S    1  0.7   0:00.25 httpd2-prefork
    4 root      RT   0     0    0    0 S    0  0.0   0:00.17 migration/1
 8522 wwwrun    15   0 87052  22m  10m S    0  0.8   0:00.70 httpd2-prefork
    1 root      16   0   720  284  244 S    0  0.0   0:00.81 init

Ausgabe des Tuning Scripts:

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

MySQL Version 5.0.18-Max i686

Uptime = 2 days 5 hrs 14 min 25 sec
Avg. qps = 64
Total Questions = 55875
Threads Connected = 2

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

SLOW QUERIES
Current long_query_time = 3 sec.
You have 67 out of 55875 that take longer than 3 sec. to complete
The slow query log is NOT enabled.
Your long_query_time seems to be fine

MAX CONNECTIONS
Current max_connections = 400
Current threads_connected = 2
Historic max_used_connections = 9
The number of used connections is 2% of the configured maximum.
Your max_connections variable seems to be fine.

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

MEMORY USAGE
/usr/bin/tuning.sh: line 994: let: expression expected
Max Memory Ever Allocated : 9302 M
Configured Max Memory Limit : 412886 M
Total System Memory : 5078 M

KEY BUFFER
Current MyISAM index space = 7 M
Current key_buffer_size = 1024 K
Key cache miss rate is 1 / 4615
Key buffer fill ratio = 80.00 %
You could increase key_buffer_size
It is safe to raise this up to 1/4 of total system memory;
assuming this is a dedicated database server.

QUERY CACHE
Query cache is enabled
Current query_cache_size = 2 M
Current query_cache_used = 989.97 K
Current Query cache fill ratio = 48.33 %

SORT OPERATIONS
Current sort_buffer_size = 8 M
Current record/read_rnd_buffer_size = 1 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2 M
You have had 560 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.

TABLE CACHE
Current table_cache value = 920 tables
You have a total of 600 tables
You have 645 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current tmp_table_size = 786 M
34% of tmp tables created were disk based
Perhaps you should increase your tmp_table_size

TABLE SCANS
Current read_buffer_size = 512K
Current table scan ratio = 5999 : 1
read_buffer_size is over 2 MB there is probably no need for such a large read_buffer

TABLE LOCKING
Current Lock Wait ratio = 1 : 61
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 concurrentcy of inserts on Dynamic row-lenght tables consider setting 'concurrent_insert=2'.
 
Last edited by a moderator:
hier lesen

deine my.cnf Variables sind alle falsch eingestellt.

1. Anzahl der Apache httpd Prozesse (MaxClients) ermitteln und Apache RAM zuweisen.

2. restlicher RAM kann MySQL zur Verfügung gestellt werden (max_connections und die buffers/caches ect)

s.a.

Beispielkonfiguration (Server mit 1 GB RAM und ~ 50 gleichzeitigen Client Verbindungen)
 
Last edited by a moderator:
Back
Top