sf1 tour - scaling heroku app

20
Creating Scalable Customer facing apps on Heroku Vincent Spehner, Heroku Practice Manager, @vzmind Slideshare: http://www.slideshare.net/VincentSpehner

Upload: vincent-spehner

Post on 15-Jan-2015

125 views

Category:

Technology


0 download

DESCRIPTION

Heroku mades App scaling a breeze. Learn during that session the theory basis of applications scaling and understand how this is made possible on Heroku. Discover best practices to make your application even more performant and more scalable.

TRANSCRIPT

Page 1: SF1 Tour - Scaling heroku app

Creating Scalable Customer facing apps on HerokuVincent Spehner, Heroku Practice Manager, @vzmind

Slideshare: http://www.slideshare.net/VincentSpehner

Page 2: SF1 Tour - Scaling heroku app

“I cannot teach anybody anything. I can only make them think” Socrates

Page 3: SF1 Tour - Scaling heroku app

From theory to action

Understanding scalability

Why is Heroku Scalable?

First Make your app scalable

Horizontal scaling

Vertical scaling

Scaling Strategy

Automated scaling

Page 4: SF1 Tour - Scaling heroku app

Understanding scalability

Vertical vs Horizontal Scale up (vertical)

Scale out (horizontal)

Page 5: SF1 Tour - Scaling heroku app

New Relic

Librato

Understanding scalability

Monitor your key metrics:

Throughput: Number of request per second

Latency: Time to respond to a request (ms)

70% utilization per dyno

Page 6: SF1 Tour - Scaling heroku app

Why is Heroku scalable?

The 12 factors have defined Heroku architecture.

Process (stateless and share nothing)– data must be persisted

– session are stored in shared Mem.

Assets should be externalized

Logs (stream of aggregated info)

12factor.net

Page 7: SF1 Tour - Scaling heroku app

Why is Heroku scalable?

Understanding the slug– Compiled version of your current

code (Stack, dependencies, assets … )

Scaling up and down with CLI

Current Slug

New Dyno New Dyno

Page 8: SF1 Tour - Scaling heroku app

Enough theory, let’s SCALE !

Page 9: SF1 Tour - Scaling heroku app

“Dont try to scale a bloated or memory leaking app, it won’t save kitties” - Me

Page 10: SF1 Tour - Scaling heroku app

First, make your app scalable

Request queuing (understand your framework)

Use Unicorn, Gunicorn, Node.js multiple threads/process per Dyno

improve concurrency per dyno.

Page 11: SF1 Tour - Scaling heroku app

First, make your app scalable

DB indexes

DB Connections :– Make sure you dont overload the DB Plan,

– limit your connection with a reasonable buffer (Bad connections)

Page 12: SF1 Tour - Scaling heroku app

First, make your app scalable

API Caching

Group SFDC Calls with Custom Apex End Points

Don’t use Cache or API, use Heroku Connect

Externalize Assets, Use CDN

Stay close to your customers (regions)

Page 13: SF1 Tour - Scaling heroku app

Horizontal scaling

Expanding your number of concurrent Dynos/Workers

Heroku ps:scale web=5

heroku ps:scale worker=2

heroku ps:scale api=3

Decoupled applicationsAPI

FrontEnd

EmailerScheduler

Read: https://blog.heroku.com/archives/2013/12/3/end_monolithic_app

Page 14: SF1 Tour - Scaling heroku app

Vertical scaling

Available options:

Page 15: SF1 Tour - Scaling heroku app

Scaling Strategy

Scale out, then up, then out again

Page 16: SF1 Tour - Scaling heroku app

Auto-scaling

Define the metric

Define the response

Use Heroku API

Potential approaches:– Checking number of queued jobs and scale worker

– Check memory/load usage with Log stream, log-runtime-metrics

– Check page response time with Pingdom

https://github.com/Swop/heroku-autoscale

Page 17: SF1 Tour - Scaling heroku app

Auto-scaling solutions

https://addons.heroku.com/adept-scale

https://manager.hirefire.io

Page 18: SF1 Tour - Scaling heroku app

Heroku Connect

Why mentioning Heroku Connect ?

Remove lot of the burden of dealing with an API

Reduce latency of API calls

Optimize the API calls (Bulk, REST)

Bi-directional synch

Page 19: SF1 Tour - Scaling heroku app

To summarize:

Define your performance metricsScale your app first Use Heroku to easily scale

Page 20: SF1 Tour - Scaling heroku app

Thank you !

Slideshare: http://www.slideshare.net/VincentSpehner