SlideShare a Scribd company logo
1 of 57
Download to read offline
Mobile	
  Web	
  Performance	
  
       Guy	
  Podjarny,	
  CTO	
  
        guypo@blaze.io	
  
       Twi?er:	
  @guypod	
  
Agenda	
  
•  Why	
  Mobile	
  Web	
  Performance?	
  
•  The	
  Different	
  Aspects	
  of	
  Mobile	
  
        –  Performance	
  implicaHons	
  
        –  OpHmizaHon	
  Techniques	
  
•  Summary	
  
•  Q&A	
  




2	
  
Who	
  Am	
  I	
  #1:	
  CTO	
  of	
  Blaze.io	
  
•  Automated	
  Frontend	
                          OpHmizaHons	
  from	
             Shared	
  insights	
  from	
  	
  	
  	
     Blaze	
  performance	
  
   OpHmizaHon	
  Service	
                          world’s	
  fastest	
  sites	
     >1M	
  pages	
  analyzed	
  	
               research	
  team	
  

     –  Dynamically	
  applies	
  
        opHmizaHon	
  best	
  pracHces	
  


•  Cloud-­‐based	
  service	
  
     –  No	
  soVware	
  or	
  hardware	
  
     –  Integrates	
  with	
  CDN	
  services	
  


•  Quick	
  deployment	
  
     –  1	
  hour	
  or	
  less.	
  
     –  No	
  code	
  changes	
  required	
  
                                                                            Faster,	
  more	
  efficient	
  site	
  
Who	
  Am	
  I	
  #2:	
  Blaze	
  Mobitest	
  
•  Mobile	
  Web	
  Performance	
  Measurement	
  
        –  Free	
  Online	
  Service:	
  h?p://blaze.io/mobile/	
  




4	
  
Who	
  Am	
  I	
  #3:	
  Mobile	
  Perf	
  Researcher	
  
h?p://blaze.io/blog/	
  




5	
  
Terminology	
  
                                               Resource	
               Doc	
  Complete,	
  
        Waterfall	
  Chart	
                   (Request/Response)	
     (a.k.a.	
  onload,	
  
                                 Start	
  Render	
                      Load	
  Time)	
  




6	
  
Why	
  Mobile	
  Web	
  	
  
Performance	
  Ma?ers	
  
Users	
  Expect	
  Fast	
  Sites	
  




                                       Source:	
  	
  
                                       Akamai	
  

8	
  
Users	
  Abandon	
  Slow	
  Sites	
  
             Page Abandonment vs. Load Time	
  




                                                          Source:	
  
                                                  KISS	
  Metrics	
  

9	
  
Fast	
  Sites	
  Help	
  Bo?om	
  Lines	
  
           Shopzilla: 5 sec load time improvement	
  




                                                         Source:	
  
                                                        Shopzilla	
  

10	
  
Mobile	
  Browsing	
  is	
  Gelng	
  Big	
  




                                                            Sources:	
  
                                         HubSpot,	
  Twi?er,	
  Reuters	
  

11	
  
Mobile	
  Users	
  Expect	
  Equal	
  Speeds	
  




                                               Source:	
  Gomez	
  

12	
  
And	
  will	
  abandon	
  slow	
  sites	
  




                                              Source:	
  Gomez	
  

13	
  
Front-­‐End	
  vs.	
  Back-­‐End	
  Performance	
  
•  Back-­‐End	
  Performance	
  
          –  Time	
  to	
  generate	
  page	
  
          –  10%	
  of	
  page	
  load	
  Hme	
  


•  Front-­‐End	
  Performance	
  
          –  Network	
  Time	
  
          –  Browser	
  Time	
  
          –  90%	
  of	
  page	
  load	
  Hme	
  

                                                    Source:	
  New	
  Relic	
  

 14	
  
What	
  Is	
  Mobile?	
  
•  Mobile	
  is	
  not	
  just	
  one	
  thing…	
  

•  Mobile	
  Network	
  
	
  
•  Mobile	
  Hardware	
  

•  Mobile	
  SoVware	
  


15	
  
Mobile	
  Network	
  
Mobile	
  Networks	
  are	
  SLLLOOOWWW…	
  
                                                                                    Latency	
  (Ms)	
  
                                                    400	
  
                                                    350	
  
                                                    300	
  
                                                    250	
  
                                                    200	
  
                                                    150	
  
                                                    100	
  
                                                          50	
  
                                                            0	
  
                                                                         Broadband	
                           Mobile	
  



               Download	
  (Mbps)	
                                      Upload	
  (Mbps)	
  
   10	
                                        2.5	
  
     8	
                                          2	
  
     6	
                                       1.5	
  
     4	
                                          1	
  
     2	
                                       0.5	
  
     0	
                                          0	
  
             Broadband	
          Mobile	
                          Broadband	
                   Mobile	
  

                                                                            Source:	
  PCWorld,	
  FCC,	
  Novarum	
  

17	
  
SoluHons:	
  Reduce	
  Requests	
  &	
  Bytes	
  	
  
•  Why	
  Reduce	
  Requests?	
  
             –  High	
  Latency	
  +	
  Slow	
  Upload	
  =	
  Big	
  Req	
  Overhead	
  
             –  #	
  Requests	
  has	
  highest	
  correlaHon	
  to	
  load	
  Hme	
  
•  Why	
  Reduce	
  Bytes?	
  
             –  Simple	
  math	
  –	
  less	
  to	
  download,	
  be?er	
  load	
  Hme	
  
                                 Correla7on	
  To	
  Page	
  Load	
  Time	
  
0.35	
  
 0.3	
  
0.25	
  
 0.2	
                                                                                                 #	
  Requests	
  

0.15	
                                                                                                 #	
  Bytes	
  

  0.1	
                                                                                                #	
  Domains	
  

0.05	
  
     0	
  
               Nexus	
  S	
     XOOM	
          iPad	
        iPad2	
           iPhone	
     IE8	
  



18	
  
OpHmizaHon:	
  On-­‐Demand	
  Images	
  
         Mobile	
  Walmart	
  Apparel	
  Page	
     Mobile	
  Walmart	
  Apparel	
  Page	
  
                      Original	
                       Images-­‐On-­‐Demand	
  




19	
  
OpHmizaHon:	
  On-­‐Demand	
  Images	
  
•  Reduced	
  Requests:	
  28	
  Requests	
  (33%)	
  
•  Reduced	
  Bytes:	
  108	
  KB	
  (33%)	
  
•  Reduced	
  Fully	
  Load	
  Time:	
  5.9s	
  (63%)	
  




20	
  
OpHmizaHon:	
  On-­‐Demand	
  Images	
  




•  Site:	
  h?p://m.nbcsports.com/	
  
•  Reduced	
  Requests:	
  15	
  Requests	
  (35%)	
  
•  Reduced	
  Bytes:	
  50	
  KB	
  (31%)	
  

21	
  
Mobile	
  Networks	
  are	
  unreliable	
  
•  High	
  Packet	
  Loss	
  
         –  High	
  noise	
  	
  
            environment	
  
         –  Any	
  request	
  	
  
            may	
  be	
  delayed	
  
•  Non-­‐Sustainable	
  Speeds	
  
         –  Long-­‐lasHng	
  interrupHons	
  	
  
         –  Moving	
  client	
  
•  SoluHon:	
  Eliminate	
  Single-­‐Points-­‐of-­‐Failure	
  

22	
  
SoluHon:	
  Eliminate	
  SPOFs	
  
•  Common	
  SPOFs	
  	
  
         –  Scripts	
  
         –  CSS	
  
         –  IFrames	
  
         –  Fonts	
  
•  SoluHon	
  #1:	
  Async	
  JS/CSS	
  
•  SoluHon	
  #2:	
  Avoid/Delay	
  IFrames	
  
•  SoluHon	
  #3:	
  Avoid	
  Fonts	
  


23	
  
Async	
  JS	
  –	
  Eliminate	
  Script	
  SPOF	
  




         Original	
                          Async	
  JS	
  




24	
  
