Slide 1

Slide 1 text

@HypertextRanch [email protected] xyu.io xyu     Better Performance & Uptime Through Async WordCamp Maine 2016

Slide 2

Slide 2 text

 Automattic — Data Infrastructure Team

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

 22,000,000,000 Page Views 3,500,000,000 Uniques 110,000,000 Blogs

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

1 MILLION MODULES 1 MILLION MODULES

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

22 Billion Views × 100ms = 69 Person Years

Slide 11

Slide 11 text

Asynchronous Programing

Slide 12

Slide 12 text

B A C

Slide 13

Slide 13 text

B A C

Slide 14

Slide 14 text

C A B

Slide 15

Slide 15 text

C A B

Slide 16

Slide 16 text

C A B

Slide 17

Slide 17 text

C A B

Slide 18

Slide 18 text

 Don’t Block The Critical Path

Slide 19

Slide 19 text

C A B

Slide 20

Slide 20 text

C A B D

Slide 21

Slide 21 text

C A B D

Slide 22

Slide 22 text

C A B E D

Slide 23

Slide 23 text

https://developers.google.com/web/fundamentals/performance/critical-rendering-path/analyzing-crp

Slide 24

Slide 24 text

https://developers.google.com/web/fundamentals/performance/critical-rendering-path/analyzing-crp

Slide 25

Slide 25 text

Load Jetpack & WordPress.com Stats Async

Slide 26

Slide 26 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 27

Slide 27 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 28

Slide 28 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 29

Slide 29 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 30

Slide 30 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 31

Slide 31 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 32

Slide 32 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 33

Slide 33 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 34

Slide 34 text

_stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] );

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

Asynchronous Processing

Slide 37

Slide 37 text

C A B

Slide 38

Slide 38 text

B A C

Slide 39

Slide 39 text

Asynchronous Processing Queues

Slide 40

Slide 40 text

C A B

Slide 41

Slide 41 text

Counting Uniques — Naïve Approach

Slide 42

Slide 42 text

B A C

Slide 43

Slide 43 text

Counting Uniques — Actual Approach

Slide 44

Slide 44 text

C A B

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Processing Pixels • Loggers • Aggregator & Preprocessor • Kafka Queue • ETL Pipeline • Hive Datastore • Counting Uniques • Export Results to MySQL

Slide 48

Slide 48 text

WP Cron — Schedule Async Hooks

Slide 49

Slide 49 text

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

B A C

Slide 52

Slide 52 text

C A B

Slide 53

Slide 53 text

@HypertextRanch [email protected] xyu.io xyu     Thanks!