SlideShare a Scribd company logo
Is Your Mobile App Up to Speed?
The Art of Mobile Performance

Doug Sillars
Mobile Optimization Lead AT&T
Seattle, WA, USA

ckr.com/photos/photophilde/8108861388/
How Fast is Your Mobile App?
http://www.flickr.com/photos/35328181@N03/6276650179
http://www.flickr.com/photos/jimbrickett/2395474318
Mobile Data Visualized
1500

1000

500

0
The Internet
2000

Mobile
2012

In 2012, mobile data usage was 12x higher than ALL Internet usage in 2000.

http://www.cisco.com/en/US/solutions/collateral/ns341/ns525/ns537/ns705/ns827/white_paper_c11-520862.html
Mobile Data Visualized
1500

1000

500

0
The Internet
2000

Mobile
2012

If you count mobile data offloaded to Wi-Fi, it is closer to 18!
http://www.cisco.com/en/US/solutions/collateral/ns341/ns525/ns537/ns705/ns827/white_paper_c11-520862.html
http://timesofindia.indiatimes.com/tech/tech-news/internet/Over-50-of-internet-users-are-mobile-only-Report/articleshow/24121500.cms?
The Future
25000

20000

15000

10000

5000

0
2000

2012

2017

2017: 21 Exabytes of Mobile Data (46% Wi-Fi offload)
Explosive Growth
• Faster Networks
• More Powerful Devices

•Apps
– Video
– Music
– Social Media

2005
2005

Apps are revolutionizing the internet revolution!

2004
Mobile Expectations
• 85% of users prefer apps
– Perceived as:
– More convenient (55%)
– Faster (48%)
– Easier to browse (40%)

• 56% had a problem with an app
– Crash (62%)
– Slow (47%)
– Did not work (40%)

http://offers2.compuware.com/APM_13_WP_Mobile_App_Survey_Report_Registration.html
Expectations: Loading

http://offers2.compuware.com/APM_13_WP_Mobile_App_Survey_Report_Registration.html
Expectations: Performance
Very or Somewhat Important

60%
50%

Very Important

40%

Somewhat Important

30%

Neither Important Nor
Unimportant

20%

Not That Important

10%
Not At All Important
0%
Very Important
Somewhat Important
Neither Important Nor Not That Important All Important
Unimportant Not At

http://offers2.compuware.com/APM_13_WP_Mobile_App_Survey_Report_Registration.html
http://offers2.compuware.com/APM_13_WP_Mobile_App_Survey_Report_Registration.html
Battery Life
http://www.citeworld.com/mobile/21908/bad-app-experiences-are-badcustomer-experiences
My App?

http://www.flickr.com/photos/photocapy/43580405/sizes/o/in/photostream/
Testing Performance
• Learn How Mobile is Different
• Ensure You Are Optimized:
– Learn the best practices
– Test your application
– Fix issues before your customers discover them

• AT&T’s Application Resource Optimizer
(ARO)
– http://Developer.att.com/ARO
Mobile Data IS Different
Radio Resource
Control (RRC)
State Machine

Goal: Balance
Fast Network Connectivity
Battery Usage
Radio Resource Control (LTE)
Click
Me!

Continuous
Reception

IDLE
Goats!
Goat!
10s

Radio
OFF ON

Data Transfer
Timer Expiration

Battery

Data
Transfer

100ms

Tail
It’s All Connected
•Data traffic triggers RRC State
transitions:
• RRC State transitions control
– Speed/User Experience
It’s All Connected
•Application traffic triggers RRC State
transitions:
• RRC State transitions control
– Speed/User Experience

– Device battery life
It’s All Connected
•Application traffic triggers RRC State
transitions:
• RRC State transitions control
– Speed/User Experience

– Device battery life
– Network efficiency
AT&T’s Application Resource Optimizer
(ARO)
•
•
•
•
•
•

Free diagnostic tool
Open Source
Test any Platform
Emulate any carrier network
Analysis of both Native Apps and the Mobile Web
Winner of the 2013 GSMA Smartphone Application
Challenge award at MWC
• 2013 American Business Award: Tech Innovation of the
Year
• Allows YOU as a developer to SEE exactly how data
is flowing from your app!
How Do I Test My App?