Latency	
  vs.	
  Start	
  Render:	
  Async	
  JS	
  in	
  AcHon	
  
                             Start	
  Render	
  Time	
  per	
  Latency	
  	
  
                       (Milliseconds,	
  10	
  Top	
  Mobile	
  News	
  Sites)	
  
         6,000	
  

         5,000	
  

         4,000	
  

         3,000	
  

         2,000	
  

         1,000	
  

               0	
  
                         30ms	
                100ms	
                200ms	
                300ms	
  
                               Original	
  Site	
          With	
  Async	
  JavaScript	
  


25	
  
Non-­‐Persistent	
  Comm.	
  Channel	
  
•  Mobile	
  Nets	
  have	
  limited	
  capacity	
  
    –  Limited	
  by	
  spectrum	
  &	
  ba?ery	
  
•  ConnecHons	
  are	
  made	
  ad-­‐hoc	
  
    –  Then	
  dropped	
  by	
  device	
  &	
  tower	
  
•  Impact:	
  1.5-­‐2	
  second	
  delay	
  	
  
    –  Likely	
  for	
  every	
  single	
  page…	
  
       	
  
•  SoluHon:	
  Maintain	
  a	
  heartbeat	
  
    –  Send	
  a	
  dummy	
  request	
  every	
  2-­‐3	
  seconds	
  
    –  Will	
  maintain	
  a	
  live	
  cell	
  tower	
  connecHon	
  
    –  Make	
  sure	
  you	
  stop	
  it	
  aVer	
  a	
  while...	
  

26	
  
Non-­‐Persistent	
  Comm.	
  Channel	
  
•  Mobile	
  Nets	
  have	
  limited	
  capacity	
  
    –  Limited	
  by	
  spectrum	
  &	
  ba?ery	
  
•  ConnecHons	
  are	
  made	
  ad-­‐hoc	
  
    –  Then	
  dropped	
  by	
  device	
  &	
  tower	
  
•  Impact:	
  1.5-­‐2	
  second	
  delay	
  	
  
    –  Likely	
  for	
  every	
  single	
  page…	
  
       	
  
•  SoluHon:	
  Maintain	
  a	
  heartbeat	
  
    –  Send	
  a	
  dummy	
  request	
  every	
  2-­‐3	
  seconds	
  
    –  Will	
  maintain	
  a	
  live	
  cell	
  tower	
  connecHon	
  
    –  Make	
  sure	
  you	
  stop	
  it	
  aVer	
  a	
  while...	
  

27	
  
Mobile	
  SoVware	
  
Mobile	
  SoVware	
  Is	
  Cool!	
  
•  Designed	
  for	
  the	
  web	
  
         –  Browsing	
  a	
  key	
  acHon	
  from	
  day	
  1	
  
•  Designed	
  for	
  Performance	
  
         –  Try	
  to	
  adapt	
  to	
  hardware,	
  
            ba?ery	
  and	
  network	
  limitaHons	
  
•  Supports	
  modern	
  standards	
  
         –  Namely	
  HTML5	
  &	
  CSS	
  3.0	
  
•  Includes	
  smart	
  browsers	
  
         –  Modern	
  JS	
  Engines,	
  look	
  ahead	
  
            downloads,	
  DNS	
  prefetching…	
  
•  All	
  in	
  all:	
  A	
  friend,	
  not	
  a	
  foe	
  

29	
  
Mobile	
  Cache	
  Sizes	
  Too	
  Small	
  
         •  Mobile	
  Persistent	
  Cache	
  around	
  0-­‐25	
  MB	
  
                       –  Memory	
  cache	
  a	
  bit	
  bigger,	
  but	
  short	
  lasHng	
  
                       –  Compares	
  to	
  75-­‐250	
  MB	
  on	
  Desktop	
  
         •  Cache	
  cycled	
  through	
  several	
  Hmes	
  a	
  day	
  
                       –  Average	
  page	
  size	
  ~400	
  KB	
  mobile,	
  ~800KB	
  desktop	
  
                       –  Average	
  desktop	
  user	
  browses	
  88	
  pages/day	
  
                                     Cache	
  Capacity	
  in	
  MB	
                                                                        Cache	
  Capacity	
  in	
  Pages	
  
       30	
                                                                                         	
  70	
  	
  

       25	
                                                                                         	
  60	
  	
  
                                                                                                    	
  50	
  	
  
       20	
  
                                                                                                    	
  40	
  	
  
       15	
  
                                                                                                    	
  30	
  	
  
       10	
  
                                                                                                    	
  20	
  	
  
         5	
                                                                                        	
  10	
  	
  
         0	
                                                                                          	
  -­‐	
  	
  	
  	
  
                   iPhone	
  4	
       Nexus	
  S	
     Blackberry	
     iPad	
  2	
     XOOM	
                                 iPhone	
  4	
     Nexus	
  S	
     Blackberry	
     iPad	
  2	
     XOOM	
  


More	
  Info:	
  h?p://www.blaze.io/mobile/understanding-­‐mobile-­‐cache-­‐sizes/	
  
	
        30	
  
Small	
  Cache	
  SoluHon:	
  localStorage	
  
•  Use	
  HTML5	
  localStorage	
  for	
  caching	
  
         –  Available	
  on	
  all	
  major	
  mobile	
  plaworms	
  
         –  Doesn’t	
  expire,	
  survives	
  power	
  cycle	
  
         –  Size	
  limit	
  is	
  usually	
  ~5MB	
  
•  Most	
  useful	
  for	
  caching	
  JavaScript	
  &	
  CSS	
  files	
  
         –  Using	
  for	
  images	
  will	
  quickly	
  consume	
  the	
  5MB	
  
•  Scriptable	
  Access	
  enables	
  other	
  opHmizaHons	
  
         –  h?p://www.blaze.io/technical/browser-­‐cache-­‐2-­‐0-­‐scriptable-­‐cache/	
  

•  In	
  addiHon,	
  use	
  far-­‐future	
  expiry	
  dates	
  
         –  Impacts	
  Android’s	
  cache	
  evicHon	
  policy	
  

31	
  
Mobile	
  SoVware:	
  Pipelining	
  
•  HTTP	
  Pipelining	
  is	
  around	
  since	
  HTTP	
  1.1	
  
         –  Idea:	
  sending	
  mulHple	
  requests	
  on	
  connecHon	
  
            before	
  receiving	
  response	
  
         –  Most	
  useful	
  in	
  high	
  latency	
  environment	
  


•  Big	
  in	
  Mobile	
  
         –  ~65%	
  of	
  mobile	
  clients	
  
         –  Also	
  included	
  in	
  iOS	
  5	
  
         –  Hardly	
  used	
  on	
  Desktop	
  

32	
  
Pipelining:	
  What	
  Should	
  You	
  Know?	
  
                                                                            With Pipelining

   •  Risks	
  
            –  Head-­‐of-­‐Line	
  Blocking	
                                              Slow	
  Resource	
  
                                                                                           delays	
  
                •  Slow	
  resource	
  delaying	
  fast	
  ones	
                          Fast	
  Resources	
  
            –  Resources	
  requested	
  out	
  of	
  order	
  
   •  Depends	
  on	
  heurisHcs	
  
                                                                      ConnecHon	
  1	
  

                                                                         Without Pipelining
            –  Support	
  detected	
  per	
  server/conn	
  
            –  Requires	
  explicit	
  Keep-­‐Alive	
  header	
  
   •  Conflicts	
  with	
  Domain	
  Sharding	
  
h?p://www.blaze.io/mobile/h?p-­‐pipelining-­‐big-­‐in-­‐mobile/	
     ConnecHon	
  1	
         ConnecHon	
  2	
  


   33	
  
Pipelining	
  Network	
  Capture	
  (Galaxy	
  S)	
  
•  Samsung	
  Galaxy	
  S	
  
      –  Max	
  Conn:	
  12	
  
      –  Conn	
  Per	
  Host:	
  12	
  
      –  Max	
  Piped	
  Reqs:	
  6	
  
      –  Pipelining	
  Support	
  
         Scope:	
  Per	
  Conn	
  
      –  Conn/Pipe	
  Request	
  
         DistribuHon:	
  Fill	
  First	
  
         	
  
