VServer "outofthebox" sehr langsam bei relativ wenig Zugriffen

Poyraz50

New Member
Hallo Leute,

ich bin hier schon stiller Mitleser aber ich dachte, dass wenn ich mich selbst mal melde vielleicht mir Einige die sich auskennen ein wenig helfen können.

Ich betreibe ein Forum und habe nun geplannt von normalem Hosting auf Vserver umzusteigen. Eigentlich ist auch schon alles eingerichtet. Mailserver, Datenbanken, Domains etc.. Auch war die Seite also das Forum wirklich sehr schnell erreichbar während meiner Testphase, aber da war eben nur ich alleine drauf. Als ich nun ein paar User (so vielleicht 10-15) auf die neue Seite geleitet habe, ging jedoch der Server in die Knie. Der Seitenaufbau war extrem langsam und es war ein normales Arbeiten nicht mehr möglich.

Ich muss dazu sagen, dass ich an den Servereinstellungen nicht groß etwas geändert habe.

Ich benutze das VServer L 4.0 Paket mit Ubuntu und Plesk von hosteurope.

Garantierter Arbeitsspeicher 1.024 MB
Dynamischer Arbeitsspeicher bis zu 2.048 MB

mit Apache und mysql.

Welche optimalen Einstellungen wären für meinen VServer optimal?
Über Tipps und Ratschläge würde ich mich sehr freuen.

Die Ausgaben sind zu einem Zeitpunkt als ich die User wieder auf der normalen Seite waren und die Zugriffsgeschwindigkeit für mich alleine gut war:

top:
PHP:
top - 22:09:37 up 2 days, 7:07, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 39 total, 1 running, 38 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.4%us, 0.0%sy, 0.0%ni, 99.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1048576k total, 384068k used, 664508k free, 0k buffers
Swap: 2097152k total, 0k used, 2097152k free, 0k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5337 www-data 16 0 235m 27m 3940 S 4 2.7 0:01.10 apache2
28291 www-data 18 0 235m 28m 3900 S 1 2.7 0:01.43 apache2
32521 www-data 16 0 235m 27m 3896 S 1 2.7 0:06.33 apache2
17877 mysql 15 0 241m 50m 6488 S 0 5.0 1:37.98 mysqld
1 root 15 0 10368 780 652 S 0 0.1 0:04.98 init
1402 root 15 0 18848 1184 928 R 0 0.1 0:00.00 top
5317 www-data 15 0 228m 20m 3920 S 0 2.0 0:03.15 apache2
5326 www-data 16 0 227m 18m 2668 S 0 1.8 0:00.40 apache2
13562 www-data 15 0 160m 9.8m 412 S 0 1.0 0:00.04 apache2
17694 syslog 15 0 12284 740 556 S 0 0.1 0:00.40 syslogd
17726 root 15 0 50904 1160 680 S 0 0.1 0:00.98 sshd
17831 root 18 0 17384 1464 1172 S 0 0.1 0:00.00 mysqld_safe
17878 root 18 0 3836 612 520 S 0 0.1 0:00.00 logger
18026 root 21 0 21556 828 528 S 0 0.1 0:00.00 couriertcpd
18029 root 23 0 13844 1076 828 S 0 0.1 0:00.00 courierlogger
18038 root 23 0 21556 824 528 S 0 0.1 0:00.00 couriertcpd
18040 root 25 0 13844 1076 828 S 0 0.1 0:00.00 courierlogger

tuning-primer:
PHP:
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.0.51a-3ubuntu5.4 x86_64

Uptime = 2 days 1 hrs 1 min 32 sec
Avg. qps = 3
Total Questions = 640509
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 :: MySQL 5.0 Reference Manual :: 5.1.3 Server System Variables
Visit MySQL :: MySQL Enterprise Advisors
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 640530 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 MySQL :: MySQL 5.0 Reference Manual :: 6.4 Point-in-Time (Incremental) Recovery Using the Binary Log

WORKER THREADS
Current thread_cache_size = 8
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 = 100
Current threads_connected = 1
Historic max_used_connections = 5
The number of used connections is 5% 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 = 1 M
Current InnoDB data space = 2 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 2 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 : 48 M
Configured Max Per-thread Buffers : 262 M
Configured Max Global Buffers : 34 M
Configured Max Memory Limit : 297 M
Physical Memory : 1.00 G
Max memory limit seem to be within acceptable norms

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

