PDA

View Full Version : linux risultato top


texerasmo
19-04-2006, 10:19
12:02:22 up 16:18, 2 users, load average: 2.89, 4.16, 4.55
56 processes: 53 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 24.6% 0.0% 0.8% 0.0% 6.2% 0.0% 68.3%
cpu00 48.8% 0.0% 1.6% 0.0% 0.0% 0.0% 49.6%
cpu01 0.0% 0.0% 0.0% 0.0% 24.8% 0.0% 75.2%
cpu02 49.6% 0.0% 1.8% 0.0% 0.0% 0.0% 48.6%
cpu03 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 100.0%
Mem: 2061424k av, 578440k used, 1482984k free, 0k shrd, 141720k buff
202260k active, 215288k inactive
Swap: 2618512k av, 0k used, 2618512k free 185600k cached


Ho la macchina in questo stato questi valori mi preccupano un po
load average: 2.89, 4.16, 4.55.

Sulla macchina gira solamente un database è è lui che mi manda in affanno la cpu

25255 postgres 25 0 6332 6332 4204 R 16.2 0.3 0:05 3 postmaster
25264 postgres 25 0 6316 6316 4204 R 15.9 0.3 0:03 2 postmaster
25262 postgres 25 0 6316 6316 4204 R 14.9 0.3 0:03 2 postmaster
25259 postgres 25 0 6324 6324 4204 R 13.9 0.3 0:05 0 postmaster
25257 postgres 25 0 6312 6312 4204 R 12.0 0.3 0:04 2 postmaster
25265 postgres 23 0 5384 5384 4204 R 5.2 0.2 0:01 1 postmaster
25267 postgres 23 0 6284 6284 4172 R 2.5 0.3 0:00 3 postmaster
25269 postgres 23 0 6280 6280 4172 R 2.4 0.3 0:00 0 postmaster
25270 postgres 23 0 6284 6284 4172 R 2.3 0.3 0:00 3 postmaster

oltre ad un intervento hardware come potrei ottimizzare la macchina? o meglio il db? potrebbero essere delle query molto pesanti?
Con una indicizzazione potrei migliorare la situazione?


Grazie

marco.r
19-04-2006, 11:43
12:02:22 up 16:18, 2 users, load average: 2.89, 4.16, 4.55
56 processes: 53 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 24.6% 0.0% 0.8% 0.0% 6.2% 0.0% 68.3%
cpu00 48.8% 0.0% 1.6% 0.0% 0.0% 0.0% 49.6%
cpu01 0.0% 0.0% 0.0% 0.0% 24.8% 0.0% 75.2%
cpu02 49.6% 0.0% 1.8% 0.0% 0.0% 0.0% 48.6%
cpu03 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 100.0%
Mem: 2061424k av, 578440k used, 1482984k free, 0k shrd, 141720k buff
202260k active, 215288k inactive
Swap: 2618512k av, 0k used, 2618512k free 185600k cached


Ho la macchina in questo stato questi valori mi preccupano un po
load average: 2.89, 4.16, 4.55.

Sulla macchina gira solamente un database è è lui che mi manda in affanno la cpu

25255 postgres 25 0 6332 6332 4204 R 16.2 0.3 0:05 3 postmaster
25264 postgres 25 0 6316 6316 4204 R 15.9 0.3 0:03 2 postmaster
25262 postgres 25 0 6316 6316 4204 R 14.9 0.3 0:03 2 postmaster
25259 postgres 25 0 6324 6324 4204 R 13.9 0.3 0:05 0 postmaster
25257 postgres 25 0 6312 6312 4204 R 12.0 0.3 0:04 2 postmaster
25265 postgres 23 0 5384 5384 4204 R 5.2 0.2 0:01 1 postmaster
25267 postgres 23 0 6284 6284 4172 R 2.5 0.3 0:00 3 postmaster
25269 postgres 23 0 6280 6280 4172 R 2.4 0.3 0:00 0 postmaster
25270 postgres 23 0 6284 6284 4172 R 2.3 0.3 0:00 3 postmaster

oltre ad un intervento hardware come potrei ottimizzare la macchina? o meglio il db? potrebbero essere delle query molto pesanti?
Con una indicizzazione potrei migliorare la situazione?


Grazie
Hai una macchina multiprocessore, quindi un load average sopra all'1 non è preoccupante. Se la macchina è un biproc+HT un carico attorno al 2 dovrebbe essere la norma, se i processori sono proprio 4 allora un carico come quello che hai indicato non è niente di preoccupante, anzi.

texerasmo
19-04-2006, 12:17
in questo caso la cpu è scarica ma arrivo a valori di 100%

CPU states: cpu user nice system irq softirq iowait idle
total 98.6% 0.0% 1.3% 0.0% 0.0% 0.0% 0.0%
cpu00 99.0% 0.0% 1.0% 0.0% 0.0% 0.0% 0.0%
cpu01 98.0% 0.0% 2.0% 0.0% 0.0% 0.0% 0.0%
cpu02 99.0% 0.0% 1.0% 0.0% 0.0% 0.0% 0.0%
cpu03 98.6% 0.0% 1.4% 0.0% 0.0% 0.0% 0.0%



il problema dovrebbe essere delle query suppongo questo perchè facendo
top c

9408 postgres 25 0 6352 6352 4224 R 11.6 0.3 0:03 2 postgres: postgres site_metro_db x.X.X.X SELECT
9414 postgres 25 0 5592 5592 4252 R 6.4 0.2 0:01 3 postgres: postgres site_metro_db x.X.X.X SELECT
9415 postgres 25 0 5592 5592 4252 R 3.4 0.2 0:00 1 postgres: postgres site_metro_db x.X.X.X SELECT
941

es spesso raggiungo alnche il 30% per un query.

Tu sai come posso vedere quali sono le select che impegnano di + òa macchina?

texerasmo
19-04-2006, 12:33
faccio una cosa del genere ma non riesco a capirci nulla

tcpdump -X -x -s 8192 -i any port 5432

linux_goblin
19-04-2006, 19:43
ciao, con tcpdump intercetti le query che viaggiano via rete... non so se è la soluzione migliore.

ti consiglio un paio di link
http://www.varlena.com/GeneralBits/Tidbits/perf.html
http://www.revsys.com/writings/postgresql-performance.html

in particolare nel secondo ti spiega l'index e le statistics che ti dovrebbero aiutare a capire dove sta il problema.

spero di esserti stato utile,
Marco - Goblin

texerasmo
20-04-2006, 16:02
grazie abilitando alcune opzioni di postgres sono riuscito a prendere la query che rompe...