Projectpaas drupaljam 2013 rotterdam

64

Transcript of Projectpaas drupaljam 2013 rotterdam

Page 1: Projectpaas drupaljam 2013 rotterdam
Page 2: Projectpaas drupaljam 2013 rotterdam
Page 3: Projectpaas drupaljam 2013 rotterdam
Page 4: Projectpaas drupaljam 2013 rotterdam

A little less conversation

•Maurits Lawende

•Bert Boerland

•@projectpaas

•https://www.facebook.com/projectpaas

140

Page 5: Projectpaas drupaljam 2013 rotterdam

Define Define PerformancePerformance

•SnelheidSnelheid

•BeschikbaarheidBeschikbaarheid

•StabiliteitStabiliteit

Page 6: Projectpaas drupaljam 2013 rotterdam

Non Functional Non Functional RequirementRequirement

•Meer contentMeer content

•Meer gebruikersMeer gebruikers

•Meer hitsMeer hits

•Meer codeMeer code

•...zelfde hardware...zelfde hardware

Page 7: Projectpaas drupaljam 2013 rotterdam

AgendaAgenda•Waarom performanceWaarom performance

•Wat is performance Wat is performance

•Wat doet ProjectPAASWat doet ProjectPAAS

•Hoe doet ProjectPAASHoe doet ProjectPAAS

•Tooling en tipsTooling en tips

•FreebeeFreebee

Page 8: Projectpaas drupaljam 2013 rotterdam

Waarom performance

Page 9: Projectpaas drupaljam 2013 rotterdam

Waarom performance

Page 10: Projectpaas drupaljam 2013 rotterdam

Waarom performance

Page 11: Projectpaas drupaljam 2013 rotterdam

Waarom performance

Page 12: Projectpaas drupaljam 2013 rotterdam

Waarom performance

Page 13: Projectpaas drupaljam 2013 rotterdam

Waarom Waarom performanceperformance

Als je een business case hebt voor een Als je een business case hebt voor een websitewebsite

ben je deze kwijt als je te langzaam ben je deze kwijt als je te langzaam bent...bent...

Page 14: Projectpaas drupaljam 2013 rotterdam

Touch downTouch down

•Acroniemensoep:Acroniemensoep:

•RUM, HAR, EC2,CDN, WCO, FEO, RUM, HAR, EC2,CDN, WCO, FEO, SPDYSPDY

•BS BingoBS Bingo

•Frontend, Backend, Request Frontend, Backend, Request reduction, data URI, Sprite, reduction, data URI, Sprite, closure compiler, reverse proxyclosure compiler, reverse proxy

Page 15: Projectpaas drupaljam 2013 rotterdam

Time to glassTime to glass

•0,1 seconde, voelt als instant0,1 seconde, voelt als instant

•1.0 seconde, in de flow1.0 seconde, in de flow

•10,0 seconde, aandachtslimiet10,0 seconde, aandachtslimiet

•““perceptie van snelheid”perceptie van snelheid”

Page 16: Projectpaas drupaljam 2013 rotterdam
Page 17: Projectpaas drupaljam 2013 rotterdam
Page 18: Projectpaas drupaljam 2013 rotterdam
Page 19: Projectpaas drupaljam 2013 rotterdam

80% frontend80% frontend 20% backend20% backendPerformance is enkel100% relevant in de browserPerformance is enkel100% relevant in de browser

Page 20: Projectpaas drupaljam 2013 rotterdam

Bij mij is ‘ie wel Bij mij is ‘ie wel snelsnel

Page 21: Projectpaas drupaljam 2013 rotterdam

Want ik ben Want ik ben centrum van de centrum van de

wereldwereld

Page 22: Projectpaas drupaljam 2013 rotterdam

Maar we zijn toch Maar we zijn toch heel snel?heel snel?

Page 23: Projectpaas drupaljam 2013 rotterdam

Gecachde waterval

Page 24: Projectpaas drupaljam 2013 rotterdam

MetricsMetrics

•Als je het niet kan metenAls je het niet kan metenkan je het niet verbeteren.kan je het niet verbeteren.

•ProjectPAAS meet 100 metrics, ProjectPAAS meet 100 metrics, analyseert en rapporteert hieroveranalyseert en rapporteert hierover