• All Platforms: Pcap/tcpdump network trace
• Ex: Wi-Fi Hotspot (like Connectify) and Wireshark/NetMon to collect
• iOS: Native Collection tethered from Mac coming 03/2014!
• Android and Windows 8: Native ARO Collector
• Note: Android collector requires root (non-root collector in development)
How Did I Do?

Transfer Trace Files

• Test your app
– Active Use
– IDLE (for
Ads/analytics)
– Background Data

ARO Analyzer (PC/MAC/Linux)
•Applies Radio and Power models
to data
•Graded against 25 Best Practices
•Learn how your application
ACTUALLY behaves!
ARO Analyzer
• All network
traffic mapped
to processes

• Stats about
trace
Best Practices
Best Practices –File Download
• Make Stuff Smaller

• Download Less Stuff
Make Stuff Smaller: Text Files

• Gzip
– Smaller files
download faster
and use less data
– Best for files
> 800 bytes
Make Stuff Smaller: Text Files

• Minification:

– Removing human readable
formatting reduces size
– Separate the wheat from
the chaff

http://www.flickr.com/photos/11795120@N06/3832256313
Make Stuff Smaller: Images

119 KB PNG

(1024x1024)

www.Smushit.com (lossless compression)
78 kb 33% savings!)

720 Pixels wide
Best Practices –File Download
• Make Stuff Smaller

• Download Less Stuff
Download Less Stuff: Caching
• 17% of HTTP content on mobile is duplicate data
– Reading from Cache is 75-99% faster than
downloading again
4.8 MB duplicate!
75% possible
savings!

(data AND speed)

6.7MB

“Web Caching on Smartphones: Ideal vs.
Reality”, http://www.research.att.com/~sen/pub/Caching_mobisys1
2.pdf

6.7MB
Caching Support by Library
Android Connection Libraries

Android &
Safari

iOS Libraries

Test Name

UC

HUC

HC

WV

HRC

T20

NSUR

Basic caching













Revalidation















Non-caching
directives













Expiration
directives











URL with query
string









Partial caching







Redirection







ASIH
R

AB

SB





























































Even if caching IS supported – it is OFF by default!!
Caching Methods (How do I do it?)
ETags
• Each file has a Unique Tag
• Revalidated on server for each request
– High Performance Web Sites:
Rule 1 – Make Fewer HTTP Requests
– Adding a connection drains battery,
adds 500-3,000 ms latency

(1)

Cache Control Headers
• Important to carefully assign Max-Age times
• App will not check file on server until Max-Age
is reached
– Retrieval is strictly file processing time

(1) http://developer.yahoo.com/blogs/ydn/posts/2007/04/rule_1_make_few/
Comparing ETag vs. Cache Control
Network Usage

NO Cache

ETag
Cache
Control

Battery Drain

Data Usage

Speed

YES entire file
downloaded

Full network
connection
made

High

Slowest

Yes – ETag in
cache is validated
on server

Full network
connection

Low

Slow

No

N/A

N/A

Fast

Any Caching is better than no caching, but for mobile, Cache Control is preferred
Caching: Worth the Effort?
Android 4.0:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Add this!

//establish a cache
try {
File httpCacheDir = new File(getCacheDir(), "http");
long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
HttpResponseCache.install(httpCacheDir, httpCacheSize);
//
}
catch (IOException e) {
Log.i(TAG, "HTTP response cache installation failed:" + e);
}

Don’t leave older devices in the cold: Consider adding reflection for
older versions of Android

http://developer.android.com/reference/android/net/http/HttpResponseCache.html
Download Less Stuff: Combine Files
• Minimize # of Downloads and Connections
– Rule #1 for Faster Websites: Make Fewer HTTP
Requests

• Mobile Web:
– 5% > 10 CSS requests
– 45% > 10 JS requests
– 27% > 50 images

• Inline and Combine CSS and JS when Possible
• Consider Spriting images
http://stevesouders.com/hpws/rules.php
HTTP Archive: Personal results 09/2013 data
Best Practices: Connections
• Fewer
Connections:
faster and use less
battery
Fewer Connections
Imagine an app that:
1. Downloads an image every 60s
2. Downloads an Ad every 60s
3. Sends Analytics to a Server every 60s

