1 Mobile Software Development Framework: Mobile-Cloud Service 10/18/2012 Y. Richard Yang.

Slides:



Advertisements
Similar presentations
IM May 24, 2000 Introduction to SIP Jonathan Rosenberg Chief Scientist.
Advertisements

Eduardo Cuervo - Duke Aruna Balasubramanian - U Mass Amherst Dae-ki Cho - UCLA Alec Wolman, Stefan Saroiu, Ranveer Chandra, Paramvir Bahl – Microsoft Research.
Thialfi: A Client Notification Service for Internet-Scale Applications
Staying in Sync with Cloud 2 Device Messaging. About Me Chris Risner Twitter: chrisrisner.
Instructor: Li Erran Li Spring2013/ 4/2/2013: Mobile Cloud Computing 1 Cellular.
Cellular Networks and Mobile Computing COMS , Fall 2012 Instructor: Li Erran Li
ECOS: Leveraging Software-Defined Networks to Support Mobile Application Offloading Aaron Gember, Christopher Dragga, Aditya Akella University of Wisconsin-Madison.
Cellular Networks and Mobile Computing COMS , Spring 2014 Instructor: Li Erran Li
Introduction to push technology © 2009 Research In Motion Limited.
Architectures and Systems for Mobile-Cloud Computing: A Workload-Driven Perspective Prashant Nair Adviser: Moin Qureshi ECE Georgia Tech Xin Zhang Adviser:
Notes to the presenter. I would like to thank Jim Waldo, Jon Bostrom, and Dennis Govoni. They helped me put this presentation together for the field.
Web Caching Schemes1 A Survey of Web Caching Schemes for the Internet Jia Wang.
© 2009 Research In Motion Limited Methods of application development for mobile devices.
Alec Wolman, Stefan Saroiu, Ranveer Chandra, Victor Bahl – Microsoft Research Eduardo Cuervo – Duke Aruna Balasubramanian – U Mass Amherst Dae-ki Cho -
3.5 Interprocess Communication
Managing Agent Platforms with the Simple Network Management Protocol Brian Remick Thesis Defense June 26, 2015.
WhereStore: Location-based Data Storage for Mobile Devices Interacting with the Cloud Patrick Stuedi, Iqbal Mohomed, Doug Terry Microsoft Research.
Data Networking Fundamentals Unit 7 7/2/ Modified by: Brierley.
.NET Mobile Application Development Introduction to Mobile and Distributed Applications.
Timecard: Controlling User-Perceived Delays in Server-Based Mobile Applications Lenin Ravindranath, Jitu Padhye, Ratul Mahajan, Hari Balakrishnan.
ThinkAir: Dynamic Resource Allocation and Parallel Execution in Cloud for Mobile Code Offloading Sokol Kosta, Pan Hui Deutsche Telekom Labs, Berlin, Germany.
Amazon EC2 Quick Start adapted from EC2_GetStarted.html.
1 Mobile Software Development Framework: Mobile-Cloud Services (Push/Track) 10/18/2012 Y. Richard Yang.
Cross Platform Mobile Backend with Mobile Services James
 Energy Results: Memory Assistant Arcade Game  Performance Results:  Response Time ▪ Memory assistant: 17.3 sec -> 1.5 sec ▪ Arcade game: 6 FPS -> 13.