•    Full	
  Details:	
  
     hMp://www.blaze.io/technical/hMp-­‐
     pipelining-­‐request-­‐distribu7on-­‐algorithms/	
  


      34	
  
Pipelining:	
  What	
  to	
  do?	
  
•  Make	
  sure	
  your	
  servers	
  support	
  HTTP	
  pipelining.	
  	
  
         –  Most	
  reasonably	
  new	
  servers	
  do	
  
•  Use	
  separate	
  domains	
  for	
  slow	
  &	
  fast	
  resources	
  
         –  Helps	
  avoid	
  a	
  slow	
  response	
  delaying	
  a	
  fast	
  one	
  
•  Use	
  “ConnecHon:	
  Keep-­‐Alive”	
  	
  
         –  Good	
  pracHce	
  anyway,	
  but	
  criHcal	
  for	
  pipelining	
  
         –  Include	
  an	
  explicit	
  keep-­‐alive	
  header	
  for	
  Android	
  
•  Use	
  Domain	
  Sharding	
  carefully	
  (or	
  not	
  at	
  all)	
  	
  
         –  Serving	
  resources	
  from	
  one	
  domain	
  helps	
  pipelining	
  
         –  Android	
  is	
  limited	
  to	
  4	
  connecHons	
  total	
  anyway…	
  

35	
  
Mobile	
  SoVware:	
  FragmentaHon	
  
•  Too	
  Many	
  Browsers…	
  
         –  Top:	
  Android,	
  iOS	
  
         –  Other:	
  Opera,	
  Blackberry,	
  IE	
  Mobile,	
  WebOS,	
  Firefox	
  
•  Too	
  li?le	
  visibility..	
  
         –  Especially	
  on	
  iOS	
  and	
  Blackberry	
  
         –  True	
  for	
  vendor-­‐specific	
  changes	
  to	
  Android	
  
•  Too	
  frequent	
  changes…	
  
•  Too	
  few	
  supporHng	
  tools…	
  


36	
  
Android	
  FragmentaHon	
  -­‐	
  ConnecHons	
  
      Samsung	
  Galaxy	
  S	
                     Samsung	
  Nexus	
  S	
                      Motorola	
  XOOM	
  
-­‐  Max	
  Conn:	
  12	
                    -­‐  Max	
  Conn:	
  4	
                    -­‐  Max	
  Conn:	
  35	
  
-­‐  Max	
  Conn	
  Per	
  Host:	
  12	
     -­‐  Max	
  Conn	
  Per	
  Host:	
  4	
     -­‐  Max	
  Conn	
  Per	
  Host:	
  6	
  
-­‐  Max	
  Piped	
  Requests:	
  6	
        -­‐  Max	
  Piped	
  Requests:	
  3	
       -­‐  No	
  Pipelining	
  Support	
  




      37	
  
Android	
  Tablets	
  Not	
  IdenHfied	
  
•  www.cnet.com	
  
         Nexus	
  S	
     XOOM	
            iPad	
  2	
  




38	
  
Frequent	
  OS	
  &	
  Device	
  Updates	
  




39	
  
Mobile	
  Browser	
  Usage	
  –	
  North	
  America	
  




40	
  
FragmentaHon:	
  SoluHons	
  
•  Focus	
  on	
  top	
  devices	
  
         –  Android	
  &	
  iOS	
  first	
  
              •  Blackberry	
  &	
  Opera	
  second	
  
         –  Test	
  on	
  key	
  Android	
  devices	
  &	
  tablets	
  
•  Bolster	
  Server-­‐Side	
  DetecHon	
  with	
  Client-­‐Side	
  
         –  If	
  screen	
  is	
  wide,	
  redirect	
  to	
  desktop	
  version	
  
•  Measure!	
  
         –  Hosted:	
  h?p://blaze.io/mobile/	
  
         –  Your	
  Devices:	
  h?p://pcapperf.appspot.com/	
  
•  Stay	
  on	
  top	
  of	
  news	
  

41	
  
Mobile	
  Hardware	
  
Mobile	
  Hardware:	
  Weaker	
  CPU	
  
•  Weaker	
  CPU	
  =	
  Slower	
  JavaScript	
  	
  
         –  SHll	
  10x	
  slower	
  than	
  desktop	
  
•  Script	
  Parsing	
  is	
  Slow	
  
         –  About	
  1-­‐10ms/KB	
                                                            Sunspider	
  Time	
  by	
  Device/Version	
  


                                              iPhone	
  4	
  (4.2)	
                                                                                                                                              	
  10,303	
  	
  



•  Not	
  just	
  JavaScript	
                iPhone	
  4	
  (4.3)	
                                                                                  	
  4,285	
  	
  



         –  Flash,	
  CSS,	
  	
              iPhone	
  4	
  (5.0)	
                                                                       	
  3,574	
  	
  



            Dynamic	
  Graphics…	
           iPhone	
  4S	
  (5.0)	
                                                       	
  2,227	
  	
  


                                               Macbook	
  Pro	
                                    	
  230	
  	
  


                                                                         	
  -­‐	
  	
  	
  	
             	
  2,000	
  	
        	
  4,000	
  	
           	
  6,000	
  	
     	
  8,000	
  	
   	
  10,000	
  	
   	
  12,000	
  	
  




43	
  
Hardware	
  Impact	
  on	
  Page	
  Load	
  Time	
  
    •  Alexa	
  US	
  Top	
  100:	
  Average	
  Load	
  Times	
  
              –  Measured	
  at	
  night	
  over	
  same	
  WiFi	
  +	
  Cable	
  

                    iPhone	
  	
     iPhone	
  	
        iOS	
  	
  
                       4	
             4S	
           Simulator	
                              Page	
  Load	
  Time	
  
                                                                       4000	
  
CPU	
               1-­‐Core	
   2-­‐Core	
             2-­‐Core	
     3500	
  

                   ~800Mhz	
   ~800Mhz	
                2.7Ghz	
       3000	
  
                                                                       2500	
  

CPU	
  Cache	
       32	
  KB	
       32	
  KB	
         4	
  MB	
     2000	
  
                                                                       1500	
  
                                                                       1000	
  
RAM	
              512	
  MB	
       512MB	
             8	
  GB	
      500	
  
                                                                            0	
  
Median	
              3.4s	
           2.9s	
             1.5s	
                    iPhone	
  4	
       iPhone	
  4S	
     iOS	
  Simulator	
  

Page	
  Load	
  



     44	
  
Mobile	
  Hardware:	
  Form	
  Factor	
  
•  Mobile	
  Devices	
  are	
  Small…	
  
         –  Comes	
  with	
  the	
  territory	
  
•  Two	
  Main	
  Sizes	
  
         –  Smartphone	
  (2.6’’	
  to	
  5.5’’)	
  
         –  Tablet	
  (7’’	
  to	
  10’’)	
  
•  Design	
  Challenge	
  -­‐	
  Performance	
  Opportunity!	
  
         –  Can	
  reduce	
  data	
  to	
  match	
  screen	
  size	
  
             •  At	
  least	
  for	
  Smartphones…	
  
         –  Can	
  anHcipate	
  exact	
  resoluHon	
  

45	
  
Responsive	
  Images:	
  Resize	
  To	
  Screen	
  

                                                                                                     128px,	
  	
  
                                                                           240px,	
  6.8	
  KB	
     2.9	
  KB	
  
                                         320px,	
  10.6	
  KB	
  

              480px,	
  21.3	
  KB	
  

Site:	
  
lonelyplanet.com	
  
Device:	
  
iPhone	
  4	
  
Before:	
  	
  
867	
  KB	
  
AZer:	
  	
                                                         Full	
  Res,	
  50.1	
  KB	
  
570	
  KB	
  




     46	
  
Mobile	
  Hardware:	
  Touchscreen	
  
•  Touchscreen	
  common	
  in	
  Mobile	
  
