e0-245: asp - ernetdipanjan/e0_245/e0245-asp-lecture20.pdf · e0-245: asp lecture 20: cloud stack...

29
E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend Dipanjan Gope

Upload: vuongtuong

Post on 05-Apr-2018

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

E0-245: ASP

Lecture 20: Cloud Stack for Mobile Backend

Dipanjan Gope

Page 2: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

2

Dipanjan Gope

• Amazon Web Services (AWS) components: EC2, S3

• Cloud stack

Module 3: Hybrid Mobile-Cloud Framework

Page 3: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

3

Dipanjan Gope

Activity

Views

Intent

ContentProvider

BroadcastReceiver

Service

Coverage

Page 4: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

4

Dipanjan Gope

• Greg Milette, Adam Stroud: Professional Android Sensor Programing, 2012, Wiley India

• Reto Meier: Professional Android 4 application development. John Wiley & Sons, 2012.

References

Page 5: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

5

Broadcast Receiver

• Listens to sendBroadcast(intent)

• Must be registered in code or manifest file

• Intent Filter specifies the type of broadcasts received

• Applications DO NOT need to be active to receive intent

Page 6: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

6

Broadcast Receiver

SEND

RECEIVE

OnReceive handler has 5 seconds to complete

Ref: [2]

Page 7: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

7

Broadcast Receiver

http://swapand.blogspot.in/2013/10/android-broadcastreceiver-tutorial_22.html

Page 8: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

8

Registering Broadcast Receiver

Manifest File:

Ref: [2]

In Code:

Page 9: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

9

Native Broadcast Intents

Ref: [2]

Page 10: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

10

Broadcast Receiver Demo

INSIDE APP ACROSS APPS

Page 11: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

11

Dipanjan Gope

Application Lifecycle

System Process

Home

Mail

Browser

Home

Mail List Message

Browser

Home Mail Mail Browser Maps

https://www.youtube.com/watch?v=ITfRuRkf2TM Androidology Part 2of 3

Page 12: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

12

Android Lifecycle

http://developer.android.com/training/basics/activity-lifecycle/pausing.html

Page 13: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

13

Saving States

• Shared Preferences • Saved Application UI State • Files

Page 14: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

14

Saving State: Demo

Page 15: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

15

Cloud Stack / Web Stack

• Collection of software required for web dev - OS - Programing language - Database - Web-server - ….. e.g. LAMP (Linux, Apache, MySQL, PHP)

Page 16: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

16

Cloud Resources (e.g. AWS)

Page 17: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

17

Cloud Resources (AWS)

• EC2 – Elastic Cloud Compute

• S3 – Simple Storage Service

• Elastic IP

Page 18: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

18

Cloud Resources: EC2

Compute Optimized

Memory Optimized

Page 19: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

19

Web-stack Components

• OS/Hosting

• Load Balancing

• Reverse proxy / proxy cache

• Application/Web Servers

• Data storage

• Task Queue

• Monitoring

Page 20: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

20

Web-stack Components

Page 21: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

21

Web Server

• HTTP server

• FTP server

• Database server

• Email server

e.g. Apache, nginx, IIS

Page 22: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

22

Load Balancer

• Optimize resource use

• Maximize throughput

• Minimize response time

e.g. HAProxy, nginx, AWS ELB

Page 23: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

23

Reverse Proxy

• Proxy on behalf of server

• Single point of access and control

e.g. nginx, perlbal, Apache, squid, pound

Page 24: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

24

Reverse Proxy Cache

• Web Cache Types: Browser, Proxy, Reverse proxy caches

• Server acceleration

e.g. nginx, varnish

Page 25: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

25

Database

• Relational DBMS: SQL (vertical scaling)

• noSQL Databases: mongoDB (horizontal scaling)

http://blogs.the451group.com/information_management/2011/04/15/nosql-newsql-and-beyond/

Page 26: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

26

In-memory Cache

• RAM access is order of magnitude faster than disk

e.g. memcached, Redis

http://lethain.com/introduction-to-architecting-systems-for-scale/#application_versus_database_caching

Page 27: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

27

Web-stack Components

Page 28: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

28

Dates

• Final Exam: 30th April 10-1pm

- venue to be announced on web-forum

• Final Project submission: ?

- 15 min demo

- Peer review

• Attendance record: ?

Page 29: E0-245: ASP - ERNETdipanjan/E0_245/E0245-ASP-Lecture20.pdf · E0-245: ASP Lecture 20: Cloud Stack for Mobile Backend ...  . 8 Registering Broadcast

29

Grades

Time Frame Assignment Grading

Mar 1 Midterm 20

Apr 30 Final Exam 30

Apr ? Final Project 40

Class Participation 10