Professional Documents
Culture Documents
Davor Guttierrez
dguttierrez@me.com
3 Gen d.o.o.
Davor Guttierrez
3 Gen d.o.o
since 1996
located in Ljubljana; Slovenia
33 emploees
large !"# main$rame sstems and
%&!'(oriented sstems along )it* databases
more on ))).3Gen.si or $aceboo+.com,3GenS!
Agenda
-*at is optimization.
Server optimization
/er$ormance monitoring
"enc*mar+ing 2ools
What is optimization?
disk !", block devices, #A$ or different filesystems (including %&% and %%$ devices),
kernel,
firewall etc.
as well as
8/%
&et)or+
!,3
#emor
CPU
conte4t s)itc*5
run Cueue5
cpu utilization5
load average.
Context Switch
2*is indicates t*e average 8/% load over a speci$ic time period.
Load average o$ G=.>? 1.>= 1.9=H indicates t*at t*e load on t*e
sstem is coming do)n. =.>? is t*e load average in t*e last 1 minute.
1.>= is t*e load average in t*e last ? minutes. 1.9= is t*e load
average in t*e last 1? minutes.
Linu4 currentl s*ips )it* $our di$$erent !,3 sc*edulers. 2*e areB deadline5 noop5
anticipator5 and c$C. 2*ere are man di$$erences bet)een t*ese sc*eduling
algorit*msB
8IJB 2*is is t*e de$ault algorit*m in most Linu4 distributions. !t attempts to distribute
all !,3 band)idt* evenl among all processes reCuesting !,3. !t is ideal $or most
purposes.
&33/B 2*e noop algorit*m attempts to use as little cpu as possible. !t acts as a basic
I!I3 Cueue e4pecting t*e *ard)are controller to *andle t*e per$ormance operations
o$ t*e reCuests.
6nticipatorB 2*is algorit*m attempts to reorder all dis+ !,3 operations to optimize dis+
see+s. !t is designed to increase per$ormance on sstems t*at *ave slo) dis+s.
DeadlineB 2*is sc*eduling algorit*m places !,3 reCuests in a priorit Cueue so eac* is
guaranteed to be ran )it*in a certain time. !t is o$ten used in real(time operating
sstems.
System scheduler how to change
cat /sys/block/sda/queue/scheduler
c*ange it )it*B
Iilesstem to useB
;'2>
;'23
EeiserIS
;'2@
"2EIS
%se IS options in $stab 0noatime5 ...1
Disk I/O optimization
E6!D=
E6!D1
E6!D1=
Disk optimization
Use hdparm
cubicB 8%"!8(28/
bicB "!8(28/
Linu4 sstem )ill s)ap )*en it needs more memor. i.e )*en it needs
more memor t*an t*e p*sical memor
-*en it s)aps5 it )rites t*e least used memor pages $rom t*e p*sical
memor to t*e s)ap space on t*e dis+
Muge /ages
S)apping be*avior
NUMAD
Iedora 1A
/rovides pre(placement advice $or t*e best initial process placement and
resource a$$init.
Huge Pages
Iile cac*e
Iree pagecac*e
ec*o 1 R ,proc,ss,vm,dropKcac*es
Iree slabcac*e
ec*o > R ,proc,ss,vm,dropKcac*es
De$ault ( 6=F
vmstat
netstat
ps
top
atop5 *top
mtop
!ostat
4osvie)
Kernel Tuning
Samba tuning
oportunistic lo+cing
log level
Database optimization
3ptimize table
2*e most important tuning aspect $or 3penLD6/ is deciding )*at attributes
ou )ant to build inde4es on.
8ac*esize 1====
dbcac*esize 1=====
sizelimit 1====
loglevel =
dbcac*e&o-snc
inde4 cn5uid
inde4 uidnumber
inde4 gid
inde4 gidnumber
inde4 mail
%se optimizers
%se memcac*e
6$ter *aving a list o$ potential issues5 dive into eac* one o$ t*em
and eliminate an non issues
;(mailB dguttierrez@me.com
8ompanB ))).3Gen.si
"logB ))).d(mas*ina.net
8NB ))).guttierrez.org