scaling our app to 100k users. use case: style jukebox cloud player - power by windows azure

50
Ionut Antiu www.get-jukebox.com @johnnyantiu

Upload: ionut-antiu

Post on 14-Jul-2015

189 views

Category:

Data & Analytics


1 download

TRANSCRIPT

Ionut Antiu

www.get-jukebox.com

@johnnyantiu

Style Jukebox is a High Fidelity cloud-music streaming service that helps you keep all your music – be it bought, self-produced,

or imported from CDs or other media, always backed up and synced across all your devices.

FREE PREMIUM

Start with 250 songs free (~1.5 GB)Earn up to 3,000 songs for free (18 GB)

Add storage for 25,000 songs (~120GB – 1 TB)

Hi-Fi Sound Quality

MP3, AAC, WMA, OGG +Lossless (FLAC, M4A- ALAC)

Free, with NO ADS $24.99 / year or $2.99 / month

30 MB limit / song 1GB limit / song

TRACTION

120,000+ registered users

50,000+ MAU

Peak of 12,000 users DAU

4,5+ million songs stored in the Cloud

50,000 – 100,000 songs listened daily

Web PlayerWindows Player

iPhone AndroidWindows Phone

TechnologyWindows App

C#, WPFiPhone App

Objective-CWindows Phone App

C#, SilverlightAndroid App

Java

Cloud Meta Service APIFast, Sync, Gets

8-core just fine with auto scaleAzure, C#, REST Interface, JSON

Block Service APIUpload, Download, Transcoding, etc.

4-core standby with auto scaleAzure, C#, REST, JSON, Streaming

Memcache1 GB

Redis Azure, C#

Database

SQL Azure Premium

Windows Azure Storage30 TB

REST

Import API

800k songs imported

MemcacheWorker

>= 2 instances

Import Worker>= 2 instances

Traffic managerLoad Balancer | CDN

Web PlayerAngularJS

File operations Ex. Index

>= 4 instances

SCALE?!

Because it doesn’t just work!

Growing pains

Scale Up Scale Out

Database, API, Content bandwidth, Website

Scale Up

One operation that cannot be divided requires more compute power

(Audio/Video encoding, Your own DB, etc.)

Basic A11 Core AMD CPU1,75 GB RAMEUR 41/month*

G5, 32 coresIntel Xeon448 GB RAM6 TB EUR 4865/month*

Scale Out

Used for API, Website, etc.

Ex: Each machine can have a limited number of connected users

Basic A11 Core AMD CPU1,75 GB RAMEUR 41/month*

4xBasic A11 Core AMD CPU1,75 GB RAMEUR 41/month*

Load Balancer

Integrated in the Azure Cloud Services

Makes sure all instances have the same loadAuto-Scale creates new instances or removes automatically

TechnologyWindows App

C#, WPFiPhone App

Objective-CWindows Phone App

C#, SilverlightAndroid App

Java

Cloud Meta Service APIFast, Sync, Gets

8-core just fine with auto scaleAzure, C#, REST Interface, JSON

Block Service APIUpload, Download, Transcoding, etc.

4-core standby with auto scaleAzure, C#, REST, JSON, Streaming

Memcache1 GB

Redis Azure, C#

Database

SQL Azure Premium

Windows Azure Storage30 TB

REST

Import API(Dropbox, OneDrive,

Google Drive)

800k songs imported

MemcacheWorker

>= 2 instances

Import Worker>= 2 instances

Traffic managerLoad Balancer | CDN

Web PlayerAngularJS

File operations Ex. Index

>= 4 instances

How to test?

Test 1

1,000 concurrent users1 core machine

Test 2

1,000 concurrent users4 core machine

$ 0,4 more per hour

Autoscale applies to Cloud Services and Websites

1 core machine can handle 200 connections simultaneous

4 core machine can handle 1,000 connections simultaneous

Load balanced. >

Traffic manager

Traffic Manager

stylejukebox.trafficmanager.net

