Hybrid Clouds: EC2/Heroku Calculator

Preview:

DESCRIPTION

Everybody knows heroku, right? Yes, the one that's built entirely on top of EC2. If you do not mind (1) higher price and (2) heroku design rules, then heroku is OK for you. However, there are cases when business migrates back to EC2 after some experience with heroku. This cloudy meeting will discuss a calculator that helps make decisions on heroku < > EC2 migrations.

Citation preview

Cloud Hybrids and

Heroku/EC2 Calculator

Marat Zhanikeev maratishe@gmail.com

maratishe.github.io

2014/11/01

Cloudy@iizuka

.

maratishe.github.io

What is Cloud?

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 2/44...

2/44

.

maratishe.github.io

Textbook Definitions

• SaaS: Software As A Service

• PaaS: Platform As A Service

• IaaS: Infrastructure As A Service

• ...

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 3/44...

3/44

.

maratishe.github.io

Actual Clouds.Cloud is when.........any resouce can be converted into a cloud.

Cloud

• buildings: mostly datacenters (DCs)

• racks, desktops,smarthones: private-publiccloud hybrids

• cities: in frastructurevirtualization

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 4/44...

4/44

.

maratishe.github.io

Actual Cloud Structure

• Tier 1: physical (buildings, DCs, etc.)• Tier 2: cloud platforms (Amazon ECs,etc.)

• Tier 3: cloud applications

• ...question: which one is heroku?

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 5/44...

5/44

.

maratishe.github.io

What is Cloud? Terminology.

Cloud

• cloudization: to convert somethingto a cloud-like usage

• cloudization = virtualization• virtualization = API• API = blackbox

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 6/44...

6/44

.

maratishe.github.io

Cloud = APIs

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 7/44...

7/44

.

maratishe.github.io

Anything Cloud is an API

• starting from physical tier, allfunctionality is exported as APIs

• heroku: mostly unknown... built 100%on top of EC2, which means it isnot Tier 2 but Tier 3

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 8/44...

8/44

.

maratishe.github.io

Some common APIs

• XCP : top 1 popular cloud platform(Xen Cloud Platform)

• EC2 : Elastic Cloud 2 (EC2 = Virtual

Machine = VM)

• S3 : Storage 3 (Amazon Storage

Service)

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 9/44...

9/44

.

maratishe.github.io

git : Source Code Management

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 10/44...

10/44

.

maratishe.github.io

What is Source Version Management?

• source management=version management• a very important concept in software development• very helpful in multi-user/team environments

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 11/44...

11/44

.

maratishe.github.io

git vs **

• CVS : the oldest framework◦ very clumsy, the worst thing that it would create a .cvs folder everywhere in the

source tree

• SVN : relaced CVS, biggest change is web interface◦ got better, but one would still find .svn folder everywhere in the source tree

• GIT : the most popular tool today◦ creates .git folder only at root folder◦ very easy and intuitive commands like push and pull

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 12/44...

12/44

.

maratishe.github.io

git design

• repo=repository : a folder atserver side where the keep your stuff

• you can pull (download) and push(upload) your stuff

• development cycle: pull, edit/update/delete some files, then push

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 13/44...

13/44

.

maratishe.github.io

GitHub:the Most Popular Git Hosting

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 14/44...

14/44

.

maratishe.github.io

GitHub : A small Howto

• First, create a GitHub account (free)◦ to use it over ssh you need to register your public key online

• make a ne wrepository in your account

• work on source code that repo

• you can find commandline references online

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 15/44...

15/44

.

maratishe.github.io

Cloud Hybrids

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 16/44...

16/44

.

maratishe.github.io

What are the Hybrids

• Today one gets 2 or more options, from different tiers, for any technology

• apps: heroku vs EC2 ← today

• storage: S3 vs Heroku Addon vs BigData storage

• Situation 1: select and use a combination of 2 options (hybrid)

• Situation 2: select one of two options for the same technology (migration)

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 17/44...

17/44

.

maratishe.github.io

Specific EC2/Heroku Decision

• decision when making a new new app• heroku > EC2 migration

• EC2 > heroku migration

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 18/44...

18/44

.

maratishe.github.io

EC2/Heroku places in the Tiers

• you should remember which tiers EC2and heroku come from

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 19/44...

19/44

.

maratishe.github.io

EC2 Basics

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 20/44...

20/44

.

maratishe.github.io

AWS Console

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 21/44...

21/44

.

maratishe.github.io

AWS/EC2 Console

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 22/44...

22/44

.

maratishe.github.io

