SlideShare ist ein Scribd-Unternehmen logo
1 von 66
Downloaden Sie, um offline zu lesen
John Arne Sæterås
Twitter: @jonarnes
Head of innovation at Mobiletech
http://www.slideshare.net/jonarnes/
August 18, 2010
YEP, WEB ON MOBILE IS SLOW
100 ms faster:
1% increased revenue
1 sec delay:
2.8% 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
THE VALUE CHAIN
developer server internet telco	
  network device
Doesn’t really make things more
difficult, but reveal a few issues
browser
WHY IS MOBILE SLOWER?
• Network Latency
• Available Bandwidth
• The Implementation
• Processing Power
• Browser
• Battery Preserving Strategies
CURRENT STATE
OF THE WEB
AND MOBILE
1.6 MB
4%9%
6%
3%
17% 63%
Images Scripts
CSS Flash
Other HTML
in 94 requests on average
http://httparchive.org/
ASIDE...
•In 2030
• Average web site is
320MB
• Average (mobile)
bandwidth is 93Mbps
http://mpulp.mobi/2013/06/page-weight-and-mobile-bandwidth-in-year-2030/
1.6 MB
in 94 requests on average
• Avg. speed: 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
1.6 MB
in 94 requests on average
•100-200 ms pr roundtrip
•Depends....(DNS, pipelining,
concurrentTCP connections
etc.)
9,4Seconds
latency in
total
Hold that thought...
more on this now.
MOBILE
NETWORKS ARE
FREAKING
MAGIC!
a quick look on how they
work
2.1 s to connect.
Latency, anything from
100 - >500ms
2.40 s, html page loaded
TCP stuff
3-60 seconds....
Infographic: http://www.research.att.com/articles/featured_stories/2011_03/201102_Energy_efficient?fbid=YmB5ErqPR7b
Now download assets
1.6 MB
in 94 requests on average
•Wake up radio (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!
GOOGLE: 10.2 S.
http://analytics.blogspot.nl/2012/04/global-site-speed-overview-how-fast-are.html
SERVE A PAGE TO A
MOBILE DEVICE IN
LESS THAN 1 SECOND?
A great overview by Ilya Grigorik
bit.ly/mobile-barrier
WHO CARES?
The users care!
Telco Network
53,53 %
Other
46,47 %
How users connect. Page views per
connection type. (Scandinavian Countries).
Source: Mobiletech
WHY USERS CARE?
http://mobiforge.com/designing/blog/performance-money-part-1-end-users-wallet
➜EuropeanVodafone
account roaming in US
SO, WHAT IS OUR CURRENT
APPROACH TO THIS?
ENTER
RESPONSIVE
WEB DESIGN
Yay!
RESPONSIVE
WEB DESIGN
Doh...
Much smaller
6%
Same size
72%
Smaller
22%
http://www.guypo.com/uncategorized/real-world-rwd-performance-take-2/
Also about the same
number of
HTTP requests
RWD IS A TECHNIQUE
Nothing wrong with the technique! It is brilliant!
The famous Iceberg: @brad_frost
RWD != MOBILE FRIENDLY
but an important step in the right direction
Load time: 9.07s *
Size: 288.14 kb
Load time: 2.36 s *
Size: 36.59 kb
*) Load event fired. - More on how the built the new BBC News site: http://slidesha.re/14IYNOO
http://www.bbc.co.uk/blogs/bbcinternet/2012/03/bbc_news_mobile_site_refresh.html
PRIMARY ISSUES
• Over downloading
• Unused assets
• Large images
• Stuff...
• Network issues
• High Latency
• Bandwidth
• Flaky connection
PARET0
PRINCIPLE
Responsive Design is
20% of the work,
and might get you
80% of the way
the “80/20 rule”
THE LAST 20%
will improve performance by 80%
Our example: Shaving
80%off 10,6 s. gives a
load time of 2,1s
SOMETIMES IT MAKES SENSE TO MULTISERVE
When all you have is a hammer,
every problem looks like a nail
RWD
device or browser
HOW CAN WE
FIX THIS?
Adaptive Design
THE VALUE CHAIN
Adaptive Responsive
developer server internet telco	
  network device browser
