Einstellung tunning-primer.sh

linux7.1

New Member
Wer kann mir beim fein einstellen helfen?

1und1 root server Opteron 175/ 1216, 2 x 2,2 GHz, 4 GB, 2x 250 GB

Es liegt ein Forum drauf wo gleichzeitig um die 1000 User online sind.

Bei 300 Usern fängt es aber schon an in lahmen.



my.cnf:

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]
set-variable=local-infile=0
port		= 3306
socket		= /var/lib/mysql/mysql.sock
skip-locking
key_buffer_size = 256M 
max_allowed_packet = 1M 
table_cache = 500 
sort_buffer_size = 16M 
read_buffer_size = 16M
join_buffer_size = 16M 
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 16M 
thread_cache_size = 16
query_cache_size = 128M 
query_cache_type = 1
log-slow-queries 
long_query_time = 4
connect_timeout = 6 
query_cache_limit = 8M
set-variable = max_connections=1000
skip_networking

# 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 = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

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

[mysqlhotcopy]
interactive-timeout
 
@ Firewire2002, darf ich dich per ICQ anschreiben?
Ja, ich habe gelesen, und das mehrmals. Und da ich das nicht gebacken bekomme, fragte ich ja nach Hilfe. Leider hat uns unserer Admin im Stich gelassen, und so muss ich mich aufs Eis begeben und es selbst versuchen. Das läuft so auf Hochtouren, dass oft beim Skript Fehlermeldungen kommen.

Code:
SLOW QUERIES
Current long_query_time = 4 sec.
You have 0 out of 85083 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 = 64
Current threads_cached = 13
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 = 14
Historic max_used_connections = 50
The number of used connections is 10% 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