Page 25: Projectpaas drupaljam 2013 rotterdam

FrontendFrontend(20%)(20%)

100% browser100% browser

MiddleMiddle(30%)(30%)

BackendBackend(50%)(50%)

Page 26: Projectpaas drupaljam 2013 rotterdam

Wat doet uWat doet u

• Installeer d.o/project/paas op dev Installeer d.o/project/paas op dev serverserver

•Configureer op portaal (basic auth, Configureer op portaal (basic auth, 100 populaire URL’s, tijd...)100 populaire URL’s, tijd...)

•Wacht 6 uurWacht 6 uur

Page 27: Projectpaas drupaljam 2013 rotterdam

Wat doen wij?Wat doen wij?•Controlen module werking / keyControlen module werking / key

•Starten EC2 instantie(s)Starten EC2 instantie(s)

•Meten 100+ metrics (met / zonder, Meten 100+ metrics (met / zonder, screenshots, latency....)screenshots, latency....)

•Analyseren tegen baselineAnalyseren tegen baseline

•Doen aanbeveling in PDF (plus Doen aanbeveling in PDF (plus files)files)

•Mailen u Mailen u

Page 28: Projectpaas drupaljam 2013 rotterdam
Page 29: Projectpaas drupaljam 2013 rotterdam
Page 30: Projectpaas drupaljam 2013 rotterdam
Page 31: Projectpaas drupaljam 2013 rotterdam
Page 32: Projectpaas drupaljam 2013 rotterdam
Page 33: Projectpaas drupaljam 2013 rotterdam
Page 34: Projectpaas drupaljam 2013 rotterdam
Page 35: Projectpaas drupaljam 2013 rotterdam

Tooling ‘n TipsTooling ‘n TipsTools voor infrastructuur- ec2- lamp- python- nodejs- java- drupal 7- latex- twig- graphviz- flot (graphs)

Tools voor metingen en analyse- custom client module- phantom- custom proxy in python- kyotocabinet (storage voor proxy)- R project (statistics)- imagemagick- pngcrush- optipng- csstidy- openssl- libjpeg- cairo (graphics library)- closure compiler- ab- sabberworm (css analyse)- yslow- shadow

Page 36: Projectpaas drupaljam 2013 rotterdam

DNSDNS

NetworkNetwork

Page 37: Projectpaas drupaljam 2013 rotterdam

Nu.nl spot the SPOF

Page 38: Projectpaas drupaljam 2013 rotterdam

TC: 352 elementen72 domains

Page 39: Projectpaas drupaljam 2013 rotterdam

CDN / ParallelCDN / Parallel

- Vroeger meer hits- Toen dichter bij / minder latency- Nu met name anti dDOS- default cookieloos- niet default sneller

Page 40: Projectpaas drupaljam 2013 rotterdam
Page 41: Projectpaas drupaljam 2013 rotterdam

BandbreedteBandbreedte

Mbps heeft Mbps heeft nietsniets met snelheid te met snelheid te makenmaken

Page 42: Projectpaas drupaljam 2013 rotterdam
Page 43: Projectpaas drupaljam 2013 rotterdam
Page 44: Projectpaas drupaljam 2013 rotterdam

WebWeb

Page 45: Projectpaas drupaljam 2013 rotterdam

Best hit is no hitBest hit is no hit(less is more)(less is more)

SPDY (compressie, binair)Multipart responseServers dichtbij (CDN)Minder requests

Page 46: Projectpaas drupaljam 2013 rotterdam

Apache multipart Apache multipart responseresponse

Content-Type: multipart/mixed; boundary="..."

Onderseund in recente versies FF, Chrome + iE < 7

Niet hoe HTTP werkt, 'multipart requests' bestaan niet (vraag A op, geef ABC terug)0.000184% usage volgens Mozilla teamGeen ondersteuning in Apache / NginX

Page 47: Projectpaas drupaljam 2013 rotterdam

Cache expiration Cache expiration junglejungle

- Cache Control- Expires- Last Modified- ETag- Age- Pragma

Page 48: Projectpaas drupaljam 2013 rotterdam

Gebruik geen Gebruik geen HTTPS!HTTPS!