What is Cloud Computing? Cloud computing is the delivery of computing capabilities as a service, making access to IT resources like compute power, networking.
Cloud Computing for the Enterprise November 18th, This work is licensed under a Creative Commons.
MOBILE CLOUD COMPUTING
Cloud MapReduce : a MapReduce Implementation on top of a Cloud Operating System Speaker : 童耀民 MA1G Authors: Huan Liu, Dan Orban Accenture.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
1 Mobile Software Development Framework: Adaptive Mobile Applications 10/23/2012 Y. Richard Yang.
Cloud Computing. What is Cloud Computing? Cloud computing is a model for enabling convenient, on-demand network access to a shared pool of configurable.
Google Cloud Messaging for Android (GCM) is a free service that helps developers send data from servers to their Android.
1 Mobile Software Development Framework: Android 2/28/2011 Y. Richard Yang.
Computer Emergency Notification System (CENS)
WEB PUSH Johannes Brodwall. Outline The low down Is it time? Implementation notes Firefox Chrome Safari Implementation bits.
Advanced Computer Networks Topic 2: Characterization of Distributed Systems.
Timecard: Controlling User-Perceived Delays in Server-Based Mobile Applications Lenin Ravindranath, Jitu Padhye, Ratul Mahajan, Hari Balakrishnan.
POLICY ENGINE Research: Design & Language IRT Lab, Columbia University.
1 Mobile Software Development Framework: Adaptive Mobile Applications 10/23/2012 Y. Richard Yang.
An Architecture to Support Context-Aware Applications
Network Location Awareness Vision And Scenarios Tracey Yao Program Manager Windows Wireless Networking microsoft.com Microsoft Corporation.
Eduardo Cuervo – Duke University Aruna Balasubramanian - University of Massachusetts Amherst Dae-ki Cho - UCLA Alec Wolman, Stefan Saroiu, Ranveer Chandra,
1 Mobile Software Development Framework: Android IPC; Mobile Push Notification 10/16/2012 Y. Richard Yang.
FCM Workflow using GCM.
Chapter 8 – Cloud Computing
3/12/2013Computer Engg, IIT(BHU)1 CLOUD COMPUTING-1.
Web Technologies Lecture 13 Introduction to cloud computing.
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
Function as a Service An Ad Hoc Approach to Cloud Computing By Keith Downie.
Secure Mobile Development with NetIQ Access Manager
Data-Centric Systems Lab. A Virtual Cloud Computing Provider for Mobile Devices Gonzalo Huerta-Canepa presenter 김영진.
Nguyen Thi Thanh Nha HMCL by Roelof Kemp, Nicholas Palmer, Thilo Kielmann, and Henri Bal MOBICASE 2010, LNICST 2012 Cuckoo: A Computation Offloading Framework.
Internet of Things. Creating Our Future Together.
Efficient Opportunistic Sensing using Mobile Collaborative Platform MOSDEN.
A method for using cloud computing for Android By: Collin Molnar.
Amazon Web Services. Amazon Web Services (AWS) - robust, scalable and affordable infrastructure for cloud computing. This session is about:
Introduction to Mobile-Cloud Computing. What is Mobile Cloud Computing? an infrastructure where both the data storage and processing happen outside of.
CS434/534: Topics in Networked (Networking) Systems Mobile Networking System: Making Connections: Cloud; NFC Yang (Richard) Yang Computer Science Department.
Prof. Jong-Moon Chung’s Lecture Notes at Yonsei University
Randy Dalrymple HillyRoad, LLC
Android Application -Architecture.
Implementing Remote Procedure Call
TrueSight Operations Management 11.0 Architecture
Notification Sisoft Technologies Pvt Ltd
Tracking and Booking Taxi
Chapter 18 MobileApp Design
Remote Procedure Call Landon Cox February 7, 2018.
Technical Capabilities
Presentation transcript:

1 Mobile Software Development Framework: Mobile-Cloud Service 10/18/2012 Y. Richard Yang

2 Outline r Admin r Mobile cloud service m Push notification service m Storage service m Track service m Split service

3 Admin. r HW3 posted

Recap: Accessing Data in Cloud r A typical design pattern is that a device updates/receives data in the cloud m Cloud as a rendezvous point r Challenge: How do you keep data on a device fresh? 4

Recap: Solution Space r Mobile poll r Cloud push r Each app push r Shared (infrastructure) push 5

Shared Push Service r A single persistent connection from device to a cloud push service provider r Multiple application providers push to the service provider r Service provider pushes to a device using the persistent connection r Two examples m Apple Push Notification Service (APNS) m Google Cloud Messaging (GCM) 6