ERROR 2013 (HY000): Lost connection to MySQL server during query
MEMORY USAGE
./tuning-primer.sh: line 1153: bc: command not found
./tuning-primer.sh: line 1154: bc: command not found
ERROR 2013 (HY000): Lost connection to MySQL server during query
./tuning-primer.sh: line 1178: bc: command not found
./tuning-primer.sh: line 1181: bc: command not found
./tuning-primer.sh: line 1182: bc: command not found
./tuning-primer.sh: line 1184: bc: command not found
./tuning-primer.sh: line 1186: [: -gt: unary operator expected
./tuning-primer.sh: line 345: [: max_memoryHR: integer expression expected
./tuning-primer.sh: line 351: [: max_memoryHR: integer expression expected
./tuning-primer.sh: line 357: [: max_memoryHR: integer expression expected
./tuning-primer.sh: line 364: export: `0=max_memoryHR': not a valid identifier
Max Memory Ever Allocated :  bytes
./tuning-primer.sh: line 345: [: per_thread_buffersHR: integer expression expected
./tuning-primer.sh: line 351: [: per_thread_buffersHR: integer expression expected
./tuning-primer.sh: line 357: [: per_thread_buffersHR: integer expression expected
./tuning-primer.sh: line 364: export: `0=per_thread_buffersHR': not a valid identifier
Configured Max Per-thread Buffers :  bytes
./tuning-primer.sh: line 345: [: global_buffersHR: integer expression expected
./tuning-primer.sh: line 351: [: global_buffersHR: integer expression expected
./tuning-primer.sh: line 357: [: global_buffersHR: integer expression expected
./tuning-primer.sh: line 364: export: `0=global_buffersHR': not a valid identifier
Configured Max Global Buffers :  bytes
./tuning-primer.sh: line 345: [: total_memoryHR: integer expression expected
./tuning-primer.sh: line 351: [: total_memoryHR: integer expression expected
./tuning-primer.sh: line 357: [: total_memoryHR: integer expression expected
./tuning-primer.sh: line 364: export: `0=total_memoryHR': not a valid identifier
Configured Max Memory Limit :  bytes
./tuning-primer.sh: line 326: bc: command not found
Physical Memory :  G
Max memory limit seem to be within acceptable norms

KEY BUFFER
ERROR 2013 (HY000): Lost connection to MySQL server during query
ERROR 2013 (HY000): Lost connection to MySQL server during query
./tuning-primer.sh: line 326: bc: command not found
./tuning-primer.sh: line 601: bc: command not found
./tuning-primer.sh: line 602: bc: command not found
./tuning-primer.sh: line 326: bc: command not found
Current MyISAM index space =  M
./tuning-primer.sh: line 345: [: key_buffer_sizeHR: integer expression expected
./tuning-primer.sh: line 351: [: key_buffer_sizeHR: integer expression expected
./tuning-primer.sh: line 357: [: key_buffer_sizeHR: integer expression expected
./tuning-primer.sh: line 364: export: `0=key_buffer_sizeHR': not a valid identifier
Current key_buffer_size =  bytes
Key cache miss rate is 1 : 302
Key buffer fill ratio =  %
./tuning-primer.sh: line 639: [: -ge: unary operator expected
./tuning-primer.sh: line 643: [: -le: unary operator expected
Your key_buffer_size seems to be fine

QUERY CACHE
ERROR 2013 (HY000): Lost connection to MySQL server during query
You are using MySQL 5.0.18-log, no query cache is supported.
I recommend an upgrade to MySQL 4.1 or better

SORT OPERATIONS
./tuning-primer.sh: line 326: bc: command not found
Current sort_buffer_size =  M
./tuning-primer.sh: line 326: bc: command not found
Current record/read_rnd_buffer_size =  M
Sort buffer seems to be fine

JOINS
./tuning-primer.sh: line 326: bc: command not found
Current join_buffer_size =  M
You have had 4 queries where a join could not use an index properly
join_buffer_size >= 4 M
This is not advised
./tuning-primer.sh: line 807: [: ==: unary operator expected
./tuning-primer.sh: line 807: [: ==: unary operator expected
./tuning-primer.sh: line 809: [: ==: unary operator expected
./tuning-primer.sh: line 809: [: ==: unary operator expected
./tuning-primer.sh: line 809: [: ==: unary operator expected
Then look for non indexed joins in the slow query log.

OPEN FILES LIMIT
Current open_files_limit = 4510 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 = 2000 tables
You have a total of 500 tables
You have 726 open tables.
The table_cache value seems to be fine

TEMP TABLES
ERROR 2013 (HY000): Lost connection to MySQL server during query
ERROR 2013 (HY000): Lost connection to MySQL server during query
ERROR 2013 (HY000): Lost connection to MySQL server during query
./tuning-primer.sh: line 836: [: -eq: unary operator expected
./tuning-primer.sh: line 839: let: tmp_disk_tables=created_tmp_disk_tables*100/created_tmp_tables: division by 0 (error token is "s")
./tuning-primer.sh: line 326: bc: command not found
Current max_heap_table_size =  M
./tuning-primer.sh: line 345: [: tmp_table_sizeHR: integer expression expected
./tuning-primer.sh: line 351: [: tmp_table_sizeHR: integer expression expected
./tuning-primer.sh: line 357: [: tmp_table_sizeHR: integer expression expected
./tuning-primer.sh: line 364: export: `=tmp_table_sizeHR': not a valid identifier
Current tmp_table_size =  bytes
Of  temp tables, % were created on disk
./tuning-primer.sh: line 848: [: -gt: unary operator expected
./tuning-primer.sh: line 851: [: -ge: unary operator expected
Created disk tmp tables ratio seems fine

TABLE SCANS
./tuning-primer.sh: line 326: bc: command not found
Current read_buffer_size =  M
Current table scan ratio = 19687 : 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 : 19
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'.
 
und ausserdem scheinst Du eine ziemlich alte Version des Scripts zu haben.
Bei der Version, die ich habe steht in Zeile 8 was von
Code:
#       Version: 1.3-r3         Released: 2007-02-15                    #
...

Zum bc: Welche Linux-Distribution hast Du?
 
SUSE 10.1 mit Plesk 8.1 (64 bit)

wo bekomme ich eine neue version her ?

habe jetzt mal diese geladen

#########################################################################
# #
# MySQL performance tuning primer script #
# Writen by: Matthew Montgomery <mmontgomery@mysql.com> #
# Inspired by: MySQLARd (MySQL Activity Report - 19-03-2004 11:04) #
# Version: 1.3-r6 Released: 2007-11-14 #
# Licenced under GPLv2 #
# #
#########################################################################
 
Last edited by a moderator:
yast2: Software->Software-Management->Filter->Search
Search in [x] Name of Package OK
Bei bc (GNU Command Line Calculator) mit Leertaste auswählen -> Accept

Ich glaube wir brechen hier mal ab,
Wie ich oben schon mal geschrieben habe, hat uns unserer Admin im Stich gelassen.
Und ich bin ein leihe. Habe es zwar geschafft den Server wieder zum Laufen zu bringen, aber auch nur darum weil ich einige Anleitungen gefunden habe die auch leihen verstehen.
Wo finde ich Software / Software-Manag++++++ usw?
 
Code:
SLOW QUERIES
Current long_query_time = 4 sec.
You have 1496 out of 3631989 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 = 64
Current threads_cached = 4
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 = 2
Historic max_used_connections = 139
The number of used connections is 27% of the configured maximum.
Your max_connections variable seems to be fine.

MEMORY USAGE
Max Memory Ever Allocated : 9 G
Configured Max Per-thread Buffers : 31 G
Configured Max Global Buffers : 298 M
Configured Max Memory Limit : 31 G
Physical Memory : 3.84 G

Max memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 23 M
Current key_buffer_size = 256 M
Key cache miss rate is 1 : 1867
Key buffer fill ratio = 2.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 = 937 K
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 2.86 %
Current query_cache_min_res_unit = 4 K
Query Cache is 9 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 16 M
Current record/read_rnd_buffer_size = 15 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 16.00 M
You have had 20 queries where a join could not use an index properly
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 = 4510 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 = 2000 tables
You have a total of 500 tables
You have 525 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 6753 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 = 15 M
Current table scan ratio = 14623 : 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 : 20
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'.


Wenn man den server neu initialisieren möchte, welche Version ist die beste, für ein wbb2 Forum?

SUSE 10.1 mit Plesk 8.1 (64 bit)
SUSE 10.1 mit Plesk 8.1
SUSE 9.3 mit Plesk 8.0 (64 bit)
SUSE 9.3 mit Plesk 8.0
Fedora Core 6 mit Plesk 8.1 (64 bit)
Fedora Core 6 mit Plesk 8.1
SUSE 10.1 Minimalsystem (64 bit)
SUSE 10.1 Minimalsystem
Ubuntu 6.06 Minimalsystem (64 bit)
Ubuntu 6.06 Minimalsystem
Fedora Core 6 Minimalsystem (64 bit)
Fedora Core 6 Minimalsystem
Debian 3.1 (stable/sarge) Minimalsystem (64 bit)
Debian 3.1 (stable/sarge) Minimalsystem
 
Last edited by a moderator:
neuer versuch mit neuen Daten

Lasse gerade das Sript „tuning-primer.sh“ über den server laufen.
Nach diesen Angaben soll dann die my.cnf angepasst werden.

Hier schon mal mein jetziger Stand, ist aber noch keine 48 Stunden gelaufen.

Meine Server Daten: Es läuft ein wbb2 Forum drauf wo ca 1000 user gleichzeitug ON sind.

root server

CPU: Opteron 175/ 1216 2 x 2,2 GHz

Arbeitsspeicher: 4 GB

Festplatten: 2 x 250 GB

Ausgabe des Skripts:

MySQL Version 5.0.18-log x86_64

Uptime = 0 days 1 hrs 12 min 32 sec
Avg. qps = 289
Total Questions = 1259646
Threads Connected = 5

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 AB :: MySQL 5.0 Reference Manual :: 5.1.3 System Variables
Visit MySQL AB :: MySQL Enterprise Advisors
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
Current long_query_time = 2 sec.
You have 31 out of 1261848 that take longer than 2 sec. to complete
The slow query log is enabled.
Your long_query_time seems to be fine

WORKER THREADS
Current thread_cache_size = 16
Current threads_cached = 1
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 1000
Current threads_connected = 17
Historic max_used_connections = 37
The number of used connections is 3% 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

MEMORY USAGE
Max Memory Ever Allocated : 213 M
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 154 M
Configured Max Memory Limit : 1 G
Physical Memory : 3.84 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 27 M
Current key_buffer_size = 16 M
Key cache miss rate is 1 : 141
Key buffer fill ratio = 16.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 = 128 M
Current query_cache_used = 6 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 5.26 %
Current query_cache_min_res_unit = 4 K
Query Cache is 9 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragme ntation.
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 512 K
Current record/read_rnd_buffer_size = 508 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 12 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 = 5010 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 = 64 tables
You have a total of 386 tables
You have 64 open tables.
Current table_cache hit rate is 1%, 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 2716 temp tables, 0% 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 = 252 K
Current table scan ratio = 23458 : 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 index es.

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

meine my.cnf:

# 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]
set-variable=local-infile=0
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
thread_cache_size = 16
query_cache_size = 128M
query_cache_type = 1
log-slow-queries
long_query_time = 2
query_cache_limit = 8M
set-variable = max_connections=1000
skip_networking

# 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

meine server-tuning.conf

##
## Server-Pool Size Regulation (MPM specific)
##

# the MPM (multiprocessing module) is not a dynamically loadable module in the
# sense of other modules. It is a compile time decision which one is used. We
# provide different apache2 MPM packages, containing different httpd2 binaries
# compiled with the available MPMs. See APACHE_MPM in /etc/sysconfig/apache2.

# prefork MPM
<IfModule prefork.c>
# number of server processes to start
# mpm_common - Apache HTTP Server
StartServers 5
# minimum number of server processes which are kept spare
# prefork - Apache HTTP Server
MinSpareServers 5
# maximum number of server processes which are kept spare
# prefork - Apache HTTP Server
MaxSpareServers 10
# highest possible MaxClients setting for the lifetime of the Apache process.
# mpm_common - Apache HTTP Server
ServerLimit 150
# maximum number of server processes allowed to start
# mpm_common - Apache HTTP Server
MaxClients 150
# maximum number of requests a server process serves
# mpm_common - Apache HTTP Server
MaxRequestsPerChild 10000
</IfModule>

# worker MPM
<IfModule worker.c>
# initial number of server processes to start
# mpm_common - Apache HTTP Server
StartServers 3
# minimum number of worker threads which are kept spare
# mpm_common - Apache HTTP Server
MinSpareThreads 25
# maximum number of worker threads which are kept spare
# mpm_common - Apache HTTP Server
MaxSpareThreads 75
# upper limit on the configurable number of threads per child process
# mpm_common - Apache HTTP Server
ThreadLimit 64
# maximum number of simultaneous client connections
# mpm_common - Apache HTTP Server
MaxClients 150
# number of worker threads created by each child process
# mpm_common - Apache HTTP Server
ThreadsPerChild 25
# maximum number of requests a server process serves
# mpm_common - Apache HTTP Server
MaxRequestsPerChild 10000
</IfModule>


#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

#
# EnableMMAP: Control whether memory-mapping is used to deliver
# files (assuming that the underlying OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. On some systems, turning it off (regardless of
# filesystem) can improve performance; for details, please see
# core - Apache HTTP Server
#
#EnableMMAP off

#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# core - Apache HTTP Server
#
#EnableSendfile off


#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash. This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully
 
server-tuning.conf
Code:
[COLOR="Red"]KeepAliveTimeout 2[/COLOR]
ändern.

Du hast ingesammt 4 GB RAM den wir Apache und MySQL zuordnen müssen. Dabei kommt es immer auf die MaxClients (server-tuning.conf) und max_connections (my.cnf) an.

Apache benötigt pro MaxClient ~ 15 MB RAM. Bei dir wären das MaxClients 150, also 150 x 15 MB = 2250 MB RAM. Bleiben noch 4000 - 2250 = 1750 MB RAM übrig.

Linux selbst, Plesk, Spamassassin, Dr. Web, Firewall, Mailserver ect. benötigen zudem auch noch RAM. Daher ziehen wir nochmal min. 250 MB RAM ab.

1750 - 250 MB = 1500 MB RAM welchen wir MySQL zur Verfügung stellen können. Um noch etwas Spielraum zu haben, stellen wir MySQL maximal ~ 1 GB RAM zur Verfügung.

MaxClients und max_conections würde ich gleich machen, z.B. 150, also max_connection = 150 (my.cnf)

Wieviel RAM MySQL sich nimmt kann man mit der Formel
Code:
key buffer + ((read buffer + read_rnd_buffer + sort_buffer + myisam_sort_buffer) x max_connections)) = RAM
berechnen.

d.h. in deinem Fall, unter tuning-primer.sh Script darf bei
Code:
MEMORY USAGE
Max Memory Ever Allocated : 213 M
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 154 M
[COLOR="Red"]Configured Max Memory Limit : 1 G[/COLOR]
Physical Memory : 3.84 G
Configured Max Memory Limit nicht größer als 1 GB sein! Ansonsten wird MySQL swappen.(auf Festplatte auslagern).

sort_buffers und read_buffers müssen nicht sonderlich groß sein, da genügen meist auch 128K oder weniger. thread_cache würde ich auf 32 setzen und table_cache auf 512 oder höher. Wichtig ist auch, daß man query_cache verwendet (hast du ja).

Du könntest auch den RAM neu verteilen und MaxClients (server-tuning.conf) und max_connections (my.cnf) auf 200 erhöhen.

Dann wären das 200 x 15 = 3 GB RAM und für MySQL hätten wir dann noch ~ 500 MB RAM.

max_connections = ((200 (my.cnf) x (128K + 128K + 64K + 64K)) + 24 MB = ~ 100 MB RAM

500 MB haben wir zur Verfügung, könnten also die read + sort buffers noch größer machen.

KeepAliveTimeout 2

bedeutet, sobald ein Forenuser innerhalb 2 Sekunden keinen Button mehr klickt, beendet Apache die Verbindung und stellt diese anderen Forenuser zur Verfügung.

MaxClients 150


bedeutet, 150 Forenuser können gleichzeitig auf einen Button klicken. Alle anderen müssen 2 Sekunden warten bis eine der 150 Verbindungen frei wird.


Mit
Code:
ps axu --sort:command
kannst du dir die httpd2 prefork Prozesse anzeigen lassen. Jeder httpd2 Prozess kann eine Verbindung (TCP) zu einem Forenuser herstellen und verbraucht ~ 15 MB RAM.

@Apache

Apache erzeugt (forkt) beim Start 5 Elternprozesse. Dann forkt Apache bei Bedarf bis zu (ServerLimit) weitere Kindsprozesse (Childs). Jeder Child Prozesss (httpd2 prefork) kann eine Aufgabe übernehmen wie z.B. TCP Verbindung zu einem Forenuser aufbauen.
Code:
ServerLimit 150
MaxClients 150
sollten daher gleich hoch sein z.B. 150

Die MinSpare Childs müßte man eigentlich auch berücksichtigen, da diese zwar nur rumdümpeln aber auch jeweils ~ 15 MB RAM verbrauchen. Daher sollte man MinSpare nicht zu hoch setzen. (wäre nur unnötig RAM Verbrauch).
 
Last edited by a moderator:
Anleitung:

in das Verzeichnis /server-tuning.conf wechseln, dann eingeben

Code:
vim server-tuning.conf
und die Taste
Code:
ESC
drücken. Nun mit Pfeiltaste hoch/runter zur Zeile
Code:
KeepALiveTimeout 15
gehen und mit Leertaste (Cursor) zur Zahl 15. Nun die Taste
Code:
i
drücken und mit der Taste
Code:
Entf
die 15 entfernen und durch 2 ersetzen. Nun
Code:
ESC Taste
drücken und die Tasten
Code:
:wq
drücken. Anschließend Apache neu starten
Code:
service httpd restart
.

Hat man beim editieren Mist gebaut, drückt man die Taste
Code:
ESC
und die Tasten
Code:
:q!
.

vim Befehle

vim Dateiname (öffnet Datei im Editor)
ESC Taste (wechselt in den Lesemodus)
i Taste (wechselt in den Schreibmodus bzw. Einfügemodus)
:wq (speichert die Änderungen und beendet den Editor)
:q! (beendet den Editor ohne Änderungen zu speichern)

Nun muß noch die my.cnf editiert werden!
Code:
# The MySQL server
[mysqld]
set-variable=local-infile=0
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking

key_buffer = 24M
net_buffer_length = 8K
max_allowed_packet = 1M

sort_buffer_size = 128K
myisam_sort_buffer_size = 128K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
join_buffer_size = 2M

table_cache = 512
thread_cache_size = 64
query_cache_size = 8M
query_cache_type = 1
query_cache_limit = 8M
log-slow-queries
long_query_time = 2

max_connections =150
low_priority_updates = 1
skip_networking

Tip:


mit der rechten Maustaste kann man im Editor aus der Zwischenablage einfügen.

Anschließend MySQL neu starten mit
Code:
 service mysqld stop
und
Code:
 service mysqld start

Zum Schluß tuning-primer.sh Script aufrufen und kontrollieren wie hoch Configured Max Memory Limit u.a. ist. Sollte nicht höher als 1 GB sein. Momentan haben die buffers noch recht kleine Werte, können also noch bei Bedarf erhöht werden.
 
Last edited by a moderator:
können die falschen einstellungen auch mit der hohen CPU last bei mysql zu tun haben?

Code:
mysql 8864 97.8 0.9 269228 36368 pts/0 Sl 13:19 3:47 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/my
 
was haben wir gemacht?

Wir haben Apache so eingerichtet, daß Apache 150 Verbindungen gleichzeitig handhaben kann ohne daß der RAM ausgeht. Und wir haben MySQL so konfiguriert, daß MysQL 150 Verbindungen gleichzeitg handhaben kann ohne daß der RAM ausgeht. Dadurch vermeiden wir ein extremes Swappen des Servers (Festplatte als RAM verwenden).

4 GB RAM haben wir. Apache benötigt ~ 2,25 GB und das System nochmal ~ 0,5 GB. Bleiben für MySQL ~ 1,25 GB RAM.

150 x die buffers (vereinfacht gesagt) darf nicht mehr als 1,25 GB RAM verbrauchen.

Vereinfacht gerechnet sind das 1250 MB : 4 : 150 = 2 MB pro Buffer. Mit Hilfe vom Tuning-Primer Script kann man nun die buffers ect. der optimalen Größe anpassen. Unterm Strich darf halt nicht mehr als 1,25 GB rauskommen.
 
Last edited by a moderator:
Hier nun meine neuen Daten

CPU: Opteron 175/ 1216 2 x 2,2 GHz

Arbeitsspeicher: 4 GB

Festplatten: 2 x 250 GB

Ausgabe des Skripts:

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

MySQL Version 5.0.18-log x86_64

Uptime = 2 days 0 hrs 34 min 0 sec
Avg. qps = 82
Total Questions = 14367513
Threads Connected = 1

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:
MySQL AB :: MySQL 5.0 Reference Manual :: 5.1.3 System Variables
Visit MySQL AB :: MySQL Enterprise Advisors
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
Current long_query_time = 2 sec.
You have 6 out of 14367566 that take longer than 2 sec. to complete
The slow query log is enabled.
Your long_query_time seems to be fine

WORKER THREADS
Current thread_cache_size = 64
Current threads_cached = 20
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 150
Current threads_connected = 1
Historic max_used_connections = 21
The number of used connections is 14% of the configured maximum.
Your max_connections variable seems to be fine.

MEMORY USAGE
Max Memory Ever Allocated : 102 M
Configured Max Per-thread Buffers : 429 M
Configured Max Global Buffers : 42 M
Configured Max Memory Limit : 471 M
Physical Memory : 3.84 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 63 M
Current key_buffer_size = 24 M
Key cache miss rate is 1 : 4110
Key buffer fill ratio = 43.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 = 8 M
Current query_cache_used = 4 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 51.37 %
Current query_cache_min_res_unit = 4 K
Query Cache is 21 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragme ntation.
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 128 K
Current record/read_rnd_buffer_size = 252 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2.00 M
You have had 27 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 = 1184 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 = 512 tables
You have a total of 521 tables
You have 512 open tables.
Current table_cache hit rate is 10%, 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 126881 temp tables, 20% 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 = 252 K
Current table scan ratio = 13248 : 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 index es.

TABLE LOCKING
Current Lock Wait ratio = 1 : 238
You may benefit from selective use of InnoDB.
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

.

meine my.cnf:

# 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]
set-variable=local-infile=0
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking

key_buffer = 24M
net_buffer_length = 8K
max_allowed_packet = 1M

sort_buffer_size = 128K
myisam_sort_buffer_size = 128K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
join_buffer_size = 2M

table_cache = 512
thread_cache_size = 64
query_cache_size = 8M
query_cache_type = 1
query_cache_limit = 8M
log-slow-queries
long_query_time = 2

max_connections =150
low_priority_updates = 1
skip_networking

# 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

meine server-tuning.conf

##
## Server-Pool Size Regulation (MPM specific)
##

# the MPM (multiprocessing module) is not a dynamically loadable module in the
# sense of other modules. It is a compile time decision which one is used. We
# provide different apache2 MPM packages, containing different httpd2 binaries
# compiled with the available MPMs. See APACHE_MPM in /etc/sysconfig/apache2.

# prefork MPM
<IfModule prefork.c>
# number of server processes to start
# mpm_common - Apache HTTP Server
StartServers 5
# minimum number of server processes which are kept spare
# prefork - Apache HTTP Server
MinSpareServers 5
# maximum number of server processes which are kept spare
# prefork - Apache HTTP Server
MaxSpareServers 10
# highest possible MaxClients setting for the lifetime of the Apache process.
# mpm_common - Apache HTTP Server
ServerLimit 150
# maximum number of server processes allowed to start
# mpm_common - Apache HTTP Server
MaxClients 150
# maximum number of requests a server process serves
# mpm_common - Apache HTTP Server
MaxRequestsPerChild 10000
</IfModule>

# worker MPM
<IfModule worker.c>
# initial number of server processes to start
# mpm_common - Apache HTTP Server
StartServers 3
# minimum number of worker threads which are kept spare
# mpm_common - Apache HTTP Server
MinSpareThreads 25
# maximum number of worker threads which are kept spare
# mpm_common - Apache HTTP Server
MaxSpareThreads 75
# upper limit on the configurable number of threads per child process
# mpm_common - Apache HTTP Server
ThreadLimit 64
# maximum number of simultaneous client connections
# mpm_common - Apache HTTP Server
MaxClients 150
# number of worker threads created by each child process
# mpm_common - Apache HTTP Server
ThreadsPerChild 25
# maximum number of requests a server process serves
# mpm_common - Apache HTTP Server
MaxRequestsPerChild 10000
</IfModule>


#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 2

#
# EnableMMAP: Control whether memory-mapping is used to deliver
# files (assuming that the underlying OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. On some systems, turning it off (regardless of
# filesystem) can improve performance; for details, please see
# core - Apache HTTP Server
#
#EnableMMAP off

#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# core - Apache HTTP Server
#
#EnableSendfile off


#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash. This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

und meine top
top - 19:37:40 up 7 days, 10:25, 1 user, load average: 0.30, 0.29, 0.21
Tasks: 114 total, 1 running, 113 sleeping, 0 stopped, 0 zombie
Cpu(s): 8.0% us, 2.5% sy, 0.0% ni, 89.5% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 4033792k total, 3177036k used, 856756k free, 16864k buffers
Swap: 1959920k total, 5544k used, 1954376k free, 2570624k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
30320 wwwrun 15 0 177m 29m 4508 S 8 0.8 0:00.45 httpd2-prefork
29616 wwwrun 19 0 179m 31m 4532 S 7 0.8 0:00.93 httpd2-prefork
30136 wwwrun 16 0 179m 32m 4468 S 4 0.8 0:00.87 httpd2-prefork
24805 mysql 15 0 187m 90m 5192 S 1 2.3 664:31.50 mysqld
30334 wwwrun 15 0 167m 19m 4304 S 0 0.5 0:00.13 httpd2-prefork
1 root 15 0 776 304 252 S 0 0.0 0:02.22 init
2 root RT 0 0 0 0 S 0 0.0 0:00.65 migration/0
3 root 34 19 0 0 0 S 0 0.0 0:00.04 ksoftirqd/0
4 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/0
5 root RT 0 0 0 0 S 0 0.0 0:01.51 migration/1
6 root 34 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/1
7 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/1
8 root 10 -5 0 0 0 S 0 0.0 0:00.00 events/0
9 root 10 -5 0 0 0 S 0 0.0 0:00.00 events/1
10 root 10 -5 0 0 0 S 0 0.0 0:08.54 khelper
11 root 10 -5 0 0 0 S 0 0.0 0:00.00 kthread
154 root 10 -5 0 0 0 S 0 0.0 0:00.22 kblockd/0
155 root 10 -5 0 0 0 S 0 0.0 0:01.25 kblockd/1
156 root 20 -5 0 0 0 S 0 0.0 0:00.00 kacpid
258 root 17 -5 0 0 0 S 0 0.0 0:00.00 ata/0
259 root 19 -5 0 0 0 S 0 0.0 0:00.00 ata/1
260 root 18 -5 0 0 0 S 0 0.0 0:00.00 ata_aux
261 root 10 -5 0 0 0 S 0 0.0 0:00.00 kseriod
302 root 10 -5 0 0 0 S 0 0.0 0:21.68 kswapd0
303 root 16 -5 0 0 0 S 0 0.0 0:00.00 aio/0
304 root 16 -5 0 0 0 S 0 0.0 0:00.00 aio/1
305 root 10 -5 0 0 0 S 0 0.0 0:00.00 cifsoplockd
306 root 10 -5 0 0 0 S 0 0.0 0:00.00 cifsdnotifyd
307 root 10 -5 0 0 0 S 0 0.0 0:15.30 xfslogd
308 root 10 -5 0 0 0 S 0 0.0 0:11.50 xfsdatad
963 root 11 -5 0 0 0 S 0 0.0 0:00.00 scsi_eh_0
991 root 10 -5 0 0 0 S 0 0.0 0:00.00 scsi_eh_1
992 root 10 -5 0 0 0 S 0 0.0 0:00.00 scsi_eh_2
1010 root 11 -5 0 0 0 S 0 0.0 0:00.00 exec-osm/0
1011 root 11 -5 0 0 0 S 0 0.0 0:00.00 exec-osm/1
1034 root 11 -5 0 0 0 S 0 0.0 0:00.00 kcryptd/0
1035 root 11 -5 0 0 0 S 0 0.0 0:00.00 kcryptd/1
1036 root 11 -5 0 0 0 S 0 0.0 0:00.00 ksnapd
1037 root 11 -5 0 0 0 S 0 0.0 0:00.00 kmirrord
1042 root 10 -5 0 0 0 S 0 0.0 0:05.37 kjournald
1100 root 16 -4 7124 676 336 S 0 0.0 0:00.35 udevd
2203 root 10 -5 0 0 0 S 0 0.0 0:00.12 xfsbufd
2204 root 10 -5 0 0 0 S 0 0.0 0:00.00 xfssyncd
2206 root 10 -5 0 0 0 S 0 0.0 0:00.39 xfsbufd
2207 root 10 -5 0 0 0 S 0 0.0 0:00.40 xfssyncd
2209 root 10 -5 0 0 0 S 0 0.0 0:00.21 xfsbufd
2210 root 10 -5 0 0 0 S 0 0.0 0:00.00 xfssyncd
2212 root 10 -5 0 0 0 S 0 0.0 0:00.27 xfsbufd
2213 root 11 -5 0 0 0 S 0 0.0 0:00.06 xfssyncd
2324 qmails 16 0 2820 800 420 S 0 0.0 1:11.08 qmail-send
2325 qmaill 18 0 2616 516 432 S 0 0.0 0:09.52 splogger
 
Last edited by a moderator:
Bei 300 Usern fängt es aber schon an in lahmen.
lahmt der Server immer noch?

Historic max_used_connection = 21

Wie ich bereits sagte, nicht alle User die im Forum sind klicken gleichzeitig auf einen Link o. Button. Und Apache trennt die Verbindung wenn ein User nicht nach 2 Sekunden einen Link o. Button geklickt hat. Theoretisch sollte der Server 150 gleichzeitige Verbindungen aushalten, so haben wir ihn zumindest konfiguriert.

laut
Code:
top
ist der load ja bei 0,21 und das ist ja ein guter Wert. Und 0,0%wa ist auch so wie wir das haben wollen. Swap ist bei 5 MB, was man vernachlässigen kann. Freier RAM (Mem) haben wir noch 856,456 MB RAM. d.h. bei Bedarf kannst du Buffers o. Caches in der my.cnf noch erhöhen.

Was ich machen würde?

Server weiter mit 'top' beobachten (Swap, Load, Mem free, %wa). Anmerkung: %wa sollte möglichst kleiner 1,0% sein. Und mit tuning-primer.sh die Buffers ect. beobachten.

table_cache könnte man mal testen und auf 1024 erhöhen. Dann noch join_buffer erhöhen auf z.B. 4 MB. read_buffers und sort_bufers würde ich nicht ändern.
 
Last edited by a moderator:
Back
Top