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

Time To First Tweet

Time To First Tweet

As delivered at Velocity 2012 by myself and @sayrer

danwrong

June 27, 2012
Tweet

More Decks by danwrong

Other Decks in Programming

Transcript

  1. Time To First Tweet From navigation to the user seeing

    the timeline Wednesday, June 27, 12
  2. Navigation Timing API • Supported in: IE 9, Firefox 7

    and Chrome • Represents a vast majority of twitter.com users • We capture data from a small % of users Wednesday, June 27, 12
  3. •Connect: navigation to connection open •Process: connection open to first

    byte •Response: first byte to last byte of response •Render: last byte until tweet shown* * Measured with a JS timestamp embedded in timeline Wednesday, June 27, 12
  4. Loading JavaScript • We moved to modules (CommonJS via AMD)

    • Decouples loading from evaluation • Build tool spiders dependencies and make bundles • Now we can play with the loading without changing the code • Lazy loading, Parallel loading, different bundles Wednesday, June 27, 12
  5. Layering On pushState support • We want fast in-app navigation

    • Avoid full page refreshes for newer browsers • Ability to keep assets/former pages in memory • Keep simple index-ability, browser compat etc • We can have the best of both worlds Wednesday, June 27, 12
  6. In the browser.... On click, if history API supported then

    intercept link and request the link’s URL via XHR Wednesday, June 27, 12
  7. On the server... If request comes via XHR send just

    the partial update, otherwise send the entire HTML page Wednesday, June 27, 12
  8. What’s next? • We aren’t done yet • Replace Rails

    with an async, JVM-based server • Concurrent data fetches • Chunked body encoding, streamed responses Wednesday, June 27, 12