Serverauslastung herausfinden...

Apache, Lighttpd, nginx, Cherokee
Post Reply
tjabo
Posts: 59
Joined: 2004-09-13 20:16
 

Serverauslastung herausfinden...

Post by tjabo »

Hallo,
wie kann ich denn herausfinden, was meinen server in der leistung beinträchtigt, sodass die mysql datenbank manchmal keine daten mehr ausgibt und auch sonst probleme auftreten.

Linux Redhad 7.3 Confixx 2.0 prof.

danke für eure hilfe,
mfg
tj

p.s: sorry für den 2ten post, habe das erste thema nicht gefunden, da es verschoben wurde, daher der doppelpost, habe dieses dann auch wieder in das falsche forum geschrieben. sorry!

Code: Select all

der befehlt top ergibt folgendes
25 processes: 24 sleeping, 1 running, 0 zombie, 0 stopped
CPU0 states:  0.0% user,  0.1% system,  0.0% nice, 99.3% idle
CPU1 states:  0.2% user,  0.1% system,  0.0% nice, 99.2% idle
Mem:  2066220K av, 2020408K used,   45812K free,       0K shrd,  165832K buff
Swap: 2048276K av,  367068K used, 1681208K free                 1304412K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
13167 named     10   0  2972 2920  1956 S     0.1  0.1   0:01 named
23519 apache    10   0  8636 8420  7280 S     0.1  0.4   0:32 httpd
26056 root      14   0   888  888   716 R     0.1  0.0   0:00 top
    1 root       9   0   476  476   416 S     0.0  0.0   0:01 init
13084 root       9   0   548  544   460 S     0.0  0.0   0:02 syslogd
13163 named      9   0  2972 2920  1956 S     0.0  0.1   0:00 named
13164 named      9   0  2972 2920  1956 S     0.0  0.1   0:00 named
13165 named      9   0  2972 2920  1956 S     0.0  0.1   0:01 named
13168 named      9   0  2972 2920  1956 S     0.0  0.1   0:00 named
13169 named      9   0  2972 2920  1956 S     0.0  0.1   0:00 named
13188 root       9   0  1104 1060   940 S     0.0  0.0   0:03 sshd
13209 root       6   0   972  944   784 S     0.0  0.0   0:01 xinetd
13282 root       9   0  1052 1052   872 S     0.0  0.0   0:00 safe_mysqld
13357 mysql      9   0  5864 5864  2220 S     0.0  0.2   0:01 mysqld
13360 mysql     14   0  5864 5864  2220 S     0.0  0.2   0:04 mysqld
13361 mysql      9   0  5864 5864  2220 S     0.0  0.2   0:03 mysqld
Roger Wilco
Posts: 5923
Joined: 2004-05-23 12:53
 

Re: Serverauslastung herausfinden...

Post by Roger Wilco »

Deine CPUs sind zu über 99% idle und dein Speicher wird mit über 1,3 GB als Cache benutzt. Wo liegt dein Problem?
Du solltest lieber mal das Slow-Query Log von MySQL aktivieren und das ein bisschen durchsuchen.
tjabo
Posts: 59
Joined: 2004-09-13 20:16
 

Re: Serverauslastung herausfinden...

Post by tjabo »

hallo,
danke, wie kann ich denn diesen aktivieren ? danke für die hilfe,
was haben denn die 1,3gb cache zu sagen?
danke

meine mysql.log.1 gibt folgendes aus

Code: Select all

060220 13:17:37  mysqld ended

060220 13:19:02  mysqld started
Cannot initialize InnoDB as 'innodb_data_file_path' is not set.
If you do not want to use transactional InnoDB tables, add a line
skip-innodb
to the [mysqld] section of init parameters in your my.cnf
or my.ini. If you want to use InnoDB tables, add to the [mysqld]
section, for example,
innodb_data_file_path = ibdata1:10M:autoextend
But to get good performance you should adjust for your hardware
the InnoDB startup options listed in section 2 at
http://www.innodb.com/ibman.html
/usr/libexec/mysqld: ready for connections
060222 20:15:47  /usr/libexec/mysqld: Normal shutdown

060222 20:15:47  /usr/libexec/mysqld: Shutdown Complete

060222 20:15:47  mysqld ended

060222 20:16:53  mysqld started
Cannot initialize InnoDB as 'innodb_data_file_path' is not set.
If you do not want to use transactional InnoDB tables, add a line
skip-innodb
to the [mysqld] section of init parameters in your my.cnf
or my.ini. If you want to use InnoDB tables, add to the [mysqld]
section, for example,
innodb_data_file_path = ibdata1:10M:autoextend
But to get good performance you should adjust for your hardware
the InnoDB startup options listed in section 2 at
http://www.innodb.com/ibman.html
/usr/libexec/mysqld: ready for connections

