How to avoid the latency trap and lessons  about software design
Tom Hughes-Croucher <ul><li>@sh 1 mmer </li></ul>
What is the latency trap?
Mobile
Web Service My Server
My Server Web Service
Optical Fibre
Web Service AT&T
Radio Waves
Web Service AT&T
AT&T Web Service
AT&T Web Services
Bigger than mobile?
 
Wifi sucks.
Ofcom study <ul><li>UK study into Wifi interfence (PDF) </li></ul><ul><li>Upto 90% of bandwidth used on protocol </li></ul...
Interference sucks.
So how do we fix it?
1. Reduce Requests
AT&T Web Services
Server Web Services AT&T
Reducing requests <ul><li>Yahoo! Performance Guidelines </li></ul><ul><ul><li>http://developer.yahoo.com/performance </li>...
2. Shape to packets
Indiana Packet and the Byte of Doom
Packet #1 Payload ..................................................................... .....................................
1 extra byte means  1 extra packet 1 extra packet
Reduce number of packets
Packet sizes <ul><li>Make sure static assets (JS, images, etc) fit in discrete packet boundaries </li></ul><ul><ul><li>Don...
Packet Research <ul><li>http://developer.yahoo.net/blog/archives/2009/10/a_engineers_gui.html </li></ul>
<ul><li>What is YQL? </li></ul><ul><li>Why is YQL  bad-ass  for mobile development? </li></ul><ul><li>How you can use YQL ...
What is YQL?
 