Design Requirements of a Shared Push Service r Security/Authorization m Do not allow arbitrary app to push to a device r Scalability m A large scale system may have millions of clients r Fault tolerance m Client/device, push servers all can fail r Generality m Can be used by diverse applications 7

Design Point: Authorization 8 AppApp Device Registration(DEV_ID, App_ID) Design 2: App query registered devices; Multicast Design 3: Device notifies registration ID to its server; Design 1: App does not know registered devices. Broadcast to all.

Design Point: What to Push? r Option 1: Just push signal (data available) to devices and then devices fetch from app servers r Option 2: push app data 9 AppApp Device

Design Point: Reliability (What Can Go Wrong) 10 AppApp Device RegID=Registration(DEV_ID, App_ID) App sends to regIDs Device notifies regID to its server;

Soft State Design r State at the third party is soft state if the the entity who sets up the state does not refresh it, the state will be pruned at the 3 rd party 11

Apple Push Notification Service 12 r iOS device maintains a persistent TCP connection to an Apple Push Notification Server(APNS) A push notification from a provider to a client application Multi-providers to multiple devices

APNS Authorization: Device Token 13 r Device token Contains information that enables APNs to locate the device m Client app needs to provide the token to its app provider m Device token should be requested and passed to providers every time your application launches

Apple Push Notification Data r Each push notification carries a payload m 256 bytes maximum m Best effort delivery r App provider provides a JSON dictionary object, which contains another dictionary identified by the key aps r aps specifies the following actions An alert message to display to the user A number to badge the application icon with A sound to play 14