Status information:

Current dir: /var/lib/mysql/
Current locks:
lock: 84b2914:

lock: 847e7ec:

lock: 842521c:

lock: 8475564:

lock: 84b0bb4:

lock: 846a7b4:

lock: 849ee34:

lock: 84cd774:

lock: 843ebb4:

lock: 848b984:

lock: 84aac5c:

lock: 840b20c:

lock: 842f504:

lock: 843efac:

lock: 847c264:

lock: 848850c:

lock: 849d77c:

lock: 841b474:

lock: 8424bec:

lock: 84270f4:

lock: 84692dc:

lock: 8438d74:

lock: 843710c:

lock: 84266ac:

lock: 841caec:

lock: 846c034:

lock: 847fa7c:

lock: 8410604:

lock: 841ab6c:

lock: 841a5ac:

lock: 840e374:

lock: 840d57c:

lock: 84310ec:

lock: 8433b24:

lock: 8499514:

lock: 8457c14:

lock: 8469d3c:

lock: 840f7f4:

lock: 845437c:

lock: 8448b3c:

lock: 8446b54:

lock: 8429504:

lock: 841743c:

lock: 842d08c:

key_cache status:
blocks used:       490
not flushed:         0
w_requests:      35171
writes:          19249
r_requests:     305437
reads:             454

handler status:
read_key:        46442
read_next:       87075
read_rnd         13375
read_first:      57201
write:           46338
delete           34971
update:          42374

Table status:
Opened tables:       2166
Open tables:           63
Open files:           107
Open streams:           0

Status information:

Current dir: /var/lib/mysql/
Current locks:
lock: 84b2914:

lock: 847e7ec:

lock: 842521c:

lock: 8475564:

lock: 84b0bb4:

lock: 846a7b4:

lock: 849ee34:

lock: 84cd774:

lock: 843ebb4:

lock: 848b984:

lock: 84aac5c:

lock: 840b20c:

lock: 842f504:

lock: 843efac:

lock: 847c264:

lock: 848850c:

lock: 849d77c:

lock: 841b474:

lock: 8424bec:

lock: 84270f4:

lock: 84692dc:

lock: 8438d74:

lock: 843710c:

lock: 84266ac:

lock: 841caec:

lock: 846c034:

lock: 847fa7c:

lock: 8410604:

lock: 841ab6c:

lock: 841a5ac:

lock: 840e374:

lock: 840d57c:

lock: 84310ec:

lock: 8433b24:

lock: 8499514:

lock: 8457c14:

lock: 8469d3c:

lock: 840f7f4:

lock: 845437c:

lock: 8448b3c:

lock: 8446b54:

lock: 8429504:

lock: 841743c:

lock: 842d08c:

key_cache status:
blocks used:       490
not flushed:         0
w_requests:      35171
writes:          19249
r_requests:     305437
reads:             454

handler status:
read_key:        46442
read_next:       87075
read_rnd         13375
read_first:      57201
write:           46338
delete           34971
update:          42374

Table status:
Opened tables:       2166
Open tables:           63
Open files:           107
Open streams:           0
060301 12:22:41  /usr/libexec/mysqld: Normal shutdown

060301 12:22:41  /usr/libexec/mysqld: Shutdown Complete
flo
Posts: 2223
Joined: 2002-07-28 13:02
Location: Berlin
 

Re: Serverauslastung herausfinden...

Post by flo »

Wir haben hier einige Spezialisten zu MySQL - empfehlen würde ich dir die "wichtig"-Threads alle miteinander. Vor allem isotopp hat sich eine Schweinearbeit gemacht und sehr ausführlich Sachen zu MySQL-spezifischen Workflows mit Beispielen aufgeschrieben.

Das Slow-Query-Log sollte an und für sich entweder standardmäßig aktiv sein oder in der Config ausdokumentiert.

Code: Select all

log-slow-queries        = /var/log/mysql/mysql-slow.log
flo.
User avatar
isotopp
Posts: 471
Joined: 2003-08-21 10:21
Location: Berlin
Contact:
 

Re: Serverauslastung herausfinden...

Post by isotopp »

tjabo wrote:

Code: Select all

13357 mysql      9   0  5864 5864  2220 S     0.0  0.2   0:01 mysqld
Dein mysqld ist winzig klein. Hast Du überhaupt irgendwelche Puffer definiert?
tjabo
Posts: 59
Joined: 2004-09-13 20:16
 

