php app performance / sydney php
TRANSCRIPT
1
PHP#Sydney#April#2014#
[email protected]#@HZeitlhofer#
PHP#Applica=on#Performance#
Harald#Zeitlhofer##
2
• Technology#Strategist#at#Dynatrace#• Database#and#Web#Development#
• PHP#for#more#than#15#years#
• Always#up#for#new#things#
Harald#Zeitlhofer#
3
Applica'on*Performance*
4
Failures happen!
Nobody likes it when …
5
Unless you work for
Google or Microsoft !
6
… or this …
7
8
... as it leads to ...
9
10
... and finally to ...
11
12
Yes, failures happen!!
but we can identify and/or avoid them !
13
~*20*%#
14
Performance#Tools#
15
some*use*cases*and*best*prac'ces*
16
17
Not#following#Web#Performance#Best#Prac=ces# 282!$Objects#on#that#page#
9.68MB#Page#Size#
8.8s$Page#Load#Time#
Most#objects#are#images#delivered#from#the##
main#domain#
18
Overloaded#pages,#lots#of#sta=c#content#
434$Resources$in#total#on#that#page:#230#JPEGs,#75#PNGs,#50#GIFs,#…#
total%page%size%20$MB$!!!#
19
pack*JS,*CSS*files**
use*sprites*for*images**
use*proper*caching***
20
cached#content#
can#s=ll#create#roundtrips##to#the#network!#
21
Web#Request#handling#
run#PHP#in#external#process#rather#than#loaded#into#apache.#consider#using#Nginx#+#PHP^FPM#
22
mind*your*environment**
configure*properly**
23
24
frustrated#users#
slow#user#ac=on#response#=me#
25
errors#in#PHP#execu=on#
26
iden'fy*response*'me*hotspots*
27
less#library#caused#performance##
hotspot#
drill*down*to*find*the*root*cause*
28
know*your*code**
know*your**external*libraries*
*
29
30
31
/katgrp/browse#
32
/katgrp/get/$/1626#
33
/cave/browse/gis/$/katgrp/1626#
34
/cave/browse/gis/$/katgrp/1626#–#applica=on#context#
35
Sessions#in#PHP#
• session_start()#locks#the#file#where#session#data#are#stored#• Released#when#script#ends#• Use#session_write_close()#to#unlock#the#file#before#execu=ng#slower#code#• Or#create#your#own##session#handler#with##session_set_save_handler()#
36
Looks#beher#now…#
37
38
performance#hotspot#/en/externalprice/#
39
response#=me##hotspot#PHP#
40
session#data#locking#
response#=me#hotspot:#usleep();*
41
be*careful*with*locking**
only*lock*when*required,*release*lock*
as*soon*as*possible*
42
Locking#problem#solved,#but#…#
43
/katgrp/browse#server#side#execu=on#
=me#to#check##the#database#
44
From#the#DB#perspec=ve#
Check#for#proper#indexes!##Occasionally#full#table#scans#are#performed#even#though#indexes##are#available,#especially#in#complex#queries.#Some=mes#only#a#rewrite#of#the#query#helps.#
45
Here#we#go:#
46
mind*the*database*!!!**
47
anything#else#we#can#do?#
what*about**3rd*party*content?*
48
3rd#party#content#
49
3rd#party#content#
50
watch*external*services**
be*aware*there*are*services*you**can't*control*
*
51
But still, failures happen!!
identify them as soon
as possible
52
End^To^End#Transac=on#Monitoring#
53
... to make sure that ...
54
55
• Load#Generator##(Apache#Benchmark,#Selenium,#JMeter)#
• Firebug,#Google#Developer#Tools#Dynatrace#Ajax#Edi=on#
• Google#PageSpeed#• Dynatrace#Free#Trial#
• Free#trial#license#for#30#days#
• Free#personal#license#for#developers#
My#favorite#tools#
hhp://bit.ly/dhrial#
56
www.dynatrace.com#
Thank#you#!!!#
Harald*Zeitlhofer*Senior#Technology#Strategist#
#HZeitlhofer#[email protected]#
hhp://blog.dyntrace.com#