4 VM machinesin West Europe

4 VM machinesin West US

Closest location to the userLoad balancing

Fail-overWorks for Websites, Cloud Services

TechnologyWindows App

C#, WPFiPhone App

Objective-CWindows Phone App

C#, SilverlightAndroid App

Java

Cloud Meta Service APIFast, Sync, Gets

8-core just fine with auto scaleAzure, C#, REST Interface, JSON

Block Service APIUpload, Download, Transcoding, etc.

4-core standby with auto scaleAzure, C#, REST, JSON, Streaming

Memcache1 GB

Redis Azure, C#

Database

SQL Azure Premium

Windows Azure Storage30 TB

REST

Import API(Dropbox, OneDrive,

Google Drive)

800k songs imported

MemcacheWorker

>= 2 instances

Import Worker>= 2 instances

Traffic managerLoad Balancer | CDN

Web PlayerAngularJS

File operations Ex. Index

>= 4 instances

Azure Datacenters

TechnologyWindows App

C#, WPFiPhone App

Objective-CWindows Phone App

C#, SilverlightAndroid App

Java

Cloud Meta Service APIFast, Sync, Gets

8-core just fine with auto scaleAzure, C#, REST Interface, JSON

Block Service APIUpload, Download, Transcoding, etc.

4-core standby with auto scaleAzure, C#, REST, JSON, Streaming

Memcache1 GB

Redis Azure, C#

Database

SQL Azure Premium

Windows Azure Storage30 TB

REST

Import API(Dropbox, OneDrive,

Google Drive)

800k songs imported

MemcacheWorker

>= 2 instances

Import Worker>= 2 instances

Traffic managerLoad Balancer | CDN

Web PlayerAngularJS

File operations Ex. Index

>= 4 instances

Storage

20 Gbps in30 Gbps outLocally, Geo redundant

Optional SSD

-> Scale with CDN

Azure Datacenters

Azure CDN

Multiplies content in the region

Ex: Storage account from Amsterdam are multiplied in CDNs from Amsterdam, London, Frankfurt, Milan, Paris

You have to manage which content is multiplied where.

Cost: EUR 0,06 / GB out CDN compared to EUR 0,015 / GB just stored

SQL Azure vs Microsoft SQL Server

Scale SQL Database

SQL Azure Performance

SQL Azure Performance

Scale Up

I don’t recommend this as a scale strategy

Basic5 DTU30 concurrent requestGood predictability EUR 4 / month

Premium P31,000 DTU SSD, Faster CPUMax 500 GB sizeEUR 2,800 / month

Scale Out

I RECOMMEND this as a scale strategy(Should not be the only one)

The right DB for youP2, 200 DPUEUR 700 / month

RAM in the CloudPre-compiled answersStore JSON, Bytes, etc.

From 250 MB to 53 GB perCache

We use 1 GB – EUR 80 / month

The Memcache Worker predicts and prepares the results

Memcache Hit Ratio 86-91%

Reduced time of response with 80% to an average of 250ms

Monitoring

NewRelic

Always prepare for things to go wrong

Ex: Routers on the Internet

TechnologyWindows App

C#, WPFiPhone App

Objective-CWindows Phone App

C#, SilverlightAndroid App

Java

Cloud Meta Service APIFast, Sync, Gets

8-core just fine with auto scaleAzure, C#, REST Interface, JSON

Block Service APIUpload, Download, Transcoding, etc.

4-core standby with auto scaleAzure, C#, REST, JSON, Streaming

Memcache1 GB

Redis Azure, C#

Database

SQL Azure Premium

Windows Azure Storage30 TB

REST

Import API(Dropbox, OneDrive,

Google Drive)

800k songs imported

MemcacheWorker

>= 2 instances

Import Worker>= 2 instances

Traffic managerLoad Balancer | CDN

Web PlayerAngularJS

File operations Ex. Index

>= 4 instances

Ionut Antiu

www.get-jukebox.com

@johnnyantiu