RANT
There is a web server.A very capable one, too.
Use it!
SERVER?
How to make the server side
available to front end devs
http://mobile.smashingmagazine.com/2013/04/09/improve-mobile-support-with-server-side-enhanced-responsive-design/
RESS
REsponsive design with Server
Side components
A BALANCING ACT
no right answer
PURPOSE OF RESS
• Reduce need for client side
processing
• Eliminate “over downloading”
• Let the server do the work
instead of the browser
INGREDIENTS OF RESS
Hello, I know exactly how to
make you shine!
Information about the
requesting device,
network, etc.
Request/Response
NOT A CRIME!
82% of top 100 Alexa sites
use 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/
THERE IS A DIFFERENCE
User-Agent sniffing
var	
  isiPhone	
  =	
  /iPhone/i.test(navigator.userAgent);
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.
NYTIMES
var ua = navigator.userAgent;
window.BBDevice = {
isOldBB: false,
indexOfVersion: ua.indexOf("Version/"),
indexOfBB: ua.indexOf("BlackBerry"),
fullVersion: null,
version: null
};
if (window.BBDevice.indexOfBB >= 0) {
existingClasses = document.body.className = existingClasses + " bb";
if (ua.indexOf("WebKit") < 0) {
existingClasses = document.body.className = existingClasses + " oldbb";
window.BBDevice.isOldBB = true;
window.BBDevice.fullVersion = ua.substr(window.BBDevice.indexOfBB);
window.BBDevice.fullVersion = window.BBDevice.fullVersion.substr(window.BBDevice.fullVersion.indexOf("/") + 1,
window.BBDevice.fullVersion.indexOf(" "));
window.BBDevice.version = window.BBDevice.fullVersion.substr(0, window.BBDevice.fullVersion.indexOf("."));
} else {
if (window.BBDevice.indexOfVersion >= 0) {
window.BBDevice.indexOfVersion = window.BBDevice.indexOfVersion + 8;
window.BBDevice.fullVersion = ua.substr(window.BBDevice.indexOfVersion);
window.BBDevice.fullVersion = window.BBDevice.fullVersion.substr(0, window.BBDevice.fullVersion.indexOf("
"));
window.BBDevice.version = window.BBDevice.fullVersion.substr(0, window.BBDevice.fullVersion.indexOf("."));
}
}
} else if (ua.indexOf("MSIE 9.0") >= 0 || ua.indexOf("IEMobile/9.0") >= 0) {
existingClasses = document.body.className = existingClasses + " win75";
}
http://mpulp.mobi/2013/05/user-agent-sniffing-on-the-new-nyt-mobile-site/
http://mobile.nytimes.com
FEATURES OF A DDR
• Nice place to store custom stuff
• “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
EXAMPLE
if	
  ($type_of_device	
  ==	
  ”smartTV”)
include(TVnav.php);
else
include(nav.php);
http://www.circleid.com/posts/20120111_analysis_of_server_side_mobile_web_detection/
EXAMPLE
if	
  ($supports_h264)
echo	
  ‘<video	
  .../>’;
else
echo	
  ‘<a	
  href=”...”>Download</a>’;
OUR APPROACH
DEVICE DETECTION
Single Capability
Request
GET	
  http://ddr.demo.wew.io/c/model_name
Response
{"model_name":"iPhone"}	
  	
  
Capability Sets
Request
GET	
  http://ddr.demo.wew.io/cset/mySet
Response
{"capa1":"first	
  capa	
  value","capa2":"second	
  capa	
  value"	
  ...}
Examples and documentation: https://github.com/whateverweb/device-detection
EXAMPLE
var	
  http	
  =	
  new	
  XMLHttpRequest();
http.open("GET",	
  "http://ddr.demo.wew.io/c/brand_name",	
  true);
http.onreadystatechange	
  =	
  function()	
  {
if	
  (http.readyState	
  ==	
  4)
console.log(http.responseText);
}
http.send();
EXAMPLE
public	
  function	
  get($capa){
	
   foreach(getallheaders()	
  as	
  $key	
  =>	
  $value)	
  {
	
   	
   if	
  ($key	
  !="Host")	
  
	
   	
   	
  	
  $this-­‐>headers[]	
  =	
  $key	
  .	
  ':	
  '	
  .	
  $value;
	
   }
	
   $url	
  =	
  $this-­‐>service	
  .	
  $capa;
	
   $curl	
  =	
  curl_init($url);
	
   curl_setopt($curl,	
  CURLOPT_RETURNTRANSFER,	
  true);
	
   curl_setopt($curl,	
  CURLOPT_HTTPHEADER,	
  $this-­‐>headers);	
  	
  
	
   $this-­‐>response	
  =	
  curl_exec($curl);
	
   curl_close($curl);
	
   return	
  json_decode($this-­‐>response)-­‐>$capa;
}
IMAGE OPTIMIZING
<img	
  src="http://img.demo.wew.io/http://example.com/image.jpg"/>
Simple Usage
Advanced Usage
<img	
  src=”http://img.demo.wew.io/vpw_1024/bp_w/pc/w_31/m_48/n_98/http://
example.com/img.png”/>
Examples and documentation: https://github.com/whateverweb/Image-Server
EXAMPLE
<div	
  data-­‐picture	
  data-­‐alt="A	
  beautiful	
  butterfly">
	
   <div	
  data-­‐src="http://img.demo.wew.io/px_100/http://exampe.com/image.png"></div>
	
   <div	
  data-­‐src="http://img.demo.wew.io/px_320/http://exampe.com/image.png"	
  
data-­‐media="(min-­‐width:	
  320px)"></div>
	
   <div	
  data-­‐src="http://img.demo.wew.io/px_320/@_2/http://exampe.com/image.png"	
  
data-­‐media="(min-­‐width:	
  320px)	
  and	
  (-­‐webkit-­‐min-­‐device-­‐pixel-­‐ratio:	
  2.0)"></div>
	
   <noscript>
	
   	
  	
  	
  	
  <img	
  src="http://img.demo.wew.io/px_10/http://exampe.com/image.png">
	
   </noscript>
