Skip to content
hariramachandra edited this page Dec 12, 2012 · 16 revisions

Introduction

Mobster is a tool that can help you get deeper understanding into the performance of mobile web applications on real mobile devices. Mobster can provide you with non-intrusive performance profiling of mobile web applications, automatically detect regressions in page performance including average loadtime, average size and memory usage, provide insights into native browser events and easy integration with testing and release process.

Mobster is built off of the WebKit framework and leverages real devices to extract data that can help you to measure and improve your mobile performance.

Why Mobster?

Mobster provides a simple way for developers to record crucial web performance data on mobile devices while running automated flows. Using Mobster, developers can test the performance of their site on a variety of devices and easily detect any performance regressions. The table below compares Mobster with the tools available for performance measurement web applications on mobile devices.

Features

  • Record page timings,network resource sizes and timings
  • Record internal browser / DOM events like GC, paints, and CSS recalculates
  • Support for Automation to execute custom flows specified in a simple JSON format
  • Reports including HTTP waterfalls and Memory Utilization
  • Non-intrusive performance profiling of mobile web apps
  • Automatically detect regressions in page performance and memory usage

Architecture

Mobster collects data via the WebKit Remote Debugging protocol. The current version is compatible with any Android device with Chrome installed.

Key Components:

WebKit Communicator - Handles low-level sending and receiving of messages. Provides a way to specify callbacks

Remote WebKit Client - Uses WebKitCommunicator to provide an API for sending commands to the browser and querying for data (e.g. tell the browser to navigate to a URL, get CSS profiling results) FlowProfiler - Interprets the flow file specified by the user and uses WebKitClient's API to perform the actions from the flow, while recording the results

Getting Started

(1) Using Mobster to measure performance of web applications on Android Device

Prerequisites

If you want to use Mobster to measure performance of web applications on a physical android device , you need to install Android SDK version 4.0 or later on your host. You can download SDK here Download and install Python 2.6.6+ (but not Python 3) . You should download and install PIP, you can find instructions to download and install PIP here

  1. Check out mobster code

svn co svn+ssh://svn.corp.linkedin.com/perfrepo/trunk/utils/remote_browser_perf/mobster
2. If using virtualenv, create your virtual environment and enter it (see virtualenv documentation for more details)

(x) virtualenv [your/favorite/location]mobster_env source [your/favorite/location]mobster_env/bin/activate

  1. Install the packages listed in requirements.txt

cd mobster pip install -r requirements.txt 2. Open Chrome on your device. If using desktop Chrome, start it with remote debugging enabled and remote debugging port set to 9222, e.g. (for Mac OS):

open -a "Google Chrome" --args --remote-debugging-port=9222 --enable-memory-info

 To test if the remote debugging is working try this on your chrome browser - http://localhost:9222
  1. Connecting Mobster to Android device

Connect the device to your computer via USB enable USB debugging on the device in settings -> Developer Options -> USB Debugging ( Please refer to your device manuals for details ) Open Chrome browser in the device and enable USB debugging in Settings -> Advanced -> Developer Tools -> Enable USB Web debugging Execute the command below under the Android SDK folder

./<Android-SDK-Folder>/platform-tools/adb forward tcp:9222 localabstract:chrome_devtools_remote

  1. Open Chrome on the device

  2. Run the main Mobster script with a sample flow in your mobster home directory : ( You should be in your virtual environment to execute this command )

``'-d outputdir', help='Write JSON file to specified directory' '-f filename', help='Used specified name for JSON file' '-u urls', help='Comma separated URLs to profile' '-t testfile', required=True, help='Use specified JSON test file to determine test actions' '-i iterations', help='Do profiling task the specified number of times' '-a average', action='store_true', help='Output the average results of the iterations' '-p report', action='store_true', help='Call make_report.py to make a report and open it'

./bin/mobster.py -t sampleinput/premsubscriptions.json -i 1 -a -p`` You should now be viewing the report in the browser. To learn how to make your own flows, look at the scripts in the bin/sampleinput/ directory.

(2) Using Mobster to measure performance of web applications on Desktop

Prerequisites

Download and install Python 2.6.6+ (but not Python 3) . You should download and install PIP, you can find instructions to download and install PIP here You should install Chrome 18+

  1. Check out mobster code

svn co svn+ssh://svn.corp.linkedin.com/perfrepo/trunk/utils/remote_browser_perf/mobster 2. If using virtualenv, create your virtual environment and enter it (see virtualenv documentation for more details)

(x) virtualenv [your/favorite/location]mobster_env source [your/favorite/location]mobster_env/bin/activate 3. Install the packages listed in requirements.txt

cd mobster pip install -r requirements.txt 2. Start Chrome on your desktop with remote debugging enabled and remote debugging port set to 9222:

Mac OS:

open -a "Google Chrome" --args --remote-debugging-port=9222 --enable-memory-info Red Hat Linux (assuming google-chrome is in your PATH):

google-chrome --args --remote-debugging-port=9222 To test if the remote debugging is working try this on your chrome browser - http://localhost:9222

  1. Run the main Mobster script with a sample flow in your mobster home directory : ( You should be in your virtual environment to execute this command )

./bin/mobster.py -o data.json -t bin/sampleinput/limobilelogin.json 4. Generate a report with the collected data and open it in a browser:

./bin/make_report.py -r data.json -b You should now be viewing the report in the browser. To learn how to make your own flows, look at the scripts in the bin/sampleinput/ directory.

Future Roadmap

  • iOS Support
  • Windows Mobile Support
  • DNS timing
  • Enhance page speed metrics ( Time to First Byte, rendering time, DOM ready etc )
  • Multi-tab reports with bottlenecks identified for each page
  • Integration with Selenium for Flow Automation
  • Fixing Missing gaps in the HAR contents
  • Resource Timing ( pending support in webkit - tracked by id=61138 and id=42434 )

Note : Apple has received feature requests which would allow Mobster to work on iOS, but it is unclear if/when the feature will be added