Meet chicks!

?Chickens=awesome

35s of radio time every 60s (38J!)
Optimized Connections
Now, look what happens if your connections
are grouped together:
1. Downloads an image every 60s
2. Downloads an Ad every 60s
3. Sends Analytics to a Server every 60s
Meet chicks!

?Chickens=awesome

15s of radio (16J) every 60s

(58% savings!)
How Do I Group Connections
if (Tel.getDataActivity() >0){
if (Tel.getDataActivity() <4){
//ok, we are passed the minimum time to check
//and we found network activity//download the image here using image getter
imagegetter(counter, numberofimages);

//and show the ad
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
adView.loadAd(adRequest);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
Grouping Connections for Speed
• Threading file downloads vs. serial
download
Grouping Connections for Speed
• Not only can you save battery, but you
can speed up your application by
managing connections properly:
• Removing redirects to files
2 sec

{

Redirection adds ~2-3 seconds for each request
Grouping Connections for
Speed

• Not only can you save battery, but
you can speed up your application
by managing connections properly:
• Pre-fetching files that are used often
Closing Connections

• > 80% of
applications do
NOT close
connections
when they are
finished!!
Closing Connections: Example

38% more power on LTE!
(18% more power on 3G)
Closing Connections: CODE
• MultiRes Sample app from Android SDK
– Modified to download images
HttpURLConnection getimagecloseconn = (HttpURLConnection)
urln.openConnection();
getimagecloseconn.setRequestProperty("connection", "close");
getimagecloseconn.connect();
String cachecontrol = getimagecloseconn.getHeaderField("CacheControl");
InputStream isclose = getimagecloseconn.getInputStream();
bitmap = BitmapFactory.decodeStream(isclose);
getimagecloseconn.disconnect();
https://github.com/attdevsupport/ARO/tree/master/2013DevSummitTurbocharge
Fewer Connections: Periodic

• Background data traffic:
– 27% of data
– 55% of network time
http://www2.research.att.com/~fengqian/paper/screen_imc12.pdf
Connections: 30x Redirects
• Redirection to another server can add 200600ms on each connection

• Request xyz.com
– Redirects to www.xyz.com
– Redirects to xyz.mobi
– Redirects to www.xyz.mobi

• ARO has Waterfall visualization of packets
HTTP Response Codes
• Look for error codes: 404s

Error messages should be short and sweet
Best Practices: HTML
• Order Matters

• Hiding Code
HTML Tricks
• Javascript files block
rendering when
downloaded before
CSS:
– CSS Before JS
– JS Asynchronous load

• CSS “Display:none”
– Hides images from user
– Images still downloaded
Everyone Wins With ARO
•
•
•
•

Faster Apps
Efficient Battery Use
Better App Reviews
More Efficient
Network Traffic
• Happier Customers!

Customers

Developers

Carriers

Highly Performing apps require Development Art beyond an awesome UI.
ARO
• Free
• Open Source
• Test all Platforms
• Developer.att.com/ARO
• KnowMyApp.org
Thank You!

@dougsillars
ds1782@att.com
Developer.att.com/ARO

More Related Content

PDF
Doug Sillars on App Optimization
PPTX
Purple is the New Black: Modern Approaches for Application Security
PDF
Testing Mobile App Performance
PPTX
Improve the Impact of DevOps
PDF
I Love APIs Europe 2015: Developer Sessions
PPTX
Tqm deepak R Gorad
DOC
resume
PDF
Book soprmat-fermastn
Doug Sillars on App Optimization
Purple is the New Black: Modern Approaches for Application Security
Testing Mobile App Performance
Improve the Impact of DevOps
I Love APIs Europe 2015: Developer Sessions
Tqm deepak R Gorad
resume
Book soprmat-fermastn

Viewers also liked (15)

PDF
HomeCity Pathankot
PPTX
Why ONAJIN?
DOC
Abstract10
PPTX
Bad Implementations of Good Ideas: How Systematic Inattention to Performance ...
PPTX
Fossil Fuel Divestment
PDF
Communication projects
PDF
Embedded projects
PPT
Ky nang giao tiep oralcommunication
PPTX
Nortura Address at Meatco Producer of the Year Awards 2013
PDF
Project titles for eee, ece, eie
PPTX
The men who carve god
PPTX
Scaling wordpress for high traffic
PPT
Digitalfilter2
PDF
Deepak ib solved paper
HomeCity Pathankot
Why ONAJIN?
Abstract10
Bad Implementations of Good Ideas: How Systematic Inattention to Performance ...
Fossil Fuel Divestment
Communication projects
Embedded projects
Ky nang giao tiep oralcommunication
Nortura Address at Meatco Producer of the Year Awards 2013
Project titles for eee, ece, eie
The men who carve god
Scaling wordpress for high traffic
Digitalfilter2
Deepak ib solved paper
Ad

Similar to Is your mobile app up to speed softwaresymposium (20)

PDF
ALT-F1.BE : The Accelerator (Google Cloud Platform)
PDF
How to Lower Android Power Consumption Without Affecting Performance
PDF
Big Data And HTML5 (DevCon TLV 2012)
PPTX
Datasets, APIs, and Web Scraping
PDF
DevOps: Find Solutions, Not More Defects
PDF
Data in Motion - tech-intro-for-paris-hackathon
PDF
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
PDF
Innovate 2013 session 1243 mobile testing.v3
PDF
Cloud Experience: Data-driven Applications Made Simple and Fast
PPTX
Performance Quality Metrics for Mobile Web and Mobile Native - Agile Testing ...
PDF
Monitoring in 2017 - TIAD Camp Docker
PDF
Mobile is slow - Over the Air 2013
PPT
Leveraging The Cloud In 2009
PPTX
Big-Data Server Farm Architecture
PDF
Architecting and Tuning IIB/eXtreme Scale for Maximum Performance and Reliabi...
PDF
A Journey to Building an Autonomous Streaming Data Platform—Scaling to Trilli...
PDF
Industrial IoT bootcamp
PDF
Modern Web Applications
PPTX
Docker:- Application Delivery Platform Towards Edge Computing
PDF
Application Delivery Platform Towards Edge Computing - Bukhary Ikhwan
ALT-F1.BE : The Accelerator (Google Cloud Platform)
How to Lower Android Power Consumption Without Affecting Performance
Big Data And HTML5 (DevCon TLV 2012)
Datasets, APIs, and Web Scraping
DevOps: Find Solutions, Not More Defects
Data in Motion - tech-intro-for-paris-hackathon
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
Innovate 2013 session 1243 mobile testing.v3
Cloud Experience: Data-driven Applications Made Simple and Fast
Performance Quality Metrics for Mobile Web and Mobile Native - Agile Testing ...
Monitoring in 2017 - TIAD Camp Docker
Mobile is slow - Over the Air 2013
Leveraging The Cloud In 2009
Big-Data Server Farm Architecture
Architecting and Tuning IIB/eXtreme Scale for Maximum Performance and Reliabi...
A Journey to Building an Autonomous Streaming Data Platform—Scaling to Trilli...
Industrial IoT bootcamp
Modern Web Applications
Docker:- Application Delivery Platform Towards Edge Computing
Application Delivery Platform Towards Edge Computing - Bukhary Ikhwan
Ad

More from Doug Sillars (20)

PPTX
Fastandbeautiful belfast
PPTX
Fastandbeautiful gdg sacremento
PPTX
Fastandbeautiful gd glittlerock
PPTX
Fastandbeautiful webinale
PPTX
Ai powered images-pythonljubjana
PPTX
Fastandbeautiful zagrebtechsauna
PPTX
Video js zagreb
PDF
Vkmdp cologne
PPTX
Ai powered images-gdgtirana
PPTX
A rt gallery pantalks
PPTX
Ai powered images-sarajevo
PPTX
A rt gallery hub387
PPTX
Ai powered images-zurichpydata
PPTX
Fastandbeautiful vienna
PPTX
Ai powered images-opieaivienna
PPTX
A rt gallery devfestlondon
PPTX
Fastandbeautiful devfest london
PPTX
A rt gallery cardiff
PPTX
Ai powered images-mobileera
PPTX
Fastandbeautiful oredev
Fastandbeautiful belfast
Fastandbeautiful gdg sacremento
Fastandbeautiful gd glittlerock
Fastandbeautiful webinale
Ai powered images-pythonljubjana
Fastandbeautiful zagrebtechsauna
Video js zagreb
Vkmdp cologne
Ai powered images-gdgtirana
A rt gallery pantalks
Ai powered images-sarajevo
A rt gallery hub387
Ai powered images-zurichpydata
Fastandbeautiful vienna
Ai powered images-opieaivienna
A rt gallery devfestlondon
Fastandbeautiful devfest london
A rt gallery cardiff
Ai powered images-mobileera
Fastandbeautiful oredev

Is your mobile app up to speed softwaresymposium

  • 1. Is Your Mobile App Up to Speed? The Art of Mobile Performance Doug Sillars Mobile Optimization Lead AT&T Seattle, WA, USA ckr.com/photos/photophilde/8108861388/
  • 2. How Fast is Your Mobile App?
  • 5. Mobile Data Visualized 1500 1000 500 0 The Internet 2000 Mobile 2012 In 2012, mobile data usage was 12x higher than ALL Internet usage in 2000. http://www.cisco.com/en/US/solutions/collateral/ns341/ns525/ns537/ns705/ns827/white_paper_c11-520862.html
  • 6. Mobile Data Visualized 1500 1000 500 0 The Internet 2000 Mobile 2012 If you count mobile data offloaded to Wi-Fi, it is closer to 18! http://www.cisco.com/en/US/solutions/collateral/ns341/ns525/ns537/ns705/ns827/white_paper_c11-520862.html http://timesofindia.indiatimes.com/tech/tech-news/internet/Over-50-of-internet-users-are-mobile-only-Report/articleshow/24121500.cms?
  • 7. The Future 25000 20000 15000 10000 5000 0 2000 2012 2017 2017: 21 Exabytes of Mobile Data (46% Wi-Fi offload)
  • 8. Explosive Growth • Faster Networks • More Powerful Devices •Apps – Video – Music – Social Media 2005 2005 Apps are revolutionizing the internet revolution! 2004
  • 9. Mobile Expectations • 85% of users prefer apps – Perceived as: – More convenient (55%) – Faster (48%) – Easier to browse (40%) • 56% had a problem with an app – Crash (62%) – Slow (47%) – Did not work (40%) http://offers2.compuware.com/APM_13_WP_Mobile_App_Survey_Report_Registration.html
  • 11. Expectations: Performance Very or Somewhat Important 60% 50% Very Important 40% Somewhat Important 30% Neither Important Nor Unimportant 20% Not That Important 10% Not At All Important 0% Very Important Somewhat Important Neither Important Nor Not That Important All Important Unimportant Not At http://offers2.compuware.com/APM_13_WP_Mobile_App_Survey_Report_Registration.html
  • 16. Testing Performance • Learn How Mobile is Different • Ensure You Are Optimized: – Learn the best practices – Test your application – Fix issues before your customers discover them • AT&T’s Application Resource Optimizer (ARO) – http://Developer.att.com/ARO
  • 17. Mobile Data IS Different Radio Resource Control (RRC) State Machine Goal: Balance Fast Network Connectivity Battery Usage
  • 18. Radio Resource Control (LTE) Click Me! Continuous Reception IDLE Goats! Goat! 10s Radio OFF ON Data Transfer Timer Expiration Battery Data Transfer 100ms Tail
  • 19. It’s All Connected •Data traffic triggers RRC State transitions: • RRC State transitions control – Speed/User Experience
  • 20. It’s All Connected •Application traffic triggers RRC State transitions: • RRC State transitions control – Speed/User Experience – Device battery life
  • 21. It’s All Connected •Application traffic triggers RRC State transitions: • RRC State transitions control – Speed/User Experience – Device battery life – Network efficiency
  • 22. AT&T’s Application Resource Optimizer (ARO) • • • • • • Free diagnostic tool Open Source Test any Platform Emulate any carrier network Analysis of both Native Apps and the Mobile Web Winner of the 2013 GSMA Smartphone Application Challenge award at MWC • 2013 American Business Award: Tech Innovation of the Year • Allows YOU as a developer to SEE exactly how data is flowing from your app!
  • 23. How Do I Test My App? • All Platforms: Pcap/tcpdump network trace • Ex: Wi-Fi Hotspot (like Connectify) and Wireshark/NetMon to collect • iOS: Native Collection tethered from Mac coming 03/2014! • Android and Windows 8: Native ARO Collector • Note: Android collector requires root (non-root collector in development)
  • 24. How Did I Do? Transfer Trace Files • Test your app – Active Use – IDLE (for Ads/analytics) – Background Data ARO Analyzer (PC/MAC/Linux) •Applies Radio and Power models to data •Graded against 25 Best Practices •Learn how your application ACTUALLY behaves!
  • 25. ARO Analyzer • All network traffic mapped to processes • Stats about trace
  • 27. Best Practices –File Download • Make Stuff Smaller • Download Less Stuff
  • 28. Make Stuff Smaller: Text Files • Gzip – Smaller files download faster and use less data – Best for files > 800 bytes
  • 29. Make Stuff Smaller: Text Files • Minification: – Removing human readable formatting reduces size – Separate the wheat from the chaff http://www.flickr.com/photos/11795120@N06/3832256313
  • 30. Make Stuff Smaller: Images 119 KB PNG (1024x1024) www.Smushit.com (lossless compression) 78 kb 33% savings!) 720 Pixels wide
  • 31. Best Practices –File Download • Make Stuff Smaller • Download Less Stuff
  • 32. Download Less Stuff: Caching • 17% of HTTP content on mobile is duplicate data – Reading from Cache is 75-99% faster than downloading again 4.8 MB duplicate! 75% possible savings! (data AND speed) 6.7MB “Web Caching on Smartphones: Ideal vs. Reality”, http://www.research.att.com/~sen/pub/Caching_mobisys1 2.pdf 6.7MB
  • 33. Caching Support by Library Android Connection Libraries Android & Safari iOS Libraries Test Name UC HUC HC WV HRC T20 NSUR Basic caching       Revalidation        Non-caching directives       Expiration directives      URL with query string     Partial caching    Redirection    ASIH R AB SB                               Even if caching IS supported – it is OFF by default!!
  • 34. Caching Methods (How do I do it?) ETags • Each file has a Unique Tag • Revalidated on server for each request – High Performance Web Sites: Rule 1 – Make Fewer HTTP Requests – Adding a connection drains battery, adds 500-3,000 ms latency (1) Cache Control Headers • Important to carefully assign Max-Age times • App will not check file on server until Max-Age is reached – Retrieval is strictly file processing time (1) http://developer.yahoo.com/blogs/ydn/posts/2007/04/rule_1_make_few/
  • 35. Comparing ETag vs. Cache Control Network Usage NO Cache ETag Cache Control Battery Drain Data Usage Speed YES entire file downloaded Full network connection made High Slowest Yes – ETag in cache is validated on server Full network connection Low Slow No N/A N/A Fast Any Caching is better than no caching, but for mobile, Cache Control is preferred
  • 36. Caching: Worth the Effort? Android 4.0: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Add this! //establish a cache try { File httpCacheDir = new File(getCacheDir(), "http"); long httpCacheSize = 10 * 1024 * 1024; // 10 MiB HttpResponseCache.install(httpCacheDir, httpCacheSize); // } catch (IOException e) { Log.i(TAG, "HTTP response cache installation failed:" + e); } Don’t leave older devices in the cold: Consider adding reflection for older versions of Android http://developer.android.com/reference/android/net/http/HttpResponseCache.html
  • 37. Download Less Stuff: Combine Files • Minimize # of Downloads and Connections – Rule #1 for Faster Websites: Make Fewer HTTP Requests • Mobile Web: – 5% > 10 CSS requests – 45% > 10 JS requests – 27% > 50 images • Inline and Combine CSS and JS when Possible • Consider Spriting images http://stevesouders.com/hpws/rules.php HTTP Archive: Personal results 09/2013 data
  • 38. Best Practices: Connections • Fewer Connections: faster and use less battery
  • 39. Fewer Connections Imagine an app that: 1. Downloads an image every 60s 2. Downloads an Ad every 60s 3. Sends Analytics to a Server every 60s Meet chicks! ?Chickens=awesome 35s of radio time every 60s (38J!)
  • 40. Optimized Connections Now, look what happens if your connections are grouped together: 1. Downloads an image every 60s 2. Downloads an Ad every 60s 3. Sends Analytics to a Server every 60s Meet chicks! ?Chickens=awesome 15s of radio (16J) every 60s (58% savings!)
  • 41. How Do I Group Connections if (Tel.getDataActivity() >0){ if (Tel.getDataActivity() <4){ //ok, we are passed the minimum time to check //and we found network activity//download the image here using image getter imagegetter(counter, numberofimages); //and show the ad AdRequest adRequest = new AdRequest(); adRequest.addTestDevice(AdRequest.TEST_EMULATOR); adView.loadAd(adRequest); // Initiate a generic request to load it with an ad adView.loadAd(new AdRequest());
  • 42. Grouping Connections for Speed • Threading file downloads vs. serial download
  • 43. Grouping Connections for Speed • Not only can you save battery, but you can speed up your application by managing connections properly: • Removing redirects to files 2 sec { Redirection adds ~2-3 seconds for each request
  • 44. Grouping Connections for Speed • Not only can you save battery, but you can speed up your application by managing connections properly: • Pre-fetching files that are used often
  • 45. Closing Connections • > 80% of applications do NOT close connections when they are finished!!
  • 46. Closing Connections: Example 38% more power on LTE! (18% more power on 3G)
  • 47. Closing Connections: CODE • MultiRes Sample app from Android SDK – Modified to download images HttpURLConnection getimagecloseconn = (HttpURLConnection) urln.openConnection(); getimagecloseconn.setRequestProperty("connection", "close"); getimagecloseconn.connect(); String cachecontrol = getimagecloseconn.getHeaderField("CacheControl"); InputStream isclose = getimagecloseconn.getInputStream(); bitmap = BitmapFactory.decodeStream(isclose); getimagecloseconn.disconnect(); https://github.com/attdevsupport/ARO/tree/master/2013DevSummitTurbocharge
  • 48. Fewer Connections: Periodic • Background data traffic: – 27% of data – 55% of network time http://www2.research.att.com/~fengqian/paper/screen_imc12.pdf
  • 49. Connections: 30x Redirects • Redirection to another server can add 200600ms on each connection • Request xyz.com – Redirects to www.xyz.com – Redirects to xyz.mobi – Redirects to www.xyz.mobi • ARO has Waterfall visualization of packets
  • 50. HTTP Response Codes • Look for error codes: 404s Error messages should be short and sweet
  • 51. Best Practices: HTML • Order Matters • Hiding Code
  • 52. HTML Tricks • Javascript files block rendering when downloaded before CSS: – CSS Before JS – JS Asynchronous load • CSS “Display:none” – Hides images from user – Images still downloaded
  • 53. Everyone Wins With ARO • • • • Faster Apps Efficient Battery Use Better App Reviews More Efficient Network Traffic • Happier Customers! Customers Developers Carriers Highly Performing apps require Development Art beyond an awesome UI.
  • 54. ARO • Free • Open Source • Test all Platforms • Developer.att.com/ARO • KnowMyApp.org

Editor's Notes

  • #12: Redo graphs
  • #14: http://www2012.wwwconference.org/proceedings/proceedings/p41.pdfhttp://gizmodo.com/5992917/battery-life-is-the-only-spec-that-mattershttp://mobithinking.com/blog/greedy-apps
  • #16: Learn How Mobile is DifferentEnsure You Are Optimized:Learn the best practicesTest your applicationFix issues before your customers discover themAT&amp;T’s Application Resource Optimizer (ARO) http://Developer.att.com/AROIn 2012, &lt;2% of tested apps required no optimizationhttp://www.flickr.com/photos/photocapy/43580405/sizes/o/in/photostream/
  • #18: Funny picture??
  • #30: Separating the wheat from the chaff