</div>
Picturefill: https://github.com/scottjehl/picturefill. Full example: https://github.com/whateverweb/Image-Server/blob/master/examples/picturefill/index.html
Using Picturefill
CSS OPTIMIZATION
Device Capabilities as Media Features
Removing overhead and 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
EXAMPLE
@import	
  url('http://demo.wew.io/styles/iPadStyles.css')	
  
all	
  and	
  (-­‐wew-­‐model-­‐name:	
  iPad);
@import	
  url(http://demo.wew.io/CSS-­‐processor/examples/inlining/right.css)	
  
all	
  and	
  (min-­‐device-­‐width:	
  480px);
EXAMPLE
<!doctype	
  html>
<html>
<head>
	
  	
  <link	
  rel="stylesheet"	
  href="//css.demo.wew.io/http://example.com/style.css”/>
</head>
<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
FTW?
Does adaptive design have a
positive impact on performance?
EFFECT
0
108
215
323
430
Size
No WeW With WeW
0
1 000
2 000
3 000
4 000
Time
0
575
1 150
1 725
2 300
Latency
20% less data
transfer
50% faster
download
73% reduced
latency
BUT...
CAN’T DO MAGIC
0
975
1 950
2 925
3 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...
MARSHALLHEADPHONES.COM
• Down from 1.6MB to 432KB
• Load time down from 6,1s
to 1,9s
FUN-FACT
Loading apple.com consume
1.41% of battery life.
http://www2012.wwwconference.org/proceedings/proceedings/p41.pdf
Not so
12 - 4% in 8 mins
of web surfing
PERFORMANCE FRONT END
STARTS WITH THE BACK END
Too much is left to the browser to figure out.
SUMMING UP
developer server internet telco	
  network device browser
We...
...must do
stuff here...
...to
relieve...
...and...
...to make life
easier for...
...and...
THE RULES
1. Make Fewer HTTP Requests
2. Use a Content Delivery Network
3. Add an Expires Header
4. Gzip Components
5. Put Stylesheets at theTop
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.
POOR IMPLEMENTATION
SLOWS RENDERING DOWN,
BUT SPEED IS REALLY ABOUT
HOW FASTTHE USER CAN
ACHIEVE HIS GOALS
WHAT IS SPEED, ANYWAY?
John Arne Sæterås
twitter: @jonarnes
http://www.slideshare.net/jonarnes/
THANK YOU
?

Weitere ähnliche Inhalte

Was ist angesagt?

Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Andy Davies
 
Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013
Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013
Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013Anna Dahlström
 
The Case for HTTP/2 - GreeceJS - June 2016
The Case for HTTP/2 -  GreeceJS - June 2016The Case for HTTP/2 -  GreeceJS - June 2016
The Case for HTTP/2 - GreeceJS - June 2016Andy Davies
 
Responsive Images and Video
Responsive Images and VideoResponsive Images and Video
Responsive Images and VideoJason Grigsby
 
Give Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance BoostGive Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance BoostGrgur Grisogono
 
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScriptjQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScriptPhilipp Bosch
 
Designing for multiple devices, GA London - 01 Oct 2012
Designing for multiple devices, GA London - 01 Oct 2012Designing for multiple devices, GA London - 01 Oct 2012
Designing for multiple devices, GA London - 01 Oct 2012Anna Dahlström
 
Designing for multiple devices, GA London - 6 Aug 2012
Designing for multiple devices, GA London - 6 Aug 2012Designing for multiple devices, GA London - 6 Aug 2012
Designing for multiple devices, GA London - 6 Aug 2012Anna Dahlström
 
Hamburg web perf meetup
Hamburg web perf meetupHamburg web perf meetup
Hamburg web perf meetupDoug Sillars
 
Mistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhoneMistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhonekentbrew
 
Designing for multiple devices - GA, New York 08 Oct 2012
Designing for multiple devices - GA, New York 08 Oct 2012Designing for multiple devices - GA, New York 08 Oct 2012
Designing for multiple devices - GA, New York 08 Oct 2012Anna Dahlström
 
Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Appsbrucelawson
 
Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013
Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013
Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013Anna Dahlström
 
Designing for multiple devices - GA London, 19 Nov 2012
Designing for multiple devices - GA London, 19 Nov 2012Designing for multiple devices - GA London, 19 Nov 2012
Designing for multiple devices - GA London, 19 Nov 2012Anna Dahlström
 
Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!Matheus Cardoso
 
Mobile Web Apps Best Practices Presentation at Design4Mobile 2009
Mobile Web Apps Best Practices Presentation at Design4Mobile 2009Mobile Web Apps Best Practices Presentation at Design4Mobile 2009
Mobile Web Apps Best Practices Presentation at Design4Mobile 2009Jeff Sonstein
 
Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013
Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013
Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013Anna Dahlström
 
Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013
Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013
Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013Anna Dahlström
 
Fastandbeautiful belfast
Fastandbeautiful belfastFastandbeautiful belfast
Fastandbeautiful belfastDoug Sillars
 

Was ist angesagt? (20)

Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016
 
Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013
Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013
Fundamentals of Designing for Multiple Devices - GA, New York, 07 Oct 2013
 
The Case for HTTP/2 - GreeceJS - June 2016
The Case for HTTP/2 -  GreeceJS - June 2016The Case for HTTP/2 -  GreeceJS - June 2016
The Case for HTTP/2 - GreeceJS - June 2016
 
SWONtech News, January 2012
SWONtech News, January 2012SWONtech News, January 2012
SWONtech News, January 2012
 
Responsive Images and Video
Responsive Images and VideoResponsive Images and Video
Responsive Images and Video
 
Give Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance BoostGive Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance Boost
 
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScriptjQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
 
Designing for multiple devices, GA London - 01 Oct 2012
Designing for multiple devices, GA London - 01 Oct 2012Designing for multiple devices, GA London - 01 Oct 2012
Designing for multiple devices, GA London - 01 Oct 2012
 
Designing for multiple devices, GA London - 6 Aug 2012
Designing for multiple devices, GA London - 6 Aug 2012Designing for multiple devices, GA London - 6 Aug 2012
Designing for multiple devices, GA London - 6 Aug 2012
 
Hamburg web perf meetup
Hamburg web perf meetupHamburg web perf meetup
Hamburg web perf meetup
 
Mistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhoneMistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhone
 
Designing for multiple devices - GA, New York 08 Oct 2012
Designing for multiple devices - GA, New York 08 Oct 2012Designing for multiple devices - GA, New York 08 Oct 2012
Designing for multiple devices - GA, New York 08 Oct 2012
 
Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Apps
 
Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013
Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013
Best of GA: Designing For Multiple Devices - Google Campus, 26 Feb 2013
 
Designing for multiple devices - GA London, 19 Nov 2012
Designing for multiple devices - GA London, 19 Nov 2012Designing for multiple devices - GA London, 19 Nov 2012
Designing for multiple devices - GA London, 19 Nov 2012
 
Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!
 
Mobile Web Apps Best Practices Presentation at Design4Mobile 2009
Mobile Web Apps Best Practices Presentation at Design4Mobile 2009Mobile Web Apps Best Practices Presentation at Design4Mobile 2009
Mobile Web Apps Best Practices Presentation at Design4Mobile 2009
 
Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013
Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013
Understanding UX: Designing for multiple devices - GA London, 18 Jan 2013
 
Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013
Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013
Live streaming: Designing For Multiple Devices - GA, New York, 14 March 2013
 
Fastandbeautiful belfast
Fastandbeautiful belfastFastandbeautiful belfast
Fastandbeautiful belfast
 

Ähnlich wie Optimize Website Performance for Mobile with Server-Side Components

Creating an Effective Mobile API
Creating an Effective Mobile API Creating an Effective Mobile API
Creating an Effective Mobile API Nick DeNardis
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on MobileAdam Lu
 
Jon Arne Sæterås - Give Responsive Design a mobile performance boost
Jon Arne Sæterås - Give Responsive Design a mobile performance boost Jon Arne Sæterås - Give Responsive Design a mobile performance boost
Jon Arne Sæterås - Give Responsive Design a mobile performance boost DevConFu
 
Makingweb: Great front end performance starts on the server.
Makingweb: Great front end performance starts on the server.Makingweb: Great front end performance starts on the server.
Makingweb: Great front end performance starts on the server.Jon Arne Sæterås
 
Javaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learnedJavaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learnedpgt technology scouting GmbH
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 mayLuciano Amodio
 
Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Patrick Lauke
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentEngin Hatay
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12touchtitans
 
Velocity EU: Give Responsive Design a Mobile Performance Boost
Velocity EU: Give Responsive Design a Mobile Performance BoostVelocity EU: Give Responsive Design a Mobile Performance Boost
Velocity EU: Give Responsive Design a Mobile Performance BoostJon Arne Sæterås
 
Best Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile AppBest Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile AppSt. Petersburg College
 
Mobilise your ASP.NET website
Mobilise your ASP.NET websiteMobilise your ASP.NET website
Mobilise your ASP.NET websiteMatt Lacey
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and moreYan Shi
 
Web app and more
Web app and moreWeb app and more
Web app and morefaming su
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScalePatrick Chanezon
 
移动端Web app开发
移动端Web app开发移动端Web app开发
移动端Web app开发Zhang Xiaoxue
 
FRENDS의 시작
FRENDS의 시작FRENDS의 시작
FRENDS의 시작frendskr
 
Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make itJonathan Snook
 
Mobile Apps with PhoneGap and jQuery Mobile
Mobile Apps with PhoneGap and jQuery MobileMobile Apps with PhoneGap and jQuery Mobile
Mobile Apps with PhoneGap and jQuery MobileTerry Ryan
 

Ähnlich wie Optimize Website Performance for Mobile with Server-Side Components (20)

Creating an Effective Mobile API
Creating an Effective Mobile API Creating an Effective Mobile API
Creating an Effective Mobile API
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
 
Jon Arne Sæterås - Give Responsive Design a mobile performance boost
Jon Arne Sæterås - Give Responsive Design a mobile performance boost Jon Arne Sæterås - Give Responsive Design a mobile performance boost
Jon Arne Sæterås - Give Responsive Design a mobile performance boost
 
Makingweb: Great front end performance starts on the server.
Makingweb: Great front end performance starts on the server.Makingweb: Great front end performance starts on the server.
Makingweb: Great front end performance starts on the server.
 
Javaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learnedJavaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learned
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
 
Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
 
Velocity EU: Give Responsive Design a Mobile Performance Boost
Velocity EU: Give Responsive Design a Mobile Performance BoostVelocity EU: Give Responsive Design a Mobile Performance Boost
Velocity EU: Give Responsive Design a Mobile Performance Boost
 
Best Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile AppBest Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile App
 
Mobilise your ASP.NET website
Mobilise your ASP.NET websiteMobilise your ASP.NET website
Mobilise your ASP.NET website
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
 
移动端Web app开发
移动端Web app开发移动端Web app开发
移动端Web app开发
 
FRENDS의 시작
FRENDS의 시작FRENDS의 시작
FRENDS의 시작
 
GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)
 
Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make it
 
