using node.js to improve the performance of mobile apps and mobile web
TRANSCRIPT
![Page 1: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/1.jpg)
Using Node.js to improve the performance of
Mobile apps and Mobile web
Tom Hughes-CroucherJetpacks for Dinosaurs, LLC
[email protected]@sh1mmer
![Page 2: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/2.jpg)
@sh1mmer
Who is Tom?
• Wrote W3C Standards
• 10+ years in the web industry
• Worked on projects for: Tesco, NASA, Walmart, MySpace, etc
• ~5 years at Yahoo! including .com
• Node team at Joyent
Scalable Server-Side Code with JavaScript
Tom Hughes-Croucher
NodeUp and Running
![Page 3: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/3.jpg)
@sh1mmer
• You probably shouldn't let Twitter name your company
• Clients include
• Walmart
• MySpace
• Various Fortune 500 companies
• Multiple stealth startups
![Page 4: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/4.jpg)
@sh1mmer
This is a talk about why cell phones suck.
![Page 5: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/5.jpg)
@sh1mmer
![Page 6: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/6.jpg)
@sh1mmer
Radio waves suck(at least compared to fibre or copper)
![Page 7: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/7.jpg)
@sh1mmer
http://developer.yahoo.com/blogs/ydn/posts/2009/10/a_engineers_gui/
![Page 8: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/8.jpg)
@sh1mmer
Radio vs. buildings
![Page 9: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/9.jpg)
@sh1mmer
![Page 10: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/10.jpg)
@sh1mmer
![Page 11: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/11.jpg)
@sh1mmer
![Page 12: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/12.jpg)
@sh1mmer
http://www.webperformancetoday.com/2012/04/02/mobile-versus-desktop-latency/
Desktop Mobile
![Page 13: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/13.jpg)
@sh1mmerOokla/speedtest.net
via http://www.slideshare.net/patrickmeenan/velocity-2012-taming-the-mobile-beast/22
![Page 14: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/14.jpg)
@sh1mmer
Effect of latency on servers
![Page 15: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/15.jpg)
@sh1mmer
Shielding Frontends
![Page 16: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/16.jpg)
@sh1mmer
nginxhaproxy
ATSvarnish
frontends web services/ data
![Page 17: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/17.jpg)
@sh1mmer
var client = net.connect(80, domain, function() { client.write("GET / HTTP/1.1\r\n"); t1 = (new Date()).getTime(); });
client.on('end', function() { t2 = (new Date()).getTime(); output.write(domain + ' ' + ((t2-t1)/1000) + 's\n'); });
![Page 18: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/18.jpg)
@sh1mmer
macupdate.com 442.3uzai.com 403.658wired.jp 238.848facilisimo.com 205.159mycokerewards.com 202.757rbc.cn 192.354moviesmobile.net 183.157stop55.com 145.927dir.bg 137.982carrefour.fr 112.789sifyitest.com 111.171
Sample of Alexa 5000
![Page 19: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/19.jpg)
@sh1mmer
Event-driven Frontends
![Page 20: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/20.jpg)
@sh1mmer
Client → Server Server → DB
Computation Computation
![Page 21: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/21.jpg)
@sh1mmer
Not an event frontend
![Page 22: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/22.jpg)
@sh1mmer
![Page 23: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/23.jpg)
@sh1mmer
Server
![Page 24: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/24.jpg)
@sh1mmer
Request
![Page 25: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/25.jpg)
@sh1mmer
![Page 26: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/26.jpg)
@sh1mmer
Event-driven frontend
![Page 27: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/27.jpg)
@sh1mmer
Place-holder
![Page 28: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/28.jpg)
@sh1mmer
![Page 29: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/29.jpg)
@sh1mmer
SharedWork
Resources
![Page 30: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/30.jpg)
@sh1mmer
Memory operations
![Page 31: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/31.jpg)
@sh1mmer
var x = "I am a string"
~1ns Running 1 instruction2ns Data from l1 cpu cache5ns Data from l2 cpu cache80ns Data from ram
![Page 32: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/32.jpg)
@sh1mmer
![Page 33: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/33.jpg)
@sh1mmer
Mobile latency
![Page 34: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/34.jpg)
@sh1mmer
![Page 35: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/35.jpg)
@sh1mmerCat
100 Blue Whales
![Page 36: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/36.jpg)
@sh1mmer
"They went from running 15 servers with 15 instances (virtual servers) on each physical machine, to just four instances that can handle double the traffic."
http://venturebeat.com/2011/08/16/linkedin-node/
![Page 37: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/37.jpg)
@sh1mmer
Not just simple applications
![Page 38: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/38.jpg)
@sh1mmer
![Page 39: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/39.jpg)
@sh1mmer
![Page 40: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/40.jpg)
@sh1mmer
First page load vs. Client MVC
![Page 41: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/41.jpg)
![Page 42: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/42.jpg)
@sh1mmer
![Page 43: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/43.jpg)
@sh1mmerhttp://www.belshe.com/2010/05/24/more-bandwidth-doesnt-matter-much/
![Page 44: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/44.jpg)
@sh1mmer
Bandwidth
Latency Device capability
![Page 45: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/45.jpg)
@sh1mmer
Barfing data at 3G
![Page 46: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/46.jpg)
@sh1mmer
![Page 47: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/47.jpg)
@sh1mmer
![Page 48: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/48.jpg)
@sh1mmer
Clientside templating
![Page 49: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/49.jpg)
@sh1mmer
![Page 50: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/50.jpg)
@sh1mmer
Node.js allows you to tune rendering between client and server based on the network.
![Page 51: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/51.jpg)
@sh1mmer
HTML JSON
More bandwidth
Less client processing
Less bandwidth
More client processing
Battery friendly Cheaper for you bandwidth/server
Cheaper for them bandwidth
![Page 52: Using Node.js to improve the performance of Mobile apps and Mobile web](https://reader033.vdocument.in/reader033/viewer/2022050613/546e88d1af7959ed048b712e/html5/thumbnails/52.jpg)
@sh1mmer
Summary
• Node.js allows you to:
• Manage resources with unreliable mobile data connections
• Choose where to apply rendering
• Pick the right rendering solution for the right scenario