Re: Serverauslastung herausfinden...

Post by tjabo »

hmm puffer ? ich habe einen vserver und habe bei der mysql config nie etwas eingestellt: phpmyadmin gibt mir folgende config aus:

Code: Select all

 Variable   Wert  
back log  50  
basedir  /usr/  
bdb cache size  8388600  
bdb log buffer size  32768  
bdb home  /var/lib/mysql/  
bdb max lock  10000  
bdb logdir   
bdb shared data  OFF  
bdb tmpdir  /tmp/  
bdb version  Sleepycat Software: Berkeley DB 3.2.9a: (September 11, 2003)  
binlog cache size  32768  
character set  latin1  
character sets  latin1 big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin2 latin5 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620  
concurrent insert  ON  
connect timeout  5  
datadir  /var/lib/mysql/  
delay key write  ON  
delayed insert limit  100  
delayed insert timeout  300  
delayed queue size  1000  
flush  OFF  
flush time  0  
have bdb  YES  
have gemini  NO  
have innodb  DISABLED  
have isam  YES  
have raid  NO  
have openssl  NO  
init file   
innodb additional mem pool size  1048576  
innodb buffer pool size  8388608  
innodb data file path   
innodb data home dir   
innodb file io threads  4  
innodb force recovery  0  
innodb thread concurrency  8  
innodb flush log at trx commit  1  
innodb fast shutdown  ON  
innodb flush method   
innodb lock wait timeout  50  
innodb log arch dir   
innodb log archive  OFF  
innodb log buffer size  1048576  
innodb log file size  5242880  
innodb log files in group  2  
innodb log group home dir   
innodb mirrored log groups  1  
interactive timeout  28800  
join buffer size  131072  
key buffer size  8388600  
language  /usr/share/mysql/english/  
large files support  ON  
locked in memory  OFF  
log  OFF  
log update  OFF  
log bin  OFF  
log slave updates  OFF  
log long queries  OFF  
long query time  10  
low priority updates  OFF  
lower case table names  0  
max allowed packet  1048576  
max binlog cache size  4294967295  
max binlog size  1073741824  
max connections  100  
max connect errors  10  
max delayed threads  20  
max heap table size  16777216  
max join size  4294967295  
max sort length  1024  
max user connections  0  
max tmp tables  32  
max write lock count  4294967295  
myisam max extra sort file size  256  
myisam max sort file size  2047  
myisam recover options  0  
myisam sort buffer size  8388608  
net buffer length  16384  
net read timeout  30  
net retry count  10  
net write timeout  60  
open files limit  0  
pid file  /var/run/mysqld/mysqld.pid  
port  3306  
protocol version  10  
record buffer  131072  
record rnd buffer  131072  
query buffer size  0  
safe show database  OFF  
server id  0  
slave net timeout  3600  
skip locking  ON  
skip networking  OFF  
skip show database  OFF  
slow launch time  2  
socket  /var/lib/mysql/mysql.sock  
sort buffer  2097144  
sql mode  0  
table cache  64  
table type  MYISAM  
thread cache size  0  
thread stack  65536  
transaction isolation  READ-COMMITTED  
timezone  CET  
tmp table size  33554432  
tmpdir  /tmp/  
version  3.23.58  
wait timeout  28800  
User avatar
isotopp
Posts: 471
Joined: 2003-08-21 10:21
Location: Berlin
Contact:
 

Re: Serverauslastung herausfinden...

Post by isotopp »

tjabo wrote:hmm puffer ? ich habe einen vserver und habe bei der mysql config nie etwas eingestellt
Dann kann es auch nicht schnell sein.

Code: Select all

innodb buffer pool size  8388608  
Das da sollte etwa 40% Deines RAM sein, wenn Du Deinen Apache und ein MySQL zusammen betreibst und InnoDB-Tabellen verwendest. Wenn Du nur MySQL betreibst, kann es 80% Deines RAM sein. Wenn Du kein InnoDB verwendest, lass den Parameter unverändert.

Code: Select all

key buffer size  8388600  
Das da soll etwa 10% Deines RAM sein, wenn Du MyISAM verwendest und MySQL mit Apache zusammen auf der Kiste rennt. Rennt MySQL alleine, setze es auf 20% Deines RAM. Setzt Du nur InnoDB ein, laß es unverändert.

SHOW TABLE STATUS sagt Dir, was Du verwendest. Deinen SHOW STATUS-Ausgaben nach verwendest Du MyISAM.

Code: Select all