APNS Example: Client (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 2. { 3. // Let the device know we want to receive push notifications 4. [[UIApplication sharedApplication] registerForRemoteNotificationTypes: 5. (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; return YES; 8. } 9. - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo 10. {//userInfo contains the notification 11. notification: userInfo); 12. } (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken 14. { 15. token is: deviceToken); 16. }

APNS Example: Server $devicetoken ='f05571e4be60a4e11524d76e f430522fb470c46fc6810fffb07af7’; 2. // Put your private key's passphrase here: 3. $passphrase = 'PushChat'; 4. // Put your alert message here: 5. $message = ’CS434: my first push notification!'; 1. $ctx = stream_context_create(); 2. Stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem'); 3. stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase); 4. // Open a connection to the APNS server 5. $fp = stream_socket_client( 6. 'ssl://gateway.sandbox.push.apple.com:2195', $err, 7. $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); 8. if (!$fp) 9. exit("Failed to connect: $err $errstr". PHP_EOL); 10. echo 'Connected to APNS'. PHP_EOL;

APNS Example: Server (cont’) // Create the payload body 17. $body['aps'] = array( 18. 'alert' => $message, 19. 'sound' => 'default' 20. ); 21. // Encode the payload as JSON 22. $payload = json_encode($body); 23. // Build the binary notification 24. $msg = chr(0). pack('n', 32). pack('H*', $deviceToken). pack('n', strlen($payload)). $payload; 25. // Send it to the server 26. $result = fwrite($fp, $msg, strlen($msg)); 27. if (!$result) 28. echo 'Message not delivered'. PHP_EOL; 29. else 30. echo 'Message successfully delivered'. PHP_EOL; 31. // Close the connection to the server 32. fclose($fp);

Google Cloud Messaging r Very similar to APNS 18 GCM Servers See for detailed steps

GCM Flow: App Developer Registration r App developer registers a project at Google r Open API console: r After Create project 19 Project ID; Sender ID

GCM Flow: Device App Registration r Enable cloud to device messaging in your app m Add permissions in Manifest m App (on device) registers with Google to get registration ID 20 public class MyActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GCMRegistrar.checkDevice(this); GCMRegistrar.checkManifest(this); final String regId = GCMRegistrar.getRegistrationId(this); if (regId.equals("")) { GCMRegistrar.register(this, SENDER_ID); } else { Log.v(TAG, "Already registered"); } … }

Device App Handle Events 21  The GCMBroadcastReceiver (defined in GCM library) handles the broadcast messages, and calls methods defined in.GCMIntentService, if you define this service

GCMIntentService 22 // called after GCM library finishes registration // you need to send regId to your server onRegistered(Context context, String regId); onUnregistered(Context context, String regId); // called after your server sends a msg to GCM, and // GCM sends to this device onMessage(Context context, Intent intent); onError(Context context, String errorId); onRecoverableError(Context context, String errorId)

App Server r If you use GCM server library 23 import com.google.android.gcm.server.*; Sender sender = new Sender(myApiKey); Message message = new Message.Builder().build(); MulticastResult result = sender.send(message, devices, 5);

Summary: GCM Flow r Enabling cloud to device messaging m App (on device) registers with Google to get registration ID m App sends registration ID to its App Server r Per message m App Server sends (authenticated) message to Google m Google sends message to device, which sends to app r Disabling cloud to device messaging m App can unregister ID, e.g., when user no longer wants push 24

Additional Details r See Thialfi: A Client Notification Service for Internet-Scale Applications, by Atul Adya, Gregory Cooper, Daniel Myers, Michael Piatek, ACM SOSP

Discussion: Mobile Cloud Services r We have discussed push notification service. What other services can you think of? 26

Example Mobile Cloud Services r Push notification service r Storage and sync m Syncing and storage service (iCloud) r Location based service m Track service (supporting location based services) r Proxy service (Kindle Split Browser) r Recognition services m Speech to text/text to speech service m Natural language processing service (open Siri API for 3 rd party applications in the future) 27

Apple iCloud r Store content in cloud and sync to all registered devices m Hosted by Windows Azure and m Amazon AWS r iCloud Storage APIs support third-party app document syncing 28

29 Outline r Admin r Mobile cloud service m Push notification service m Track service StarTrack Next Generation: A Scalable Infrastructure for Track-Based Applications, by Maya Haridasan, Iqbal Mohomed, Doug Terry, Chandramohan A. Thekkath, and Li Zhang, in OSDI 2010.

Location-Based Applications r Many phones already have the ability to determine their own location m GPS, cell tower triangulation, or proximity to WiFi hotspots r Many mobile applications use location information Courtesy: Maya et al.

A Common Abstraction: Track Time-ordered sequence of location readings Latitude: Longitude: Time: 07/08/10 08:46: Latitude: Longitude: Time: 07/08/10 08:46:45.125

Application: Personalized Driving Directions Goal: Find directions to new gym 32 Courtesy: Maya et al.

A Taxonomy of Applications Class of applications enabled by StarTrack 33

StarTrack System ST Client Insertion Application Location Manager Retrieval Manipulation Comparison … Application ST Client Insertion ST Server 34

System Challenges 1. Handling error-prone tracks 2. Flexible programming interface 3. Efficient implementation of operations on tracks 4. Scalability and fault tolerance 35

Challenges of Using Raw Tracks Advantages of Canonicalization: m More efficient retrieval and comparison operations m Enables StarTrack to maintain a list of non-duplicate tracks 36

StarTrack API: Track Collections  TC JoinTrackCollections (TC tCs[], bool removeDuplicates)  TC SortTracks (TC tC, SortAttribute attr)  TC TakeTracks(TC tC, int count)  TC GetSimilarTracks (TC tC, Track refTrack, float simThreshold)  TC GetPassByTracks (TC tC, Area[] areas)  TC GetCommonSegments(TC tC, float freqThreshold) Manipulation Creation  TC MakeCollection(GroupCriteria criteria, bool removeDuplicates) 37

API Usage: Ride-Sharing Application // get user’s most popular track in the morning TC myTC = MakeCollection(“name = Maya”, [ ], true); TC myPopTC = SortTracks(myTC, FREQ); Track track = GetTracks(myPopTC, 0, 1); // find tracks of all fellow employees TC msTC = MakeCollection(“name.Employer = MS”, [ ], true); // pick tracks from the community most similar to user’s popular track TC similarTC = GetSimilarTracks(msTC, track, 0.8); Track[] similarTracks = GetTracks(similarTC, 0, 20); // Verify if each track is frequently traveled by its respective owner User[] result = FindOwnersOfFrequentTracks(similarTracks);

Track Similarity S1-4 S5 S6-7 Tracks A, B s1 s2 s3 s4 s5 Track D s8 s9 Track C s6 s7

Summary r The Track abstraction is simple but quite interesting r Think about abstractions in your project 40

Amazon Silk Split-Browser r Accelerates web access m Learns user behavior and precache m Intelligently partion work between local and Amazon cloud 41

Example Benefit of Cloud (RTT -> Server) 42

Generalization: mCloud r Basic questions m What architecture best supports mcloud? What resources at where m What programming model best support mcloud? 43

Example: MAUI 44 Maui server Smartphone Application Client Proxy Profiler Solver Maui Runtime Server Proxy Profiler Solver Maui Runtime Application RPC Maui Controller

How Does a Programmer Use MAUI? r Goal: make it dead-simple to MAUI-ify apps m Build app as a standalone phone app m Add.NET attributes to indicate “remoteable” m Follow a simple set of rules

Maui server Smartphone Application Client Proxy Profiler Solver Maui Runtime Server Proxy Profiler Solver Maui Runtime Application RPC Maui Controller Intercepts Application Calls Synchronizes State Chooses local or remote Handles Errors Provides runtime information

Profiler Callgraph Execution Time State size Network Latency Network Bandwidth Device Profile CPU Cycles Network Power Cost Network Delay Computational Delay Computational Power Cost Computational Delay Annotated Callgraph

B 900 mJ 15ms C 5000 mJ 3000 ms 1000mJ mJ D mJ ms mJ A Computation energy and delay for execution Energy and delay for state transfer A sample callgraph

FindMatch 900 mJ InitializeFace Recognizer 5000 mJ 1000mJ mJ DetectAndExtract Faces mJ mJ User Interface Cheaper to do local

FindMatch 900 mJ InitializeFace Recognizer 5000 mJ 1000mJ mJ DetectAndExtract Faces mJ mJ User Interface Cheaper to do local

FindMatch InitializeFace Recognizer 1000mJ DetectAndExtract Faces User Interface 20900mJ Cheaper to offload

MAUI Implementation r Platform m Windows Mobile 6.5 m.NET Framework 3.5 m HTC Fuze Smartphone m Monsoon power monitor r Applications m Chess m Face Recognition m Arcade Game m Voice-based translator

Questions r How much can MAUI reduce energy consumption? r How much can MAUI improve performance? r Can MAUI Run Resource-Intensive Applications?

Big savings even on 3G An order of magnitude improvement on Wi-Fi Face Recognizer

Improvement of around an order of magnitude Face Recognizer

Up to 40% energy savings on Wi-Fi Solver would decide not to offload Arcade Game

CPU Intensive even on a Core 2 Duo PC Can be run on the phone with MAUI Translator

 Adapt to:  Network Bandwidth/Latency Changes  Variability on method’s computational requirements  Experiment:  Modified off the shelf arcade game application  Physics Modeling (homing missiles)  Evaluated under different latency settings

DoLevel HandleMissiles DoFrame HandleEnemies HandleBonuses 11KB + missiles missiles *Missiles take around 60 bytes each 11KB + missiles Required state is smaller Complexity increases with # of missiles

DoLevel HandleMissiles DoFrame HandleEnemies HandleBonuses *Missiles take around 60 bytes each  Zero Missiles  Low latency (RTT < 10ms) Computation cost is close to zero Offload starting at DoLevel

DoLevel HandleMissiles DoFrame HandleEnemies HandleBonuses *Missiles take around 60 bytes each  5 Missiles  Some latency (RTT = 50ms) Most of the computation cost Very expensive to offload everything Little state to offload Only offload Handle Missiles

Roadmap r Motivation r MAUI system design m MAUI proxy m MAUI profiler m MAUI solver r Evaluation r Conclusion