Tuurlijk welMaar default 24-32% trager!Apache heeft standaard 28 chipher suits9 max nodigHTTPS niet in varnish zonder SSL offloader

Page 49: Projectpaas drupaljam 2013 rotterdam

Gebruik HTTPS!Gebruik HTTPS!

SPDYWordt standaard HTTP/2.0?In gebruik alle sites van google en facebookVereist certificaat (443) (wildcard?)Niet te troubleshooten

Page 50: Projectpaas drupaljam 2013 rotterdam

LoveLove

Page 51: Projectpaas drupaljam 2013 rotterdam

Drupal Memory Drupal Memory usageusage

drush php-eval \"echo format_size(memory_get_usage());"

52.09 MB

Page 52: Projectpaas drupaljam 2013 rotterdam

PHP Memory usagePHP Memory usageInteger is 4 bytes. Maar...typedef union _zvalue_value {

long lval; // long/boolsdouble dval; // doubles/floatsstruct { // strings

char *val; // The string int len; // length

} str;HashTable *ht; // arrays (hash tables)zend_object_value obj; //objects

} zvalue_value;

struct _zval_struct {zvalue_value value; zend_uint refcount__gc; // for the GC, refs to this valuezend_uchar type; //item typezend_uchar is_ref__gc; // is a ref (&)

};

Page 53: Projectpaas drupaljam 2013 rotterdam

PHP Memory usagePHP Memory usage

zvalue_value: 16 byteszval: 8 bytesGarbage Collection: 8 bytes (PHP 5.4)Zend Memory Managers: 16 bytes

PHP 5.3: 40 bytesPHP 5.4: 48 bytes

Page 54: Projectpaas drupaljam 2013 rotterdam

PHP Memory usagePHP Memory usageBucketsBuckets

Bevat de key, pointers naar data, vorige, volgende, eerste, laatste element..

Totaal: 96 bytes

Array van 10 int's heeft 40 bytes data.1 zval met 10 buckets en 10 zvals voor dataTotaal: 1488 bytes (PHP 5.4)37.2 x meer dan in C

Page 55: Projectpaas drupaljam 2013 rotterdam

Drupal memory Drupal memory usageusage

- Modules / include files (± 100 tot 500 KB)- Theme registry (± 10 MB)- Locale cache (± 1 MB)- Static cache (± 1 MB)- Variables (< 100 KB)

Page 56: Projectpaas drupaljam 2013 rotterdam

MySQL is slimMySQL is slim

Relationele databases:DBMS bepaald hoe de data het beste opgehaald kan worden

DBMS weet niet hoe we de data gebruiken

DOM

Page 57: Projectpaas drupaljam 2013 rotterdam

Pagina moet laden Pagina moet laden binnen 2 secondebinnen 2 seconde

•MySQL zal slow query af makenMySQL zal slow query af maken

•Ook als deze 2 uur duurt...Ook als deze 2 uur duurt...

Page 58: Projectpaas drupaljam 2013 rotterdam

CardinaliteitCardinaliteitAantal verschillende waarden in een kolom.

Indexen worden meestal niet gebruikt wanneer cardinaliteit laag is (bijv. 10% van aantal rijen). Gaat uit van gelijke verdeling!

InnoDB doet analyse op selectivity: hoeveel rijen blijven er over na filtering?

Page 59: Projectpaas drupaljam 2013 rotterdam

Union vs ORUnion vs OR

SELECT ... WHERE (a) OR (b)

SELECT ... WHERE (a)UNIONSELECT ... WHERE (b)

Page 60: Projectpaas drupaljam 2013 rotterdam

TrickyTricky

- Grootste deel van de filtering in joined tables- Order by op joined tables- Order by i.c.m. seq. scan- Joins op kolom zonder index (of mogelijkheid tot het gebruik daarvan)

Page 61: Projectpaas drupaljam 2013 rotterdam
Page 62: Projectpaas drupaljam 2013 rotterdam
Page 63: Projectpaas drupaljam 2013 rotterdam

Free ride?Free ride?

Eerste die nu een easter-egg vindt op projectpaas.com en hierover twittert krijgt gratis “pluto” test!

Page 64: Projectpaas drupaljam 2013 rotterdam

Vragen?Vragen?•Harder,

•Faster,

•Stronger,

•Better.

(our work is never over)