Mobile Apps with PhoneGap and jQuery Mobile
Mobile Apps with PhoneGap and jQuery MobileMobile Apps with PhoneGap and jQuery Mobile
Mobile Apps with PhoneGap and jQuery Mobile
 

Mehr von Jon Arne Sæterås

What Devops Need to Know about Mobile
What Devops Need to Know about MobileWhat Devops Need to Know about Mobile
What Devops Need to Know about MobileJon Arne Sæterås
 
Enhancing GA with form factor data
Enhancing GA with form factor dataEnhancing GA with form factor data
Enhancing GA with form factor dataJon Arne Sæterås
 
Search on Mobile - Mobile Copenhagen 2012
Search on Mobile - Mobile Copenhagen 2012Search on Mobile - Mobile Copenhagen 2012
Search on Mobile - Mobile Copenhagen 2012Jon Arne Sæterås
 
ModevTablet: Embrace Device Diversity
ModevTablet: Embrace Device DiversityModevTablet: Embrace Device Diversity
ModevTablet: Embrace Device DiversityJon Arne Sæterås
 

Mehr von Jon Arne Sæterås (8)

What Devops Need to Know about Mobile
What Devops Need to Know about MobileWhat Devops Need to Know about Mobile
What Devops Need to Know about Mobile
 
