Technical Description

Below we describe the technical details of the Alice impementation for Android. Alice is a mobile experimentation libary which enables large-scale experimentation from mobile end hosts, with a powerful, programmable experiment interface.

Alice Basics

The basic abstraction within Alice the Experiment. Each experiment consists of a unique experiment ID, temporal properties such as when, how often and how many times the experiment should run, and the experiment script itself. Multiple experiments can be (and often are) run on each device at any given point and time.

Engine Capability

Alice currently operates under the Dasu model, with discrete probes being launched from the experiment in both parallel and serial versions. The following probes are implemented in Alice:

  • DNS (active) - Allows DNS lookup functionality similar to dig.
  • HTTP Get (active) - Performs an HTTP Get request for a specified URL.
  • IPerf (active) - Bandwidth testing tool with various control parameters.
  • Device Info (active) - Records device specific information such as the device unique identifier and available radios and sensors.
  • NDT (active) - Network Diagnostic Tool is an existing robust network performance testing suite implemented in Java.
  • Network Info (active) - Records the active and available network interfaces (i.e. WiFI, 3g, 4g).
  • Ping (active) - A ping probe which measures the RTT for a specified IP address.
  • Traceroute (active) - A traceroute probe.
  • Traffic Stats (active) - Records the bytes used by each registered application, similar to running /proc/stat/net.
  • GPS (context) - Records a user’s current location at cell tower granularity.
  • Cellular Signal Strength (context) - Records the measured cellular signal from the device for a specified time inter- val.
  • Wifi Scan (context) - Performs a WiFi access point scan.

Each active probe exists as a serial and parallel probe. When each parallel probe is executed, it is added to that probe's queue in the Alice runtime, and then immediately returns. Each probe queue is allowed to run a maximum number of parallel tasks; additional probes wait in the queue until a previous probe finishes. Each serial probe blocks during its execution, and returns the probes result as a JSON object. This JSON object can be used by subsequent logic within the same experiment script.

Experiment Scripts

Experiments in Alice are written in Javascript and run within a Android WebView. This allows Alice to isolate each experiment script within the WebView, while adding probe capabilities by binding Java code to the Javascript methods through the WebView.

Example Alice Script

% Comments are prefaced with percent sign %
%
% Experiment parameters such as 'id' are separated with =

id=400
frequencySeconds=3600
repeat=1
probeCount=0

% White spaces are ignored

%experiment code written in <script> tags

<script type="text/javascript">

function store(key,value) {
    AndroidMeasurementEngine.put(key, JSON.stringify(value));
}

function get_a_record_ip(dnsresponse) {
    if (dnsresponse.answers.length > 0) {
      for (var ind=0;ind < dnsresponse.answers.length; ind++) {
        if (dnsresponse.answers[ind].type == "A") {
          return dnsresponse.answers[ind].address;
        }
      }
    }
    return null;
}

AndroidMeasurementEngine.doNetworkInfo("network-info");
var dnsservers = ["local", "8.8.8.8", "208.67.222.222"];
var hosts = ["www.google.com", "www.youtube.com", "www.facebook.com",
"m.yelp.com", "www.yahoo.com", "www.answers.com", "www.buzzfeed.com",
"www.upworthy.com"];

for (var j=0; j < dnsservers.length; j++) {

    var server = dnsservers[j];
    if (dnsservers[j] == "local") {
      server = "";
    }

    for (var i=0; i < hosts.length; i++) {
      var ret = AndroidMeasurementEngine.doJsDns(hosts[i], server);
      var ret2 = AndroidMeasurementEngine.doJsDns(hosts[i], server);
      var dns_resp = JSON.parse(ret);
      var dns_resp2 = JSON.parse(ret2);
      store("dns-" + dnsservers[j] + "-" + hosts[i], dns_resp);
      store("dns2-" + dnsservers[j] + "-" + hosts[i], dns_resp2);

      var dest_ip = get_a_record_ip(dns_resp);

      if (dest_ip != null) {
        AndroidMeasurementEngine.doPing("ping-"+hosts[i]+"-"+dest_ip, dest_ip);
        AndroidMeasurementEngine.doTraceroute("tr-"+hosts[i]+"-"+dest_ip, dest_ip);
      }
      else {
        AndroidMeasurementEngine.log("No answers found for dns query to: " + hosts[i]);
      }
    }
}
var ana_string = AndroidMeasurementEngine.getDeviceId() + ".ana-aqualab.cs.northwestern.edu";
var ana_ret = AndroidMeasurementEngine.doJsDns(ana_string, "");
var ana_resp = JSON.parse(ana_ret);

store("ana", ana_resp);

var google_ana_ret = AndroidMeasurementEngine.doJsDns(ana_string, "8.8.8.8");
var google_ana_resp = JSON.parse(google_ana_ret);

store("ana-google", google_ana_resp);
var opendns_ana_ret = AndroidMeasurementEngine.doJsDns(ana_string, "208.67.222.222");
var opendns_ana_resp = JSON.parse(opendns_ana_ret);

store("ana-opendns", opendns_ana_resp);

var resolver_ip = get_a_record_ip(ana_resp);
var server_ip = ana_resp.server;

if (resolver_ip != null) {
    AndroidMeasurementEngine.doPing("ping-local_resolver-"+resolver_ip, resolver_ip);
    AndroidMeasurementEngine.doTraceroute("tr-local_resolver-"+resolver_ip, resolver_ip);
}
if (server_ip != null) {
    AndroidMeasurementEngine.doPing("ping-ldns-"+server_ip, server_ip);
    AndroidMeasurementEngine.doTraceroute("tr-ldns-"+server_ip, server_ip);
    }

var google_ip = get_a_record_ip(google_ana_resp);
if (google_ip != null) {
    AndroidMeasurementEngine.doPing("ping-google_resolver-"+google_ip, google_ip);
    AndroidMeasurementEngine.doTraceroute("tr-google_resolver-"+google_ip, google_ip);
}
var opendns_ip = get_a_record_ip(opendns_ana_resp);
if (opendns_ip != null) {
    AndroidMeasurementEngine.doPing("ping-opendns_resolver-"+opendns_ip, opendns_ip);
    AndroidMeasurementEngine.doTraceroute("tr-opendns_resolver-"+opendns_ip, opendns_ip);
}

AndroidMeasurementEngine.finishExperiment();

</script>

This script is uploaded to the Alice server, and converted by the Alice server to a JSON object which is sent out to clients.

Get Alice

Please contact John Rula for information about obtaining the Alice Android library.

People