QUERY CACHE
Query cache is enabled
Current query_cache_size = 16 M
Current query_cache_used = 15 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 97.82 %
Current query_cache_min_res_unit = 4 K
However, 1457 queries have been removed from the query cache due to lack of memo ry
Perhaps you should raise query_cache_size
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 = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 80 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 = 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 = 64 tables
You have a total of 873 tables
You have 64 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 6127 temp tables, 11% 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 = 128 K
Current table scan ratio = 122 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 137119
Your table locking seems to be fine

apache2.conf:
PHP:
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

# prefork MPM
StartServers       1
MinSpareServers    1
MaxSpareServers    5
MaxClients        10
    MaxRequestsPerChild   0

# worker MPM
StartServers       1
MaxClients        10
MinSpareThreads    1
MaxSpareThreads    4
    ThreadsPerChild      25
    MaxRequestsPerChild   0

HostnameLookups Off

my.cnf:
PHP:
set-variable = innodb_buffer_pool_size=2M
set-variable = innodb_additional_mem_pool_size=500K
set-variable = innodb_log_buffer_size=500K
set-variable = innodb_thread_concurrency=2

# * Fine Tuning
#
key_buffer		= 16M
max_allowed_packet	= 16M
thread_stack		= 128K
thread_cache_size	= 8
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M

Es wäre schön wenn ihr mir helfen könntet und ein Paar Tipps hättet.

Vielen Dank
 
Wenn 10-15 User gleichzeitig auf den Apache zugreifen kann es hier natürlich zu Engpässen kommen:
Code:
MaxClients        10

Ausserdem:
Setz erst mal die max_connections in der mysql.cnf runter, 100 habe ich nicht mal auf meinem Dedicated mit 50 Domains, falls mal 100 Connections da wären würde das deinen Server gleich mal ins Nirvana schicken aufgrund des Speicherbedarfs. 25 wäre imo mal ein Wert für den Anfang, natürlich musst du das Ganze immer im Auge behalten und ggf. anpassen....Konfiguration ist ein ständiger Prozess und nicht "einmal kurz gemacht".

;)
 
Last edited by a moderator:
ist alles andere in ordnung?

also max_connections auf 25 runter und was für ein Wert für die MaxClients wär zu empfehlen?

Sollte KeepAlive auf on bleiben oder auf off?
 
Würde auch mal 25 vorschlagen...aber wie gesagt, du musst das Ganze im Auge behalten und wenn nötig immer wieder anpassen.
Einer meiner Server mit vergleichbaren Specs läuft mit:
Code:
MaxKeepAliveRequests 20
KeepAliveTimeout 2
Aber inwiefern dass bei deinem auch passt kannst du nur durch Beobachten herausfinden und dann ggf. Anpassen.
 
Würde auch mal 25 vorschlagen...aber wie gesagt, du musst das Ganze im Auge behalten und wenn nötig immer wieder anpassen.
Einer meiner Server mit vergleichbaren Specs läuft mit:
Code:
MaxKeepAliveRequests 20
KeepAliveTimeout 2
Aber inwiefern dass bei deinem auch passt kannst du nur durch Beobachten herausfinden und dann ggf. Anpassen.

Ich hab mich jetzt mal eingelesen. Standard für die Maxclients ist doch so 256 oder?

Ich muss dazu sagen, dass die 10-15 gleichzeitigen Zugriffe nur temporär so waren. Generell sind es so zwischen 50-100 gleichzeitige Zugriffe, was jedoch ausbaufähig ist.
 
Also 256 würde ich dir keineswegs empfehlen...^^
Ich schätze mal dass du PHP und noch ein paar andere Module aktiviert hast, also kannst du pro Prozess mit um die 10-15 MB Speicherbedarf rechnen...also wären das bei 25 etwa zwischen 250 und 400 (natürlich alles nur Pi mal Daumen).
Auf den "dynamischen Speicher" würde ich übrigens garnicht erst spekulieren, also geh bei deiner Kalkulation immer von 1 GB als Verfügbar aus.

Fang lieber erst niedrig an und erhöhe vorsichtig den Wert sobald du des öfteren Meldungen im Log findest dass "MaxClients reached" wurden....und immer schön den gesamten Speicherverbrauch des Systems im Auge behalten.
 
Back
Top