var map = new YMap(document.getElementById('map'));…var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon );  map.addMarker(...
var map = new YMap(document.getElementById('map'));…var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon );  map.addMarker(...
YQL Bindings http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c … if (flickcurl_prepare(fc, &quot;flickr.photos.geo.c...
YQL <ul><li>Unified interface to Web services </li></ul><ul><li>Self-describing to avoid documentation </li></ul><ul><li>U...
YQL is like SQL <ul><li>Uses SQL verbs </li></ul><ul><li>Uses SQL syntax </li></ul><ul><li>Returns rows of data </li></ul>...
Verbs <ul><li>show -  show tables; </li></ul><ul><li>desc -  desc search.web; </li></ul><ul><li>select -  select * from fl...
Demo <ul><li>http://developer.yahoo.com/yql/console </li></ul>
Server Web Services AT&T
YQL Example
select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where query = “lolcats”)
Conclusion <ul><li>Latency hurts anything wireless </li></ul><ul><li>Fight latency by reducing connections </li></ul><ul><...
Application design <ul><li>Web </li></ul><ul><ul><li>Stateless scales </li></ul></ul><ul><ul><li>Statelessness allows “com...
ReST <ul><li>Representational State Transfer </li></ul><ul><li>Roy Fielding Dissertation </li></ul><ul><li>Transfer state ...
follow me on twitter.com/sh 1 mmer <ul><li>Slides? Feedback?  </li></ul><ul><li>www.speakerrate.com/ sh1mmer </li></ul>
Upcoming SlideShare
Loading in …5
×

How to avoid the latency trap and lessons about software design

1,950 views
1,869 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,950
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
13
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Lets take an example of a developer trying
  • How to avoid the latency trap and lessons about software design

    1. 1. How to avoid the latency trap and lessons about software design
    2. 2. Tom Hughes-Croucher <ul><li>@sh 1 mmer </li></ul>
    3. 3. What is the latency trap?
    4. 4. Mobile
    5. 5. Web Service My Server
    6. 6. My Server Web Service
    7. 7. Optical Fibre
    8. 8. Web Service AT&T
    9. 9. Radio Waves
    10. 10. Web Service AT&T
    11. 11. AT&T Web Service
    12. 12. AT&T Web Services
    13. 13. Bigger than mobile?
    14. 15. Wifi sucks.
    15. 16. Ofcom study <ul><li>UK study into Wifi interfence (PDF) </li></ul><ul><li>Upto 90% of bandwidth used on protocol </li></ul><ul><li>Many other sources of interference </li></ul><ul><ul><li>Baby monitors </li></ul></ul><ul><ul><li>Microwaves </li></ul></ul><ul><ul><li>Cordless Phones </li></ul></ul>
    16. 17. Interference sucks.
    17. 18. So how do we fix it?
    18. 19. 1. Reduce Requests
    19. 20. AT&T Web Services
    20. 21. Server Web Services AT&T
    21. 22. Reducing requests <ul><li>Yahoo! Performance Guidelines </li></ul><ul><ul><li>http://developer.yahoo.com/performance </li></ul></ul><ul><li>Reduce web service requests </li></ul><ul><ul><li>Bundle requests from device logically </li></ul></ul><ul><ul><li>Gzip all web service responses </li></ul></ul>
    22. 23. 2. Shape to packets
    23. 24. Indiana Packet and the Byte of Doom
    24. 25. Packet #1 Payload ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ..................................................................... ........................................................... Packet #2 Payload .
    25. 26. 1 extra byte means 1 extra packet 1 extra packet
    26. 27. Reduce number of packets
    27. 28. Packet sizes <ul><li>Make sure static assets (JS, images, etc) fit in discrete packet boundaries </li></ul><ul><ul><li>Don’t forget Gzip </li></ul></ul><ul><li>Try and figure out ‘high latency’ connections to send inlined assets to </li></ul><ul><ul><li>E.g. detect ‘iPhone’ </li></ul></ul>
    28. 29. Packet Research <ul><li>http://developer.yahoo.net/blog/archives/2009/10/a_engineers_gui.html </li></ul>
    29. 30. <ul><li>What is YQL? </li></ul><ul><li>Why is YQL bad-ass for mobile development? </li></ul><ul><li>How you can use YQL in mobile development </li></ul><ul><li>Examples </li></ul>
    30. 31. What is YQL?
    31. 33. var map = new YMap(document.getElementById('map'));…var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint);… … if (flickcurl_prepare(fc, &quot;flickr.photos.geo.correctLocation&quot;, parameters, count)) { … } … http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c ? ? ? ?
    32. 34. var map = new YMap(document.getElementById('map'));…var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint);… … if (flickcurl_prepare(fc, &quot;flickr.photos.geo.correctLocation&quot;, parameters, count)) { … } … http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c ? ? ? ?
    33. 35. YQL Bindings http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c … if (flickcurl_prepare(fc, &quot;flickr.photos.geo.correctLocation&quot;, parameters, count)) { … } … http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2 var map = new YMap(document.getElementById('map'));…var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint);…
    34. 36. YQL <ul><li>Unified interface to Web services </li></ul><ul><li>Self-describing to avoid documentation </li></ul><ul><li>Uses a common way to return data </li></ul>
    35. 37. YQL is like SQL <ul><li>Uses SQL verbs </li></ul><ul><li>Uses SQL syntax </li></ul><ul><li>Returns rows of data </li></ul><ul><li>Self-describing </li></ul><ul><ul><li>show tables; </li></ul></ul><ul><ul><li>desc table; </li></ul></ul>
    36. 38. Verbs <ul><li>show - show tables; </li></ul><ul><li>desc - desc search.web; </li></ul><ul><li>select - select * from flickr.photos.recent; </li></ul><ul><li>use </li></ul><ul><li>insert </li></ul><ul><li>update </li></ul><ul><li>delete </li></ul>
    37. 39. Demo <ul><li>http://developer.yahoo.com/yql/console </li></ul>
    38. 40. Server Web Services AT&T
    39. 41. YQL Example
    40. 42. select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where query = “lolcats”)
    41. 43. Conclusion <ul><li>Latency hurts anything wireless </li></ul><ul><li>Fight latency by reducing connections </li></ul><ul><li>Fight latency by reducing the number of unnecessary packets </li></ul><ul><li>YQL can help you bundle your requests to mobile device without a dedicated backend </li></ul>
    42. 44. Application design <ul><li>Web </li></ul><ul><ul><li>Stateless scales </li></ul></ul><ul><ul><li>Statelessness allows “combining” </li></ul></ul><ul><ul><li>Statelessness encourages single-purpose functions </li></ul></ul><ul><ul><li>RESTful! </li></ul></ul>
    43. 45. ReST <ul><li>Representational State Transfer </li></ul><ul><li>Roy Fielding Dissertation </li></ul><ul><li>Transfer state with each request </li></ul>
    44. 46. follow me on twitter.com/sh 1 mmer <ul><li>Slides? Feedback? </li></ul><ul><li>www.speakerrate.com/ sh1mmer </li></ul>

    ×