RWD myth busting @ Topconf
RWD myth busting @ TopconfRWD myth busting @ Topconf
RWD myth busting @ Topconf
 
Enhancing GA with form factor data
Enhancing GA with form factor dataEnhancing GA with form factor data
Enhancing GA with form factor data
 
Search on Mobile - Mobile Copenhagen 2012
Search on Mobile - Mobile Copenhagen 2012Search on Mobile - Mobile Copenhagen 2012
Search on Mobile - Mobile Copenhagen 2012
 
Mobile Oslo 2012 okt
Mobile Oslo 2012 oktMobile Oslo 2012 okt
Mobile Oslo 2012 okt
 
ModevTablet: Embrace Device Diversity
ModevTablet: Embrace Device DiversityModevTablet: Embrace Device Diversity
ModevTablet: Embrace Device Diversity
 
Digitale Medier 2011
Digitale Medier 2011Digitale Medier 2011
Digitale Medier 2011
 
Mobile for web developers
Mobile for web developersMobile for web developers
Mobile for web developers
 

Kürzlich hochgeladen

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Optimize Website Performance for Mobile with Server-Side Components

  • 1. John Arne Sæterås Twitter: @jonarnes Head of innovation at Mobiletech http://www.slideshare.net/jonarnes/ August 18, 2010 YEP, WEB ON MOBILE IS SLOW
  • 2. 100 ms faster: 1% increased revenue 1 sec delay: 2.8% 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
  • 3. THE VALUE CHAIN developer server internet telco  network device Doesn’t really make things more difficult, but reveal a few issues browser
  • 4. WHY IS MOBILE SLOWER? • Network Latency • Available Bandwidth • The Implementation • Processing Power • Browser • Battery Preserving Strategies
  • 5. CURRENT STATE OF THE WEB AND MOBILE
  • 6. 1.6 MB 4%9% 6% 3% 17% 63% Images Scripts CSS Flash Other HTML in 94 requests on average http://httparchive.org/
  • 7. ASIDE... •In 2030 • Average web site is 320MB • Average (mobile) bandwidth is 93Mbps http://mpulp.mobi/2013/06/page-weight-and-mobile-bandwidth-in-year-2030/
  • 8. 1.6 MB in 94 requests on average • Avg. speed: 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
  • 9. 1.6 MB in 94 requests on average •100-200 ms pr roundtrip •Depends....(DNS, pipelining, concurrentTCP connections etc.) 9,4Seconds latency in total Hold that thought... more on this now.
  • 11. 2.1 s to connect. Latency, anything from 100 - >500ms
  • 12. 2.40 s, html page loaded TCP stuff
  • 14. 1.6 MB in 94 requests on average •Wake up radio (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!
  • 16. SERVE A PAGE TO A MOBILE DEVICE IN LESS THAN 1 SECOND? A great overview by Ilya Grigorik bit.ly/mobile-barrier
  • 17. WHO CARES? The users care! Telco Network 53,53 % Other 46,47 % How users connect. Page views per connection type. (Scandinavian Countries). Source: Mobiletech
  • 19. SO, WHAT IS OUR CURRENT APPROACH TO THIS?
  • 21. RESPONSIVE WEB DESIGN Doh... Much smaller 6% Same size 72% Smaller 22% http://www.guypo.com/uncategorized/real-world-rwd-performance-take-2/ Also about the same number of HTTP requests
  • 22. RWD IS A TECHNIQUE Nothing wrong with the technique! It is brilliant! The famous Iceberg: @brad_frost
  • 23. RWD != MOBILE FRIENDLY but an important step in the right direction
  • 24. Load time: 9.07s * Size: 288.14 kb Load time: 2.36 s * Size: 36.59 kb *) Load event fired. - More on how the built the new BBC News site: http://slidesha.re/14IYNOO
  • 26. PRIMARY ISSUES • Over downloading • Unused assets • Large images • Stuff... • Network issues • High Latency • Bandwidth • Flaky connection
  • 27. PARET0 PRINCIPLE Responsive Design is 20% of the work, and might get you 80% of the way the “80/20 rule”
  • 28. THE LAST 20% will improve performance by 80% Our example: Shaving 80%off 10,6 s. gives a load time of 2,1s
  • 29. SOMETIMES IT MAKES SENSE TO MULTISERVE
  • 30. When all you have is a hammer, every problem looks like a nail RWD device or browser
  • 31. HOW CAN WE FIX THIS? Adaptive Design
  • 32. THE VALUE CHAIN Adaptive Responsive developer server internet telco  network device browser
  • 33. RANT There is a web server.A very capable one, too. Use it!
  • 34. SERVER? How to make the server side available to front end devs
  • 35.
  • 37. RESS REsponsive design with Server Side components
  • 38. A BALANCING ACT no right answer
  • 39. PURPOSE OF RESS • Reduce need for client side processing • Eliminate “over downloading” • Let the server do the work instead of the browser
  • 40. INGREDIENTS OF RESS Hello, I know exactly how to make you shine! Information about the requesting device, network, etc. Request/Response
  • 41. NOT A CRIME! 82% of top 100 Alexa sites use 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/
  • 42. THERE IS A DIFFERENCE User-Agent sniffing var  isiPhone  =  /iPhone/i.test(navigator.userAgent); 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.
  • 43. NYTIMES var ua = navigator.userAgent; window.BBDevice = { isOldBB: false, indexOfVersion: ua.indexOf("Version/"), indexOfBB: ua.indexOf("BlackBerry"), fullVersion: null, version: null }; if (window.BBDevice.indexOfBB >= 0) { existingClasses = document.body.className = existingClasses + " bb"; if (ua.indexOf("WebKit") < 0) { existingClasses = document.body.className = existingClasses + " oldbb"; window.BBDevice.isOldBB = true; window.BBDevice.fullVersion = ua.substr(window.BBDevice.indexOfBB); window.BBDevice.fullVersion = window.BBDevice.fullVersion.substr(window.BBDevice.fullVersion.indexOf("/") + 1, window.BBDevice.fullVersion.indexOf(" ")); window.BBDevice.version = window.BBDevice.fullVersion.substr(0, window.BBDevice.fullVersion.indexOf(".")); } else { if (window.BBDevice.indexOfVersion >= 0) { window.BBDevice.indexOfVersion = window.BBDevice.indexOfVersion + 8; window.BBDevice.fullVersion = ua.substr(window.BBDevice.indexOfVersion); window.BBDevice.fullVersion = window.BBDevice.fullVersion.substr(0, window.BBDevice.fullVersion.indexOf(" ")); window.BBDevice.version = window.BBDevice.fullVersion.substr(0, window.BBDevice.fullVersion.indexOf(".")); } } } else if (ua.indexOf("MSIE 9.0") >= 0 || ua.indexOf("IEMobile/9.0") >= 0) { existingClasses = document.body.className = existingClasses + " win75"; } http://mpulp.mobi/2013/05/user-agent-sniffing-on-the-new-nyt-mobile-site/ http://mobile.nytimes.com
  • 44. FEATURES OF A DDR • Nice place to store custom stuff • “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
  • 45. EXAMPLE if  ($type_of_device  ==  ”smartTV”) include(TVnav.php); else include(nav.php); http://www.circleid.com/posts/20120111_analysis_of_server_side_mobile_web_detection/
  • 46. EXAMPLE if  ($supports_h264) echo  ‘<video  .../>’; else echo  ‘<a  href=”...”>Download</a>’;
  • 48. DEVICE DETECTION Single Capability Request GET  http://ddr.demo.wew.io/c/model_name Response {"model_name":"iPhone"}     Capability Sets Request GET  http://ddr.demo.wew.io/cset/mySet Response {"capa1":"first  capa  value","capa2":"second  capa  value"  ...} Examples and documentation: https://github.com/whateverweb/device-detection
  • 49. EXAMPLE var  http  =  new  XMLHttpRequest(); http.open("GET",  "http://ddr.demo.wew.io/c/brand_name",  true); http.onreadystatechange  =  function()  { if  (http.readyState  ==  4) console.log(http.responseText); } http.send();
  • 50. EXAMPLE public  function  get($capa){   foreach(getallheaders()  as  $key  =>  $value)  {     if  ($key  !="Host")          $this-­‐>headers[]  =  $key  .  ':  '  .  $value;   }   $url  =  $this-­‐>service  .  $capa;   $curl  =  curl_init($url);   curl_setopt($curl,  CURLOPT_RETURNTRANSFER,  true);   curl_setopt($curl,  CURLOPT_HTTPHEADER,  $this-­‐>headers);       $this-­‐>response  =  curl_exec($curl);   curl_close($curl);   return  json_decode($this-­‐>response)-­‐>$capa; }
  • 51. IMAGE OPTIMIZING <img  src="http://img.demo.wew.io/http://example.com/image.jpg"/> Simple Usage Advanced Usage <img  src=”http://img.demo.wew.io/vpw_1024/bp_w/pc/w_31/m_48/n_98/http:// example.com/img.png”/> Examples and documentation: https://github.com/whateverweb/Image-Server
  • 52. EXAMPLE <div  data-­‐picture  data-­‐alt="A  beautiful  butterfly">   <div  data-­‐src="http://img.demo.wew.io/px_100/http://exampe.com/image.png"></div>   <div  data-­‐src="http://img.demo.wew.io/px_320/http://exampe.com/image.png"   data-­‐media="(min-­‐width:  320px)"></div>   <div  data-­‐src="http://img.demo.wew.io/px_320/@_2/http://exampe.com/image.png"   data-­‐media="(min-­‐width:  320px)  and  (-­‐webkit-­‐min-­‐device-­‐pixel-­‐ratio:  2.0)"></div>   <noscript>          <img  src="http://img.demo.wew.io/px_10/http://exampe.com/image.png">   </noscript> </div> Picturefill: https://github.com/scottjehl/picturefill. Full example: https://github.com/whateverweb/Image-Server/blob/master/examples/picturefill/index.html Using Picturefill
  • 53. CSS OPTIMIZATION Device Capabilities as Media Features Removing overhead and 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
  • 54. EXAMPLE @import  url('http://demo.wew.io/styles/iPadStyles.css')   all  and  (-­‐wew-­‐model-­‐name:  iPad); @import  url(http://demo.wew.io/CSS-­‐processor/examples/inlining/right.css)   all  and  (min-­‐device-­‐width:  480px);
  • 55. EXAMPLE <!doctype  html> <html> <head>    <link  rel="stylesheet"  href="//css.demo.wew.io/http://example.com/style.css”/> </head> <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
  • 56. FTW? Does adaptive design have a positive impact on performance?
  • 57. EFFECT 0 108 215 323 430 Size No WeW With WeW 0 1 000 2 000 3 000 4 000 Time 0 575 1 150 1 725 2 300 Latency 20% less data transfer 50% faster download 73% reduced latency
  • 59. CAN’T DO MAGIC 0 975 1 950 2 925 3 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...
  • 60. MARSHALLHEADPHONES.COM • Down from 1.6MB to 432KB • Load time down from 6,1s to 1,9s
  • 61. FUN-FACT Loading apple.com consume 1.41% of battery life. http://www2012.wwwconference.org/proceedings/proceedings/p41.pdf Not so 12 - 4% in 8 mins of web surfing
  • 62. PERFORMANCE FRONT END STARTS WITH THE BACK END Too much is left to the browser to figure out.
  • 63. SUMMING UP developer server internet telco  network device browser We... ...must do stuff here... ...to relieve... ...and... ...to make life easier for... ...and...
  • 64. THE RULES 1. Make Fewer HTTP Requests 2. Use a Content Delivery Network 3. Add an Expires Header 4. Gzip Components 5. Put Stylesheets at theTop 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.
  • 65. POOR IMPLEMENTATION SLOWS RENDERING DOWN, BUT SPEED IS REALLY ABOUT HOW FASTTHE USER CAN ACHIEVE HIS GOALS WHAT IS SPEED, ANYWAY?
  • 66. John Arne Sæterås twitter: @jonarnes http://www.slideshare.net/jonarnes/ THANK YOU ?