EC2 : New VM

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 23/44...

23/44

.

maratishe.github.io

EC2 : New VM Ready!

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 24/44...

24/44

.

maratishe.github.io

EC2 : Run a Web Server

1. Create a new VM in EC2 (you can create one in free account)

2. install PHP (simple mini server)◦ yum remove httpd-* php-*◦ yum install php54

3. in VM firewall open 8001 port for webrequests

4. on VM : create app1 folder and a simpleindex.php inside

5. php -S VM.IP:8001 -t app16. you can find IP via ifconfig

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 25/44...

25/44

.

maratishe.github.io

EC2 : Run Many Web Servers?

• use several ports (8001-800x?) createa web server (port, folder) on each

• why many servers? it is exactly thesame thing that heroku does on EC2VMs

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 26/44...

26/44

.

maratishe.github.io

Heroku Basics

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 27/44...

27/44

.

maratishe.github.io

Heroku (on top of EC2)

• heroku uses a container to isolate apps from eachother◦ 1 app = 1 container◦ isolation is not perfect

• how many? containers would you expect heroku tojam into 1 VM?

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 28/44...

28/44

.

maratishe.github.io

heroku = git repo

• now you get why we talked git earlier• on heroku, one deploys apps usinggit

• heroku git = sourcemanagement + deployment

• there is a separate heroku commandwhich one can use to manage scale andruntime performance

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 29/44...

29/44

.

maratishe.github.io

heroku vs EC2

• heroku app = web app• when heroku app runs, it is already a webserver

• sourcecode of heroku apps is (mostly) builtaround processing GET/POST requests

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 30/44...

30/44

.

maratishe.github.io

heroku : web and workers.heroku apps .....

.

are made from web and workerprocesses

• web : gets 1 port for receiving webrequests

• worker : has no incoming ports, butcan send traffic

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 31/44...

31/44

.

maratishe.github.io

heroku scale-out.scale out.....

.

... stands for increasingnumber of runninginstances whne necessary • user sets the scale

• heroku dynamically manages the scalebetween 1 and user setting

• in programming, many instances ofthe same app is not a trivialconcept to get used to

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 32/44...

32/44

.

maratishe.github.io

heroku scale-out

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 33/44...

33/44

.

maratishe.github.io

heroku : let's see a simple app

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 34/44...

34/44

.

maratishe.github.io

EC/Heroku Calculator

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 35/44...

35/44

.

maratishe.github.io

EC/Heroku : Formulation

• Situation 1: where to develop newapps

• Situation 2: when to migrateheroku > EC2

• Situation 3: when to migrate EC2> heroku

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 36/44...

36/44

.

maratishe.github.io

Heroku Pricing

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 37/44...

37/44

.

maratishe.github.io

EC2 Pricing

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 38/44...

38/44

.

maratishe.github.io

Several Pricing Considerations

1. pricing : diffs in the tables in two slides above

2. migration : does you app need to migrate instances, data, resouces...?

3. programming: is programming easy, conventional?

4. social (crowds): need to consider social structure of your user base?

5. data management : traditional data or need special structure of processing?

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 39/44...

39/44

.

maratishe.github.io

Metromap of FeaturesAs Cheap

As Possible

MostlyStatic

HeavyProgramming

OK

Few Users

Unusual Data Design

pricing

migration

programming

social (crowds)

data management

CheaperBetter

Price Doesn’t Matter

MigratesOften

Near ZeroProgramming

Volatile User Base(Flash Crowds)

(always)Many Users

Common Data Structures

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 40/44...

40/44

.

maratishe.github.io

Example: Viber

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 41/44...

41/44

.

maratishe.github.io

Viber in the MetromapAs Cheap

As Possible

MostlyStatic

HeavyProgramming

OK

Few Users

Unusual Data Design

pricing

migration

programming

social (crowds)

data management

CheaperBetter

Price Doesn’t Matter

MigratesOften

Near ZeroProgramming

Volatile User Base(Flash Crowds)

(always)Many Users

Common Data Structures

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 42/44...

42/44

.

maratishe.github.io

OK, Let's Discuss

• Imagine yourself a business (startup,small/big business, etc.)

• define your app as a new train line goingthrough available stations in themetromap

• it is best if you can present astraightforward (calculator) map fordecision-making

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 43/44...

43/44

.

maratishe.github.io

That’s all, thank you ...

M.Zhanikeev -- maratishe@gmail.com Hybrid Clouds: EC2/Heroku Calculator -- bit.do/marat141101 44/44...

44/44