Using Charles Proxy to Optimize Mobile App Performance
2014-09-27 10:21
288 查看
under mobile, testing.
With today’s metered data plans and intolerance for slow apps, mobile app users are very sensitive to excessive data consumption and underperformance.
Even a well-functioning app can have underlying inefficiencies, and a great way to fully understand your app’s data usage pattern is by running all its traffic through an HTTP proxy like Charles.
When connected to the proxy you can complete tasks as a user would, to see exactly what’s being requested by your app, what’s being returned by the servers, and even the server response times.
Set up a Charles environment
(NOTE: Device and PC must be on the same Wi-Fi network)On your computer:
Download and run CharlesGo To Help -> Local IP and write down the IP Address
If you use SSL for your data requests:
Go to Proxy -> Proxy Settings -> SSL -> Check “Enable SSL” and add the host and port for your requests
You may also want to disable Desktop and web proxies from the Proxy dropdown so you can better isolate your app traffic
On your device:
Install the Charles SSL Certificate on your device, visit one of these URLs on your device, and accept the security warning:iOS: http://charles.noodlewerk.com/
Android: http://charlesproxy.com/charles.crt
Configure Device
For Android: go to Settings -> Wifi -> Tap and hold wi-fi SSID -> Modify Network -> Show advanced Options -> Proxy Settings -> Manual
Server = IP address from Step 2
Port = 8888
For iOS: go to Settings -> Wi-Fi -> (>) button for Wifi SSID -> Proxy=Manual ->
Server = IP address from Step 2
Port = 8888
You might want to turn off cellular data to ensure all traffic is run through Wi-Fi/Charles Proxy
NOTE: If you quit Charles the device will have no connection until you undo the items in step 2b or 2c.
Fire it up
Launch Charles and switch to the “sequence” tab in the top window to see each call and status as they are made in real-time, including response size and duration. Click on a request to view details in the bottom pane including: Overview, Request, Response& Summary.
Make sure you explore the options for the different data types. For example, if your response is an image, you can see the actual image and dimensions. If your app consumes JSON, you have a choice of a JSON Tree Navigator, or you can “copy response” by right-clicking
the request in the top “Sequence” tab. Paste the results into something like http://www.uize.com/examples/json-prettifier.html for
easy-to-read output.
I typically start with a fresh install of my application to ensure nothing is being read from the cache and that all data comes from the server, and then I start a new session. Here’s my list of some things to consider to ensure data transfer is optimized and
the app doesn’t have to work harder than is necessary:
Things to check during app launch
Is your app making a reasonable amount of data requests to balance startup time and pre-fetching, to speed up “next pages”?Is any request fetching more data than necessary?
Are the response times high due to server configuration or a poorly performing backend?
Things to check during app usage
Is there a common navigation path that is slow and could benefit from pre-fetching at launch?Is data actually coming from the cache rather than initiating a new data request?
Is any tracking data being sent (e.g. Omniture, Google Analytics, or other third-party services), and if so is it sent properly ?
Are there any requests being made erroneously or repeatedly due to a coding error?
If you serve video, is the proper encoding/format selected? (Charles can throttle speeds to mimic wireless phone connections.)
Are images appropriately sized for the device?
More Resources:
http://www.charlesproxy.com/Chapter 10. Secrets of High Performance Native Mobile Applications
相关文章推荐
- Using Charles Proxy to Optimize Mobile App Performance(手机抓包工具)
- how to update product listing price sale price and sale date using mobile App
- 【raspberry pi】server assistant to shutdown and reboot raspberry pi using mobile app
- 使用 Shark 来对你的 iPhone 应用进行性能调优(Using Shark to Performance Tune Your iPhone App)
- Using the AWR History Tables to compare performance
- How to use SSH Via HTTP Proxy using Corkscrew in Ubuntu
- How to optimize NexentaStor performance?
- How to monitor Web server performance by using counter logs in System Monitor in IIS
- Comparing Xamarin and Delphi XE5 to Xcode for Cross Platform Mobile App Development
- 解决error: failed to launch"/private/var/mobile/Applications/XX"-- timed out waiting for app to launch
- Using WITH Clause to mimic App Engine Temp Tables
- Quick Tip: Using Web Inspector to Debug Mobile Safari
- R12 APP-OFA-48392 Unable to Get The Concurrent Request Status Using Procedure FND_CONCURRENT.GET_REQUEST_STATUS
- Using JQuery Mobile and JSON to Create Mobile Applications
- Using Radio Interface Layer (RIL) to retrieve Cell Tower Information on Windows Mobile
- Slow performance occurs when you copy data to a TCP server by using a Windows Sockets API program
- How to using GIT behind http(s) Proxy
- Collecting performance counters and using SQL Server to analyze the data
- How to set IE proxy using VB.NET
- HOW TO Analyze ASP.NET Web Application Performance by Using the Performance Administration Tool