•  Touch	
  can	
  mean	
  many	
  things	
  
         –  Devices	
  lag	
  to	
  decide	
  
                                                                           Zoom?	
   Click?	
     Scroll?	
  

•  Impact:	
  Delayed	
  Clicks	
  
         –  Take	
  300+	
  ms	
  to	
  decide	
  it’s	
  a	
  click	
  
            	
  
•  SoluHon:	
  Replace	
  click	
  with	
  touch	
  
         –  May	
  sHll	
  have	
  usability	
  implicaHons	
  

47	
  
Summary	
  
What	
  Is	
  Mobile?	
  
•  Mobile	
  is	
  not	
  just	
  one	
  thing…	
  

•  Mobile	
  Network	
  

•  Mobile	
  SoVware	
  

•  Mobile	
  Hardware	
  


49	
  
Mobile	
  Web	
  Performance	
  Aspects	
  
          CHALLENGES                           SOLUTIONS
•  Mobile	
  Network	
                   •  Mobile	
  Network	
  
         –  Slow	
                           –  Reduce	
  Requests,	
  Bytes	
  
         –  Unreliable	
                     –  Async	
  All,	
  Avoid	
  SPOFs	
  
         –  Ad-­‐hoc	
  connecHons	
         –  Maintain	
  a	
  Heartbeat	
  
•  Mobile	
  Hardware	
                  •  Mobile	
  Hardware	
  
         –  Weak	
  CPU	
                    –  Async/Avoid	
  Scripts	
  
         –  Small	
  Screens	
               –  Progressive	
  Images	
  
         –  Touchscreen	
                    –  Touch	
  instead	
  of	
  Click	
  
•  Mobile	
  SoVware	
                   •  Mobile	
  SoVware	
  
         –  Small	
  Cache	
                 –  localStorage	
  
         –  HTTP	
  Pipelining	
             –  Separate	
  Slow	
  Resources	
  
         –  FragmentaHon	
                   –  Focus,	
  Measure	
  

50	
  
QuesHons?	
  




Mobile	
  Web	
  Performance	
  
       Guy	
  Podjarny,	
  CTO	
  
        guypo@blaze.io	
  
Sources	
  
•        h?p://transiHon.fcc.gov/Daily_Releases/Daily_Business/2011/db0802/DOC-­‐308828A1.pdf	
  
•        h?p://www.pcworld.com/arHcle/189592/atandt_roars_back_in_pcworlds_second_3g_wireless_performance_test.html	
  
•        h?p://blog.kissmetrics.com/loading-­‐Hme/	
  
•        h?p://www.slideshare.net/kleinerperkins/kpcb-­‐top-­‐10-­‐mobile-­‐trends-­‐feb-­‐2011	
  
•        h?p://www.google.com/events/io/2011/sessions/use-­‐page-­‐speed-­‐to-­‐opHmize-­‐your-­‐web-­‐site-­‐for-­‐mobile.html	
  
•        h?p://blog.newrelic.com/wp-­‐content/uploads/infog_061611.png	
  
•        h?p://statcounter.com/	
  
•        h?p://danzarrella.com/new-­‐data-­‐on-­‐mobile-­‐facebook-­‐posHng.html#	
  
•        h?p://www.comscoredatamine.com/2011/02/top-­‐mobile-­‐acHviHes-­‐in-­‐us/	
  
•        h?p://blog.twi?er.com/2010/09/evolving-­‐ecosystem.html	
  
•        h?p://www.ecousHcs.com/pcmag/arHcles/2392095	
  
•        h?p://mobile.h?parchive.org/	
  
•        h?p://www.h?parchive.org/	
  
•        h?p://blog.newrelic.com/wp-­‐content/uploads/infog_061611.png	
  
•        h?p://www.gomez.com/wp-­‐content/downloads/19986_WhatMobileUsersWant_Wp.pdf	
  
•        h?p://www.akamai.com/dl/whitepapers/ecommerce_website_perf_wp.pdf	
  
•        h?p://www.novarum.com/novarum_blog/2009/02/real-­‐measurements-­‐of-­‐municipal-­‐wireless-­‐technologies-­‐wifi-­‐wimax-­‐
         and-­‐cellular.html	
  
•        h?p://www.neHndex.com/	
  
•        h?p://features.journalism.org/2011/10/25/tablet-­‐revoluHon/	
  
•        h?p://www.markeHngtechblog.com/ecommerce/infographic-­‐how-­‐is-­‐mobile-­‐impacHng-­‐retail-­‐commerce/	
  




52	
  
Techniques	
  to	
  Reduce	
  Requests	
  
•  Merge	
  Files	
  
         –  Consolidate	
  JS/CSS	
  Files	
  
         –  Inline	
  small	
  JS/CSS	
  into	
  HTML	
  
         –  Inline	
  small	
  images	
  into	
  CSS	
  
         –  Avoid	
  CSS	
  @imports	
  
•  Avoid	
  Unnecessary	
  Requests	
  
         –  Load	
  Images	
  On-­‐Demand	
  
         –  Avoid	
  redirects	
  where	
  possible	
  
•  Cache	
  More	
  
         –  Cache	
  as	
  much	
  as	
  possible	
  
         –  Version	
  files	
  for	
  long-­‐term	
  cacheability	
  


53	
  
Techniques	
  to	
  Reduce	
  Bytes	
  
•  Compress	
  
          –  Use	
  GZIP	
  compression	
  for	
  Text	
  Resources	
  
          –  Use	
  Lossless	
  Image	
  Compression	
  
•  Remove	
  Surplus	
  Data	
  
          –  Minify	
  JavaScript,	
  CSS	
  &	
  HTML	
  
          –  Remove	
  unused	
  content	
  (CSS,	
  JS)	
  
          –  Reduce	
  quality	
  to	
  display	
  size	
  
•  Shrink	
  Uploads	
  
          –  Serve	
  StaHc	
  Files	
  from	
  Cookieless	
  Domains	
  

 54	
  
Form	
  Factor:	
  OpportuniHes	
  
•  Responsive	
  Images:	
  Resize	
  To	
  Display	
  Size	
  
         –  No	
  point	
  in	
  sending	
  large	
  image	
  to	
  small	
  screen	
  
         –  Useful	
  Tool:	
  SenchaSrc	
  (resize	
  on	
  the	
  fly)	
  
         –  Refinement:	
  Lazy	
  load	
  bigger	
  image	
  on	
  zoom	
  
•  Use	
  @media	
  to	
  use	
  minimal	
  CSS	
  
         –  Example:	
  <link	
  rel="stylesheet"	
  type="text/css”	
  	
  media="screen	
  and	
  
            (max-­‐device-­‐width:	
  480px)”	
  href=”smartphone.css"	
  />	
  
         –  Can	
  include	
  resized	
  CSS	
  images	
  	
  
•  Be	
  careful	
  with	
  Progressive	
  Design	
  
         –  Watch	
  for	
  excessive	
  JavaScript	
  or	
  blocking	
  render	
  

55	
  
Weaker	
  CPU:	
  SoluHons	
  for	
  JS	
  
•  Use	
  Less	
  JavaScript…	
  
         –  Don’t	
  send	
  Desktop	
  JS	
  to	
  Mobile	
  if	
  not	
  used	
  
         –  Pre-­‐Execute	
  as	
  much	
  as	
  you	
  can	
  
              •  Run	
  Dynamic	
  code	
  on	
  server,	
  return	
  staHc	
  content	
  
         –  Avoid	
  heavy	
  JavaScript	
  Libraries	
  
•  Defer	
  Scripts	
  
         –  Run	
  scripts	
  that	
  aren’t	
  criHcal	
  only	
  aVer	
  onload	
  
         –  Defer	
  EvaluaHon	
  of	
  Inline	
  JavaScript	
  
              •  Download	
  code	
  as	
  comment,	
  evaluate	
  on-­‐demand	
  
•  Async	
  Scripts	
  
         –  As	
  explained	
  earlier	
  

56	
  