table cache  64  
thread cache size  0  
Sieh Dir "tables_opened" und "tables_open" bei "SHOW STATUS" an. Wenn tables_opened hochzählt, dann setze table_cache herauf.

Wenn Du PHP verwendest, dann setze thread_cache_size auf ca. 20. Wenn Du Java verwendest, dann laß den Wert unverändert.

Wenn Du PHP verwendest, solltest Du außerdem darüber nachdenken, den Query_Cache zu aktivieren und ihm ca. 32 MB Speicher zuzuweisen.
oxygen
Posts: 2138
Joined: 2002-12-15 00:10
Location: Bergheim
 

Re: Serverauslastung herausfinden...

Post by oxygen »

Ich möchte noch zu bedenken geben, dass tjabo am Rande erwähnt hat, dass es sich um ein VServer handelt und die 2GB Ram wahrscheinlich die Ram-Ausstattung des Host Systems sind. Er dagegen vermutlich mit 32 oder 64 MB auskommen muss. Da wäre ein schmaler mysqld doch schon angesagt.
Ich glaube, dass mysql hier die falsche Baustelle ist. Die nicht näher genannten Probleme lassen sich wohl eher darauf zurück führen, dass es ein VServer ist.
User avatar
isotopp
Posts: 471
Joined: 2003-08-21 10:21
Location: Berlin
Contact:
 

Re: Serverauslastung herausfinden...

Post by isotopp »

øxygen wrote:Er dagegen vermutlich mit 32 oder 64 MB auskommen muss. Da wäre ein schmaler mysqld doch schon angesagt.
Dann brauchen wir über Performance nicht zu reden.

Eine Platte hat eine Access Time im Bereich von ms. Ein Ram-Riegel im Bereich von ns. Das sind also 10E-3 zu 10E-9, oder "RAM ist eine Million mal schneller als Platten". Um eine Row über einen Index zu fetchen, sind 3-5 Key Accesses und dann der Row Fetch fällig. Wenn die Key_buffer_size so schmal ist, daß nicht wenigstens die Key Accesses gecached werden können, dann schraddelt das so vor sich hin auf der Disk.

Man stirbt nicht dran, aber man wünscht sich, man wäre tot.
tjabo
Posts: 59
Joined: 2004-09-13 20:16
 

Re: Serverauslastung herausfinden...

Post by tjabo »

hmm, ich habe beim Provider nachgefragt und festgestellt, dass ich wirklich NUR 32 mb RAM zu verfügung habe... Dann liegt wohl hier die schwache Serverleistung.

Ich habe mal nachgefragt wie viel eine Aufrüstung kosten würde,
denn ansonsten muss ich wohl auf einen Dedizierten S. umsteigen.

Oder gibt es ne andere Lösung?
Also brauche ich bei der Config gar nichts zu ändern, da ich so oder so zu wenig RAM habe oder?
danke
User avatar
isotopp
Posts: 471
Joined: 2003-08-21 10:21
Location: Berlin
Contact:
 

Re: Serverauslastung herausfinden...

Post by isotopp »

tjabo wrote:Also brauche ich bei der Config gar nichts zu ändern, da ich so oder so zu wenig RAM habe oder?
danke
Das ist korrekt.
tjabo
Posts: 59
Joined: 2004-09-13 20:16
 

Re: Serverauslastung herausfinden...

Post by tjabo »

also einzige lösung aufrüsten oder neuen server,
danke aber für die bemühungen und die hilfe!
aubergine
Posts: 471
Joined: 2005-09-10 17:52
Location: Frankfurt am Main
 

Re: Serverauslastung herausfinden...

Post by aubergine »

Ich hätte auch noch eine Frage an dich isotopp

Wenn Opened_tables bei 16871 liegt, was wäre hierfür eine passende Anzahl zum cachen. Oder gilt auch hier das Prinzip soviel wie möglich cachen lassen?
User avatar
isotopp
Posts: 471
Joined: 2003-08-21 10:21
Location: Berlin
Contact:
 

Re: Serverauslastung herausfinden...

Post by isotopp »

aubergine wrote:Ich hätte auch noch eine Frage an dich isotopp

Wenn Opened_tables bei 16871 liegt, was wäre hierfür eine passende Anzahl zum cachen. Oder gilt auch hier das Prinzip soviel wie möglich cachen lassen?
Du mußt die table_cache_size so lange hochdrehen, bis opened_tables sich nicht mehr bewegt. Danach kannst Du dann ja "open_tables" ansehen und wirst erkennen können, wieviel table_cache_size wirklich verwendet wird.
Post Reply