php app performance / sydney php

56
PHP Sydney April 2014 [email protected] @HZeitlhofer PHP Applica=on Performance Harald Zeitlhofer

Upload: harald-zeitlhofer

Post on 17-Jul-2015

319 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: PHP App Performance / Sydney PHP

1

PHP#Sydney#April#2014#

[email protected]#@HZeitlhofer#

PHP#Applica=on#Performance#

Harald#Zeitlhofer##

Page 2: PHP App Performance / Sydney PHP

2

• Technology#Strategist#at#Dynatrace#• Database#and#Web#Development#

• PHP#for#more#than#15#years#

• Always#up#for#new#things#

Harald#Zeitlhofer#

Page 3: PHP App Performance / Sydney PHP

3

Applica'on*Performance*

Page 4: PHP App Performance / Sydney PHP

4

Failures happen!

Nobody likes it when …

Page 5: PHP App Performance / Sydney PHP

5

Unless you work for

Google or Microsoft !

Page 6: PHP App Performance / Sydney PHP

6

… or this …

Page 7: PHP App Performance / Sydney PHP

7

Page 8: PHP App Performance / Sydney PHP

8

... as it leads to ...

Page 9: PHP App Performance / Sydney PHP

9

Page 10: PHP App Performance / Sydney PHP

10

... and finally to ...

Page 11: PHP App Performance / Sydney PHP

11

Page 12: PHP App Performance / Sydney PHP

12

Yes, failures happen!!

but we can identify and/or avoid them !

Page 13: PHP App Performance / Sydney PHP

13

~*20*%#

Page 14: PHP App Performance / Sydney PHP

14

Performance#Tools#

Page 15: PHP App Performance / Sydney PHP

15

some*use*cases*and*best*prac'ces*

Page 16: PHP App Performance / Sydney PHP

16

Page 17: PHP App Performance / Sydney PHP

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#

Page 18: PHP App Performance / Sydney PHP

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$!!!#

Page 19: PHP App Performance / Sydney PHP

19

pack*JS,*CSS*files**

use*sprites*for*images**

use*proper*caching***

Page 20: PHP App Performance / Sydney PHP

20

cached#content#

can#s=ll#create#roundtrips##to#the#network!#

Page 21: PHP App Performance / Sydney PHP

21

Web#Request#handling#

run#PHP#in#external#process#rather#than#loaded#into#apache.#consider#using#Nginx#+#PHP^FPM#

Page 22: PHP App Performance / Sydney PHP

22

mind*your*environment**

configure*properly**

Page 23: PHP App Performance / Sydney PHP

23

Page 24: PHP App Performance / Sydney PHP

24

frustrated#users#

slow#user#ac=on#response#=me#

Page 25: PHP App Performance / Sydney PHP

25

errors#in#PHP#execu=on#

Page 26: PHP App Performance / Sydney PHP

26

iden'fy*response*'me*hotspots*

Page 27: PHP App Performance / Sydney PHP

27

less#library#caused#performance##

hotspot#

drill*down*to*find*the*root*cause*

Page 28: PHP App Performance / Sydney PHP

28

know*your*code**

know*your**external*libraries*

*

Page 29: PHP App Performance / Sydney PHP

29

Page 30: PHP App Performance / Sydney PHP

30

Page 31: PHP App Performance / Sydney PHP

31

/katgrp/browse#

Page 32: PHP App Performance / Sydney PHP

32

/katgrp/get/$/1626#

Page 33: PHP App Performance / Sydney PHP

33

/cave/browse/gis/$/katgrp/1626#

Page 34: PHP App Performance / Sydney PHP

34

/cave/browse/gis/$/katgrp/1626#–#applica=on#context#

Page 35: PHP App Performance / Sydney PHP

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()#

Page 36: PHP App Performance / Sydney PHP

36

Looks#beher#now…#

Page 37: PHP App Performance / Sydney PHP

37

Page 38: PHP App Performance / Sydney PHP

38

performance#hotspot#/en/externalprice/#

Page 39: PHP App Performance / Sydney PHP

39

response#=me##hotspot#PHP#

Page 40: PHP App Performance / Sydney PHP

40

session#data#locking#

response#=me#hotspot:#usleep();*

Page 41: PHP App Performance / Sydney PHP

41

be*careful*with*locking**

only*lock*when*required,*release*lock*

as*soon*as*possible*

Page 42: PHP App Performance / Sydney PHP

42

Locking#problem#solved,#but#…#

Page 43: PHP App Performance / Sydney PHP

43

/katgrp/browse#server#side#execu=on#

=me#to#check##the#database#

Page 44: PHP App Performance / Sydney PHP

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.#

Page 45: PHP App Performance / Sydney PHP

45

Here#we#go:#

Page 46: PHP App Performance / Sydney PHP

46

mind*the*database*!!!**

Page 47: PHP App Performance / Sydney PHP

47

anything#else#we#can#do?#

what*about**3rd*party*content?*

Page 48: PHP App Performance / Sydney PHP

48

3rd#party#content#

Page 49: PHP App Performance / Sydney PHP

49

3rd#party#content#

Page 50: PHP App Performance / Sydney PHP

50

watch*external*services**

be*aware*there*are*services*you**can't*control*

*

Page 51: PHP App Performance / Sydney PHP

51

But still, failures happen!!

identify them as soon

as possible

Page 52: PHP App Performance / Sydney PHP

52

End^To^End#Transac=on#Monitoring#

Page 53: PHP App Performance / Sydney PHP

53

... to make sure that ...

Page 54: PHP App Performance / Sydney PHP

54

Page 55: PHP App Performance / Sydney PHP

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#

Page 56: PHP App Performance / Sydney PHP

56

www.dynatrace.com#

Thank#you#!!!#

Harald*Zeitlhofer*Senior#Technology#Strategist#

#HZeitlhofer#[email protected]#

hhp://blog.dyntrace.com#