Weaker	
  CPU:	
  SoluHons	
  for	
  Non-­‐JS	
  
•  CSS	
  
         –  Avoid	
  CSS	
  Expressions	
  
         –  Avoid	
  inefficient	
  CSS	
  Rules	
  
             •  Example:	
  html	
  div	
  p	
  a	
  {color:	
  red}	
  
•  Minimize	
  reflows	
  
         –  Specify	
  image	
  dimensions	
  
         –  Avoid	
  dynamic	
  content	
  not	
  at	
  bo?om	
  
         –  Avoid	
  dynamic	
  reordering	
  of	
  resources	
  
•  Avoid	
  Flash	
  

57	
  

More Related Content

Viewers also liked

Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Hadley Wickham
 
Utilizing HTML5 APIs
Utilizing HTML5 APIsUtilizing HTML5 APIs
Utilizing HTML5 APIsIdo Green
 
Modern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIsModern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIsIdo Green
 
Web fundamental 4 developers
Web fundamental 4 developersWeb fundamental 4 developers
Web fundamental 4 developersIdo Green
 
Web Forms The Right Way
Web Forms The Right WayWeb Forms The Right Way
Web Forms The Right WayIdo Green
 

Viewers also liked (6)

Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)
 
Dyna trace
Dyna traceDyna trace
Dyna trace
 
Utilizing HTML5 APIs
Utilizing HTML5 APIsUtilizing HTML5 APIs
Utilizing HTML5 APIs
 
Modern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIsModern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIs
 
Web fundamental 4 developers
Web fundamental 4 developersWeb fundamental 4 developers
Web fundamental 4 developers
 
Web Forms The Right Way
Web Forms The Right WayWeb Forms The Right Way
Web Forms The Right Way
 

Similar to Unravelling Mobile Web Performance

Mobile Performance Testing - Testing the Server
Mobile Performance Testing  - Testing the ServerMobile Performance Testing  - Testing the Server
Mobile Performance Testing - Testing the ServerXBOSoft
 
Extreme Web Performance for Mobile Device Fluent 2015
Extreme Web Performance for Mobile Device Fluent 2015Extreme Web Performance for Mobile Device Fluent 2015
Extreme Web Performance for Mobile Device Fluent 2015Maximiliano Firtman
 
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Maximiliano Firtman
 
Extreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile DevicesExtreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile DevicesMaximiliano Firtman
 
Equinix webinar (cotendo) final dec 8
Equinix webinar (cotendo) final dec 8Equinix webinar (cotendo) final dec 8
Equinix webinar (cotendo) final dec 8gyanendra1
 
Extreme Web Performance for Mobile Devices - Velocity NY
Extreme Web Performance for Mobile Devices - Velocity NYExtreme Web Performance for Mobile Devices - Velocity NY
Extreme Web Performance for Mobile Devices - Velocity NYMaximiliano Firtman
 
모바일 경제
모바일 경제모바일 경제
모바일 경제guestde26cd
 
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...Strangeloop
 
Best practices for delivering quality web experiences
Best practices for delivering quality web experiencesBest practices for delivering quality web experiences
Best practices for delivering quality web experiencesBen Mantooth
 
Mobile Web Best Practices
Mobile Web Best PracticesMobile Web Best Practices
Mobile Web Best PracticesJames D Bloom
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...David Kaneda
 
Cast a wider net
Cast a wider netCast a wider net
Cast a wider netjlembeck
 
Mobile Web High Performance
Mobile Web High PerformanceMobile Web High Performance
Mobile Web High PerformanceAmjad Rafique
 
Joyent circa 2006 (Scale with Rails)
Joyent circa 2006 (Scale with Rails)Joyent circa 2006 (Scale with Rails)
Joyent circa 2006 (Scale with Rails)bcantrill
 
Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...
Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...
Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...Strangeloop
 
Complexity At The Edge How To Maximize The Mobile Opportunity
Complexity At The Edge  How To Maximize The Mobile OpportunityComplexity At The Edge  How To Maximize The Mobile Opportunity
Complexity At The Edge How To Maximize The Mobile OpportunityCompuware APM
 
iEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für Tablets
iEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für TabletsiEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für Tablets
iEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für TabletsIndiginox
 
Docker:- Application Delivery Platform Towards Edge Computing
Docker:- Application Delivery Platform Towards Edge ComputingDocker:- Application Delivery Platform Towards Edge Computing
Docker:- Application Delivery Platform Towards Edge ComputingBukhary Ikhwan Ismail
 
Image-ine That: Image Optimization for Conversion Maximization
Image-ine That: Image Optimization for Conversion MaximizationImage-ine That: Image Optimization for Conversion Maximization
Image-ine That: Image Optimization for Conversion MaximizationYottaa
 

Similar to Unravelling Mobile Web Performance (20)

Mobile Performance Testing - Testing the Server
Mobile Performance Testing  - Testing the ServerMobile Performance Testing  - Testing the Server
Mobile Performance Testing - Testing the Server
 
Extreme Web Performance for Mobile Device Fluent 2015
Extreme Web Performance for Mobile Device Fluent 2015Extreme Web Performance for Mobile Device Fluent 2015
Extreme Web Performance for Mobile Device Fluent 2015
 
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
 
Extreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile DevicesExtreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile Devices
 
Equinix webinar (cotendo) final dec 8
Equinix webinar (cotendo) final dec 8Equinix webinar (cotendo) final dec 8
Equinix webinar (cotendo) final dec 8
 
Extreme Web Performance for Mobile Devices - Velocity NY
Extreme Web Performance for Mobile Devices - Velocity NYExtreme Web Performance for Mobile Devices - Velocity NY
Extreme Web Performance for Mobile Devices - Velocity NY
 
모바일 경제
모바일 경제모바일 경제
모바일 경제
 
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...
 
Best practices for delivering quality web experiences
Best practices for delivering quality web experiencesBest practices for delivering quality web experiences
Best practices for delivering quality web experiences
 
Mobile Web Best Practices
Mobile Web Best PracticesMobile Web Best Practices
Mobile Web Best Practices
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
 
Cast a wider net
Cast a wider netCast a wider net
Cast a wider net
 
Mobile Web High Performance
Mobile Web High PerformanceMobile Web High Performance
Mobile Web High Performance
 
Joyent circa 2006 (Scale with Rails)
Joyent circa 2006 (Scale with Rails)Joyent circa 2006 (Scale with Rails)
Joyent circa 2006 (Scale with Rails)
 
Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...
Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...
Cloud Performance: Guide to Tackling Cloud Latency [Cloud Connect - Chicago 2...
 
Complexity At The Edge How To Maximize The Mobile Opportunity
Complexity At The Edge  How To Maximize The Mobile OpportunityComplexity At The Edge  How To Maximize The Mobile Opportunity
Complexity At The Edge How To Maximize The Mobile Opportunity
 
DDive- Giuseppe Grasso - mobile su Lotus
DDive- Giuseppe Grasso - mobile su LotusDDive- Giuseppe Grasso - mobile su Lotus
DDive- Giuseppe Grasso - mobile su Lotus
 
iEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für Tablets
iEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für TabletsiEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für Tablets
iEnterprise - Mit HTML-5 zum Unternehmens-Dashboard für Tablets
 
Docker:- Application Delivery Platform Towards Edge Computing
Docker:- Application Delivery Platform Towards Edge ComputingDocker:- Application Delivery Platform Towards Edge Computing
Docker:- Application Delivery Platform Towards Edge Computing
 
Image-ine That: Image Optimization for Conversion Maximization
Image-ine That: Image Optimization for Conversion MaximizationImage-ine That: Image Optimization for Conversion Maximization
Image-ine That: Image Optimization for Conversion Maximization
 

More from Guy Podjarny

Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To ProtectGuy Podjarny
 
Securing Serverless - By Breaking In
Securing Serverless - By Breaking InSecuring Serverless - By Breaking In
Securing Serverless - By Breaking InGuy Podjarny
 
Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Guy Podjarny
 
Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Guy Podjarny
 
Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)Guy Podjarny
 
Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)Guy Podjarny
 
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)Guy Podjarny
 
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)Guy Podjarny
 
High Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean SlowHigh Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean SlowGuy Podjarny
 
Responsive In The Wild, 2014
Responsive In The Wild, 2014Responsive In The Wild, 2014
Responsive In The Wild, 2014Guy Podjarny
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Guy Podjarny
 
Rules driven-delivery
Rules driven-deliveryRules driven-delivery
Rules driven-deliveryGuy Podjarny
 
Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)Guy Podjarny
 
Putting Your Images on a Diet (SmashingConf, 2014)
Putting Your Images on a Diet (SmashingConf, 2014)Putting Your Images on a Diet (SmashingConf, 2014)
Putting Your Images on a Diet (SmashingConf, 2014)Guy Podjarny
 
Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Guy Podjarny
 
Third Party Performance
Third Party PerformanceThird Party Performance
Third Party PerformanceGuy Podjarny
 
A Picture Costs A Thousand Words
A Picture Costs A Thousand WordsA Picture Costs A Thousand Words
A Picture Costs A Thousand WordsGuy Podjarny
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile OptimizationGuy Podjarny
 
Quantifying The Mobile Difference
Quantifying The Mobile DifferenceQuantifying The Mobile Difference
Quantifying The Mobile DifferenceGuy Podjarny
 
Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)Guy Podjarny
 

More from Guy Podjarny (20)

Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To Protect
 
Securing Serverless - By Breaking In
Securing Serverless - By Breaking InSecuring Serverless - By Breaking In
Securing Serverless - By Breaking In
 
Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?
 
Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)
 
Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)
 
Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)
 
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
 
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
 
High Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean SlowHigh Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean Slow
 
Responsive In The Wild, 2014
Responsive In The Wild, 2014Responsive In The Wild, 2014
Responsive In The Wild, 2014
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)
 
Rules driven-delivery
Rules driven-deliveryRules driven-delivery
Rules driven-delivery
 
Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)
 
Putting Your Images on a Diet (SmashingConf, 2014)
Putting Your Images on a Diet (SmashingConf, 2014)Putting Your Images on a Diet (SmashingConf, 2014)
Putting Your Images on a Diet (SmashingConf, 2014)
 
Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)
 
Third Party Performance
Third Party PerformanceThird Party Performance
Third Party Performance
 
A Picture Costs A Thousand Words
A Picture Costs A Thousand WordsA Picture Costs A Thousand Words
A Picture Costs A Thousand Words
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile Optimization
 
Quantifying The Mobile Difference
Quantifying The Mobile DifferenceQuantifying The Mobile Difference
Quantifying The Mobile Difference
 
Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 

