Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Better Performance & Uptime Through Async

xyu
May 14, 2016

Better Performance & Uptime Through Async

Asynchronous programming makes your site both faster and more reliable. Let’s peal back the covers of Jetpack Stats and steal some of the concepts that can make our site faster and more stable.

xyu

May 14, 2016
Tweet

More Decks by xyu

Other Decks in Technology

Transcript

  1. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  2. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  3. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  4. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  5. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  6. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  7. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  8. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  9. <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq =

    window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script> <script type='text/javascript' src='https://stats.wp.com/e-201618.js' async defer> </script> <script type='text/javascript'> _stq = window._stq || []; _stq.push( [ 'view', { v:'ext', j:'1:4.0.2', blog:'105573785', post:'0', tz:'-5', srv:'2016.maine.wordcamp.org' } ] ); </script>
  10. Processing Pixels • Loggers • Aggregator & Preprocessor • Kafka

    Queue • ETL Pipeline • Hive Datastore • Counting Uniques • Export Results to MySQL
  11. <?php function some_action( $arg1, $arg2 ) { // do something

    } add_action( 'my_new_event', 'some_action', 10, 2 ); wp_schedule_single_event( time() + 10, // in 10 seconds 'my_new_event', array( $arg1, $arg2 ) );