Give Responsive Design a Mobile Performance Boost at ModUXcon
RESS, Adaptive, call it what you want.... This presentation is about how we can use the server to increase performance front end. Great performance front end, starts at the back end.
drop in revenue http://www.slideshare.net/stubbornella/designing-fast-websites-presentation http://slideshare.net/markstanton/speed-matters SLOW IS NOT COOL ...even less cool on mobile fredag 20. september 13
2Mbps (cisco) • 1 Mbps = 0.12 MB/s • 1.6 / 0.24 = 6,7s 6, 7Seconds download time Hold that thought... more on this later. http://www.cisco.com/en/US/solutions/collateral/ns341/ns525/ns537/ns705/ns827/white_paper_c11-520862.html fredag 20. september 13
roundtrip •Depends....(DNS, pipelining, concurrent TCP connections etc.) 9, 4Seconds latency in total Hold that thought... more on this now. fredag 20. september 13
(one time) •TCP and DNS (one time) •94 round trips (6 req pr conn.) •Downloading 1.6 mb over 2Mbps 10,6Seconds total + rendering time in the browser + server response time Disclaimer: lots of assumptions in this calculation! fredag 20. september 13
Device Detection In the case of Mashable, we also detect the type of device and change the site’s behavior accordingly. “ ” http://www.circleid.com/posts/20120111_analysis_of_server_side_mobile_web_detection/ http://mashable.com/2012/12/11/responsive-web-design/ fredag 20. september 13
Feature Detection var appCache= function() { return !!window.applicationCache; }; Device Detection GET http://ddr.demo.wew.io/c/dual_orientation Using the User-Agent (++) as a key to look up in a data base. fredag 20. september 13
knowledge” • “Business rules” • Specifics to your site • Override feature detected features • If a feature works, but not well enough to make it useable • False positives (not a HUGE issue, but still) • Available server side too • Adapt and optimize stuff before sending to client fredag 20. september 13
knowledge” • “Business rules” • Specifics to your site • Override feature detected features • If a feature works, but not well enough to make it useable • False positives (not a HUGE issue, but still) • Available server side too • Adapt and optimize stuff before sending to client Device Description Repository fredag 20. september 13
excess styles Examples and documentation: https://github.com/whateverweb/CSS-processor @media (-‐wew-‐pointing-‐method: touchscreen){ a { padding: 10px; } } @media all and (min-‐width: 1500px){ //removed for devices where 1500px is impossible. e.g. iPhones body{color: green;} } fredag 20. september 13
excess styles Examples and documentation: https://github.com/whateverweb/CSS-processor @media (-‐wew-‐pointing-‐method: touchscreen){ a { padding: 10px; } } @media all and (min-‐width: 1500px){ //removed for devices where 1500px is impossible. e.g. iPhones body{color: green;} } Server Side rendering fredag 20. september 13
<body> <img src="http://img.demo.wew.io/http://example.com/image.jpg"/> <script> var w=new wew(); w.getSet("myset",cb); </script> </body> </html> •Markup lives anywhere •CSS and images are proxied, optimized and cached •Device data available client side fredag 20. september 13
900 Onload no WeW with WeW Only 4% faster in total Due to lazy loading of assets and repaints etc. Lazy loading good or bad? Depends... fredag 20. september 13
Content Delivery Network 3. Add an Expires Header 4. Gzip Components 5. Put Stylesheets at the Top 6. Put Scripts at the Bottom 7. Avoid CSS Expressions 8. Make JavaScript and CSS External 9. Reduce DNS Lookups 10.Minify JavaScript 11.Avoid Redirects 12.Remove Duplicate Scripts 13.Configure ETags 14.Make AJAX Cacheable By Steve Souders: http://stevesouders.com/hpws/rules.php Most of these are implemented server side. fredag 20. september 13
Content Delivery Network 3. Add an Expires Header 4. Gzip Components 5. Put Stylesheets at the Top 6. Put Scripts at the Bottom 7. Avoid CSS Expressions 8. Make JavaScript and CSS External 9. Reduce DNS Lookups 10.Minify JavaScript 11.Avoid Redirects 12.Remove Duplicate Scripts 13.Configure ETags 14.Make AJAX Cacheable By Steve Souders: http://stevesouders.com/hpws/rules.php Most of these are implemented server side. fredag 20. september 13