Unravelling Mobile Web Performance

  • 1. Mobile  Web  Performance   Guy  Podjarny,  CTO   guypo@blaze.io   Twi?er:  @guypod  
  • 2. Agenda   •  Why  Mobile  Web  Performance?   •  The  Different  Aspects  of  Mobile   –  Performance  implicaHons   –  OpHmizaHon  Techniques   •  Summary   •  Q&A   2  
  • 3. Who  Am  I  #1:  CTO  of  Blaze.io   •  Automated  Frontend   OpHmizaHons  from   Shared  insights  from         Blaze  performance   OpHmizaHon  Service   world’s  fastest  sites   >1M  pages  analyzed     research  team   –  Dynamically  applies   opHmizaHon  best  pracHces   •  Cloud-­‐based  service   –  No  soVware  or  hardware   –  Integrates  with  CDN  services   •  Quick  deployment   –  1  hour  or  less.   –  No  code  changes  required   Faster,  more  efficient  site  
  • 4. Who  Am  I  #2:  Blaze  Mobitest   •  Mobile  Web  Performance  Measurement   –  Free  Online  Service:  h?p://blaze.io/mobile/   4  
  • 5. Who  Am  I  #3:  Mobile  Perf  Researcher   h?p://blaze.io/blog/   5  
  • 6. Terminology   Resource   Doc  Complete,   Waterfall  Chart   (Request/Response)   (a.k.a.  onload,   Start  Render   Load  Time)   6  
  • 7. Why  Mobile  Web     Performance  Ma?ers  
  • 8. Users  Expect  Fast  Sites   Source:     Akamai   8  
  • 9. Users  Abandon  Slow  Sites   Page Abandonment vs. Load Time   Source:   KISS  Metrics   9  
  • 10. Fast  Sites  Help  Bo?om  Lines   Shopzilla: 5 sec load time improvement   Source:   Shopzilla   10  
  • 11. Mobile  Browsing  is  Gelng  Big   Sources:   HubSpot,  Twi?er,  Reuters   11  
  • 12. Mobile  Users  Expect  Equal  Speeds   Source:  Gomez   12  
  • 13. And  will  abandon  slow  sites   Source:  Gomez   13  
  • 14. Front-­‐End  vs.  Back-­‐End  Performance   •  Back-­‐End  Performance   –  Time  to  generate  page   –  10%  of  page  load  Hme   •  Front-­‐End  Performance   –  Network  Time   –  Browser  Time   –  90%  of  page  load  Hme   Source:  New  Relic   14  
  • 15. What  Is  Mobile?   •  Mobile  is  not  just  one  thing…   •  Mobile  Network     •  Mobile  Hardware   •  Mobile  SoVware   15  
  • 17. Mobile  Networks  are  SLLLOOOWWW…   Latency  (Ms)   400   350   300   250   200   150   100   50   0   Broadband   Mobile   Download  (Mbps)   Upload  (Mbps)   10   2.5   8   2   6   1.5   4   1   2   0.5   0   0   Broadband   Mobile   Broadband   Mobile   Source:  PCWorld,  FCC,  Novarum   17  
  • 18. SoluHons:  Reduce  Requests  &  Bytes     •  Why  Reduce  Requests?   –  High  Latency  +  Slow  Upload  =  Big  Req  Overhead   –  #  Requests  has  highest  correlaHon  to  load  Hme   •  Why  Reduce  Bytes?   –  Simple  math  –  less  to  download,  be?er  load  Hme   Correla7on  To  Page  Load  Time   0.35   0.3   0.25   0.2   #  Requests   0.15   #  Bytes   0.1   #  Domains   0.05   0   Nexus  S   XOOM   iPad   iPad2   iPhone   IE8   18  
  • 19. OpHmizaHon:  On-­‐Demand  Images   Mobile  Walmart  Apparel  Page   Mobile  Walmart  Apparel  Page   Original   Images-­‐On-­‐Demand   19  
  • 20. OpHmizaHon:  On-­‐Demand  Images   •  Reduced  Requests:  28  Requests  (33%)   •  Reduced  Bytes:  108  KB  (33%)   •  Reduced  Fully  Load  Time:  5.9s  (63%)   20  
  • 21. OpHmizaHon:  On-­‐Demand  Images   •  Site:  h?p://m.nbcsports.com/   •  Reduced  Requests:  15  Requests  (35%)   •  Reduced  Bytes:  50  KB  (31%)   21  
  • 22. Mobile  Networks  are  unreliable   •  High  Packet  Loss   –  High  noise     environment   –  Any  request     may  be  delayed   •  Non-­‐Sustainable  Speeds   –  Long-­‐lasHng  interrupHons     –  Moving  client   •  SoluHon:  Eliminate  Single-­‐Points-­‐of-­‐Failure   22  
  • 23. SoluHon:  Eliminate  SPOFs   •  Common  SPOFs     –  Scripts   –  CSS   –  IFrames   –  Fonts   •  SoluHon  #1:  Async  JS/CSS   •  SoluHon  #2:  Avoid/Delay  IFrames   •  SoluHon  #3:  Avoid  Fonts   23  
  • 24. Async  JS  –  Eliminate  Script  SPOF   Original   Async  JS   24  
  • 25. Latency  vs.  Start  Render:  Async  JS  in  AcHon   Start  Render  Time  per  Latency     (Milliseconds,  10  Top  Mobile  News  Sites)   6,000   5,000   4,000   3,000   2,000   1,000   0   30ms   100ms   200ms   300ms   Original  Site   With  Async  JavaScript   25  
  • 26. Non-­‐Persistent  Comm.  Channel   •  Mobile  Nets  have  limited  capacity   –  Limited  by  spectrum  &  ba?ery   •  ConnecHons  are  made  ad-­‐hoc   –  Then  dropped  by  device  &  tower   •  Impact:  1.5-­‐2  second  delay     –  Likely  for  every  single  page…     •  SoluHon:  Maintain  a  heartbeat   –  Send  a  dummy  request  every  2-­‐3  seconds   –  Will  maintain  a  live  cell  tower  connecHon   –  Make  sure  you  stop  it  aVer  a  while...   26  
  • 27. Non-­‐Persistent  Comm.  Channel   •  Mobile  Nets  have  limited  capacity   –  Limited  by  spectrum  &  ba?ery   •  ConnecHons  are  made  ad-­‐hoc   –  Then  dropped  by  device  &  tower   •  Impact:  1.5-­‐2  second  delay     –  Likely  for  every  single  page…     •  SoluHon:  Maintain  a  heartbeat   –  Send  a  dummy  request  every  2-­‐3  seconds   –  Will  maintain  a  live  cell  tower  connecHon   –  Make  sure  you  stop  it  aVer  a  while...   27  
  • 29. Mobile  SoVware  Is  Cool!   •  Designed  for  the  web   –  Browsing  a  key  acHon  from  day  1   •  Designed  for  Performance   –  Try  to  adapt  to  hardware,   ba?ery  and  network  limitaHons   •  Supports  modern  standards   –  Namely  HTML5  &  CSS  3.0   •  Includes  smart  browsers   –  Modern  JS  Engines,  look  ahead   downloads,  DNS  prefetching…   •  All  in  all:  A  friend,  not  a  foe   29  
  • 30. Mobile  Cache  Sizes  Too  Small   •  Mobile  Persistent  Cache  around  0-­‐25  MB   –  Memory  cache  a  bit  bigger,  but  short  lasHng   –  Compares  to  75-­‐250  MB  on  Desktop   •  Cache  cycled  through  several  Hmes  a  day   –  Average  page  size  ~400  KB  mobile,  ~800KB  desktop   –  Average  desktop  user  browses  88  pages/day   Cache  Capacity  in  MB   Cache  Capacity  in  Pages   30    70     25    60      50     20    40     15    30     10    20     5    10     0    -­‐         iPhone  4   Nexus  S   Blackberry   iPad  2   XOOM   iPhone  4   Nexus  S   Blackberry   iPad  2   XOOM   More  Info:  h?p://www.blaze.io/mobile/understanding-­‐mobile-­‐cache-­‐sizes/     30  
  • 31. Small  Cache  SoluHon:  localStorage   •  Use  HTML5  localStorage  for  caching   –  Available  on  all  major  mobile  plaworms   –  Doesn’t  expire,  survives  power  cycle   –  Size  limit  is  usually  ~5MB   •  Most  useful  for  caching  JavaScript  &  CSS  files   –  Using  for  images  will  quickly  consume  the  5MB   •  Scriptable  Access  enables  other  opHmizaHons   –  h?p://www.blaze.io/technical/browser-­‐cache-­‐2-­‐0-­‐scriptable-­‐cache/   •  In  addiHon,  use  far-­‐future  expiry  dates   –  Impacts  Android’s  cache  evicHon  policy   31  
  • 32. Mobile  SoVware:  Pipelining   •  HTTP  Pipelining  is  around  since  HTTP  1.1   –  Idea:  sending  mulHple  requests  on  connecHon   before  receiving  response   –  Most  useful  in  high  latency  environment   •  Big  in  Mobile   –  ~65%  of  mobile  clients   –  Also  included  in  iOS  5   –  Hardly  used  on  Desktop   32  
  • 33. Pipelining:  What  Should  You  Know?   With Pipelining •  Risks   –  Head-­‐of-­‐Line  Blocking   Slow  Resource   delays   •  Slow  resource  delaying  fast  ones   Fast  Resources   –  Resources  requested  out  of  order   •  Depends  on  heurisHcs   ConnecHon  1   Without Pipelining –  Support  detected  per  server/conn   –  Requires  explicit  Keep-­‐Alive  header   •  Conflicts  with  Domain  Sharding   h?p://www.blaze.io/mobile/h?p-­‐pipelining-­‐big-­‐in-­‐mobile/   ConnecHon  1   ConnecHon  2   33  
  • 34. Pipelining  Network  Capture  (Galaxy  S)   •  Samsung  Galaxy  S   –  Max  Conn:  12   –  Conn  Per  Host:  12   –  Max  Piped  Reqs:  6   –  Pipelining  Support   Scope:  Per  Conn   –  Conn/Pipe  Request   DistribuHon:  Fill  First     •  Full  Details:   hMp://www.blaze.io/technical/hMp-­‐ pipelining-­‐request-­‐distribu7on-­‐algorithms/   34  
  • 35. Pipelining:  What  to  do?   •  Make  sure  your  servers  support  HTTP  pipelining.     –  Most  reasonably  new  servers  do   •  Use  separate  domains  for  slow  &  fast  resources   –  Helps  avoid  a  slow  response  delaying  a  fast  one   •  Use  “ConnecHon:  Keep-­‐Alive”     –  Good  pracHce  anyway,  but  criHcal  for  pipelining   –  Include  an  explicit  keep-­‐alive  header  for  Android   •  Use  Domain  Sharding  carefully  (or  not  at  all)     –  Serving  resources  from  one  domain  helps  pipelining   –  Android  is  limited  to  4  connecHons  total  anyway…   35  
  • 36. Mobile  SoVware:  FragmentaHon   •  Too  Many  Browsers…   –  Top:  Android,  iOS   –  Other:  Opera,  Blackberry,  IE  Mobile,  WebOS,  Firefox   •  Too  li?le  visibility..   –  Especially  on  iOS  and  Blackberry   –  True  for  vendor-­‐specific  changes  to  Android   •  Too  frequent  changes…   •  Too  few  supporHng  tools…   36  
  • 37. Android  FragmentaHon  -­‐  ConnecHons   Samsung  Galaxy  S   Samsung  Nexus  S   Motorola  XOOM   -­‐  Max  Conn:  12   -­‐  Max  Conn:  4   -­‐  Max  Conn:  35   -­‐  Max  Conn  Per  Host:  12   -­‐  Max  Conn  Per  Host:  4   -­‐  Max  Conn  Per  Host:  6   -­‐  Max  Piped  Requests:  6   -­‐  Max  Piped  Requests:  3   -­‐  No  Pipelining  Support   37  
  • 38. Android  Tablets  Not  IdenHfied   •  www.cnet.com   Nexus  S   XOOM   iPad  2   38  
  • 39. Frequent  OS  &  Device  Updates   39  
  • 40. Mobile  Browser  Usage  –  North  America   40  
  • 41. FragmentaHon:  SoluHons   •  Focus  on  top  devices   –  Android  &  iOS  first   •  Blackberry  &  Opera  second   –  Test  on  key  Android  devices  &  tablets   •  Bolster  Server-­‐Side  DetecHon  with  Client-­‐Side   –  If  screen  is  wide,  redirect  to  desktop  version   •  Measure!   –  Hosted:  h?p://blaze.io/mobile/   –  Your  Devices:  h?p://pcapperf.appspot.com/   •  Stay  on  top  of  news   41  
  • 43. Mobile  Hardware:  Weaker  CPU   •  Weaker  CPU  =  Slower  JavaScript     –  SHll  10x  slower  than  desktop   •  Script  Parsing  is  Slow   –  About  1-­‐10ms/KB   Sunspider  Time  by  Device/Version   iPhone  4  (4.2)    10,303     •  Not  just  JavaScript   iPhone  4  (4.3)    4,285     –  Flash,  CSS,     iPhone  4  (5.0)    3,574     Dynamic  Graphics…   iPhone  4S  (5.0)    2,227     Macbook  Pro    230      -­‐          2,000      4,000      6,000      8,000      10,000      12,000     43  
  • 44. Hardware  Impact  on  Page  Load  Time   •  Alexa  US  Top  100:  Average  Load  Times   –  Measured  at  night  over  same  WiFi  +  Cable   iPhone     iPhone     iOS     4   4S   Simulator   Page  Load  Time   4000   CPU   1-­‐Core   2-­‐Core   2-­‐Core   3500   ~800Mhz   ~800Mhz   2.7Ghz   3000   2500   CPU  Cache   32  KB   32  KB   4  MB   2000   1500   1000   RAM   512  MB   512MB   8  GB   500   0   Median   3.4s   2.9s   1.5s   iPhone  4   iPhone  4S   iOS  Simulator   Page  Load   44  
  • 45. Mobile  Hardware:  Form  Factor   •  Mobile  Devices  are  Small…   –  Comes  with  the  territory   •  Two  Main  Sizes   –  Smartphone  (2.6’’  to  5.5’’)   –  Tablet  (7’’  to  10’’)   •  Design  Challenge  -­‐  Performance  Opportunity!   –  Can  reduce  data  to  match  screen  size   •  At  least  for  Smartphones…   –  Can  anHcipate  exact  resoluHon   45  
  • 46. Responsive  Images:  Resize  To  Screen   128px,     240px,  6.8  KB   2.9  KB   320px,  10.6  KB   480px,  21.3  KB   Site:   lonelyplanet.com   Device:   iPhone  4   Before:     867  KB   AZer:     Full  Res,  50.1  KB   570  KB   46  
  • 47. Mobile  Hardware:  Touchscreen   •  Touchscreen  common  in  Mobile   •  Touch  can  mean  many  things   –  Devices  lag  to  decide   Zoom?   Click?   Scroll?   •  Impact:  Delayed  Clicks   –  Take  300+  ms  to  decide  it’s  a  click     •  SoluHon:  Replace  click  with  touch   –  May  sHll  have  usability  implicaHons   47  
  • 49. What  Is  Mobile?   •  Mobile  is  not  just  one  thing…   •  Mobile  Network   •  Mobile  SoVware   •  Mobile  Hardware   49  
  • 50. Mobile  Web  Performance  Aspects   CHALLENGES SOLUTIONS •  Mobile  Network   •  Mobile  Network   –  Slow   –  Reduce  Requests,  Bytes   –  Unreliable   –  Async  All,  Avoid  SPOFs   –  Ad-­‐hoc  connecHons   –  Maintain  a  Heartbeat   •  Mobile  Hardware   •  Mobile  Hardware   –  Weak  CPU   –  Async/Avoid  Scripts   –  Small  Screens   –  Progressive  Images   –  Touchscreen   –  Touch  instead  of  Click   •  Mobile  SoVware   •  Mobile  SoVware   –  Small  Cache   –  localStorage   –  HTTP  Pipelining   –  Separate  Slow  Resources   –  FragmentaHon   –  Focus,  Measure   50  
  • 51. QuesHons?   Mobile  Web  Performance   Guy  Podjarny,  CTO   guypo@blaze.io  
  • 52. Sources   •  h?p://transiHon.fcc.gov/Daily_Releases/Daily_Business/2011/db0802/DOC-­‐308828A1.pdf   •  h?p://www.pcworld.com/arHcle/189592/atandt_roars_back_in_pcworlds_second_3g_wireless_performance_test.html   •  h?p://blog.kissmetrics.com/loading-­‐Hme/   •  h?p://www.slideshare.net/kleinerperkins/kpcb-­‐top-­‐10-­‐mobile-­‐trends-­‐feb-­‐2011   •  h?p://www.google.com/events/io/2011/sessions/use-­‐page-­‐speed-­‐to-­‐opHmize-­‐your-­‐web-­‐site-­‐for-­‐mobile.html   •  h?p://blog.newrelic.com/wp-­‐content/uploads/infog_061611.png   •  h?p://statcounter.com/   •  h?p://danzarrella.com/new-­‐data-­‐on-­‐mobile-­‐facebook-­‐posHng.html#   •  h?p://www.comscoredatamine.com/2011/02/top-­‐mobile-­‐acHviHes-­‐in-­‐us/   •  h?p://blog.twi?er.com/2010/09/evolving-­‐ecosystem.html   •  h?p://www.ecousHcs.com/pcmag/arHcles/2392095   •  h?p://mobile.h?parchive.org/   •  h?p://www.h?parchive.org/   •  h?p://blog.newrelic.com/wp-­‐content/uploads/infog_061611.png   •  h?p://www.gomez.com/wp-­‐content/downloads/19986_WhatMobileUsersWant_Wp.pdf   •  h?p://www.akamai.com/dl/whitepapers/ecommerce_website_perf_wp.pdf   •  h?p://www.novarum.com/novarum_blog/2009/02/real-­‐measurements-­‐of-­‐municipal-­‐wireless-­‐technologies-­‐wifi-­‐wimax-­‐ and-­‐cellular.html   •  h?p://www.neHndex.com/   •  h?p://features.journalism.org/2011/10/25/tablet-­‐revoluHon/   •  h?p://www.markeHngtechblog.com/ecommerce/infographic-­‐how-­‐is-­‐mobile-­‐impacHng-­‐retail-­‐commerce/   52  
  • 53. Techniques  to  Reduce  Requests   •  Merge  Files   –  Consolidate  JS/CSS  Files   –  Inline  small  JS/CSS  into  HTML   –  Inline  small  images  into  CSS   –  Avoid  CSS  @imports   •  Avoid  Unnecessary  Requests   –  Load  Images  On-­‐Demand   –  Avoid  redirects  where  possible   •  Cache  More   –  Cache  as  much  as  possible   –  Version  files  for  long-­‐term  cacheability   53  
  • 54. Techniques  to  Reduce  Bytes   •  Compress   –  Use  GZIP  compression  for  Text  Resources   –  Use  Lossless  Image  Compression   •  Remove  Surplus  Data   –  Minify  JavaScript,  CSS  &  HTML   –  Remove  unused  content  (CSS,  JS)   –  Reduce  quality  to  display  size   •  Shrink  Uploads   –  Serve  StaHc  Files  from  Cookieless  Domains   54  
  • 55. Form  Factor:  OpportuniHes   •  Responsive  Images:  Resize  To  Display  Size   –  No  point  in  sending  large  image  to  small  screen   –  Useful  Tool:  SenchaSrc  (resize  on  the  fly)   –  Refinement:  Lazy  load  bigger  image  on  zoom   •  Use  @media  to  use  minimal  CSS   –  Example:  <link  rel="stylesheet"  type="text/css”    media="screen  and   (max-­‐device-­‐width:  480px)”  href=”smartphone.css"  />   –  Can  include  resized  CSS  images     •  Be  careful  with  Progressive  Design   –  Watch  for  excessive  JavaScript  or  blocking  render   55  
  • 56. Weaker  CPU:  SoluHons  for  JS   •  Use  Less  JavaScript…   –  Don’t  send  Desktop  JS  to  Mobile  if  not  used   –  Pre-­‐Execute  as  much  as  you  can   •  Run  Dynamic  code  on  server,  return  staHc  content   –  Avoid  heavy  JavaScript  Libraries   •  Defer  Scripts   –  Run  scripts  that  aren’t  criHcal  only  aVer  onload   –  Defer  EvaluaHon  of  Inline  JavaScript   •  Download  code  as  comment,  evaluate  on-­‐demand   •  Async  Scripts   –  As  explained  earlier   56  
  • 57. Weaker  CPU:  SoluHons  for  Non-­‐JS   •  CSS   –  Avoid  CSS  Expressions   –  Avoid  inefficient  CSS  Rules   •  Example:  html  div  p  a  {color:  red}   •  Minimize  reflows   –  Specify  image  dimensions   –  Avoid  dynamic  content  not  at  bo?om   –  Avoid  dynamic  reordering  of  resources   •  Avoid  Flash   57