28
Building Highly Scalable Applications With Bluemix By: Ryan Baxter @ryanjbaxter 08/19/2014

Building Highly Scalable Apps On Bluemix

Embed Size (px)

DESCRIPTION

Horizontal scalability cannot be an afterthought, it must be part of your design and implementation. This deck contains patterns you can use while building your application to make sure your application will scale flawlessly in the cloud.

Citation preview

Page 1: Building Highly Scalable Apps On Bluemix

Building Highly Scalable Applications With Bluemix

By: Ryan Baxter@ryanjbaxter08/19/2014

Page 2: Building Highly Scalable Apps On Bluemix

What is Bluemix?

2

Bluemix is a cloud-based platform for building, managing, and running applications of all types.

Page 3: Building Highly Scalable Apps On Bluemix

What does it mean to be scalable?

Applications are considered scalable when additional instances can be added to accommodate a growing workload.

3

Page 4: Building Highly Scalable Apps On Bluemix

By Scaling We Are Trying To Avoid This

4

Page 5: Building Highly Scalable Apps On Bluemix

How Did We Solve This Problem Before?

5

Page 6: Building Highly Scalable Apps On Bluemix

Scaling Horizontally Is Cheaper

6

Page 7: Building Highly Scalable Apps On Bluemix

We End Up With Something Like This

7

Load Balancer

Page 8: Building Highly Scalable Apps On Bluemix

Scalability cannot be an after-thought.

8

Page 9: Building Highly Scalable Apps On Bluemix

Lessen The Load Load is the reason for scaling We can lessen the load by diverting requests

elsewhere Use a content-delivery-network (CDN) for static

resources Libraries like JQuery, Bootstrap, etc can be delivered to

clients more efficiently via a CDN while at the same time lessening the work of your app server

You can even put custom libraries on a CDN if it makes sense

Make everything you can cacheable!!!

9

Page 10: Building Highly Scalable Apps On Bluemix

Does this application scale?

10

Client Side Code

App

REST APIs

Search Twitter Streams

DBaaS

Page 11: Building Highly Scalable Apps On Bluemix

Is this really better?

1111

My App 1

DBaaS

Client Side Code

App

REST APIs

Search

Twitter Streams

Load Balancer

My App 1Client Side Code

App N

REST APIs

Search

Twitter Streams

Page 12: Building Highly Scalable Apps On Bluemix

Smaller Is Better

12

Client Side Code

App

REST APIs

Twitter App

Twitter StreamsSearch App

Search

DBaaS

Page 13: Building Highly Scalable Apps On Bluemix

Scaling The Web App

13

Twitter App

Twitter Streams

Client Side Code

App N

REST APIs

Client Side Code

App

REST APIs

Load Balancer

Search App

Search

DBaaS

Page 14: Building Highly Scalable Apps On Bluemix

Pub/Sub To Distribute Data

14

Twitter App

Twitter Streams

Pub/Sub

Client Side Code

App N

REST APIs

Client Side Code

App

REST APIs

Load Balancer

DBaaS

Search Not Shown For Simplicity

Page 15: Building Highly Scalable Apps On Bluemix

What About Search?

15

Client Side Code

App N

REST APIs

Client Side Code

App

REST APIs

Search App

Search

Load Balancer

DBaaS

Twitter Not Shown For Simplicity

Page 16: Building Highly Scalable Apps On Bluemix

Does This Make It Better?

16

Search App

Search

Client Side Code

App N

REST APIs

Client Side Code

App

REST APIs

Search App N

Search

Load Balancer

Load Balancer

DBaaS

Twitter Not Shown For Simplicity

Page 17: Building Highly Scalable Apps On Bluemix

Lets Use A Queue

17

Search Worker

Search

Client Side Code

App N

REST APIs

Client Side Code

App

REST APIs

Search Worker N

Search

Load Balancer

Search Queue

DBaaS

Twitter Not Shown For Simplicity

Page 18: Building Highly Scalable Apps On Bluemix

What About The Database? Our application scales nicely, we have small

modular components that focus on specific tasks

However in some cases we can only respond as fast as our database operations perform We can have all the worker threads we want to handle

search but if the DB is busy they can’t do much.

18

Page 19: Building Highly Scalable Apps On Bluemix

Use A Caching Service

19

Search Worker

Search

DBaaSClient Side Code

App N

REST APIs

Client Side Code

App

REST APIs

Search Worker NSearch

Search Queue

Data Cache

Twitter App

Twitter Streams

Pub/Sub

Load Balancer

Page 20: Building Highly Scalable Apps On Bluemix

Caching Services

20

Message Queue Services

Pub/Sub Services

Page 21: Building Highly Scalable Apps On Bluemix

Storing State Within The Application

21

Chat App

Hi There

Hi Ryan

Page 22: Building Highly Scalable Apps On Bluemix

Inconsistent State When Scaled

22

Chat App

Hi There

Chat App N

Hi Ryan

Load Balancer

Page 23: Building Highly Scalable Apps On Bluemix

Store State In A Common Store

23

Chat App

My Chat App N

Load Balancer

Hi There

Hi Ryan

Data Store

Chat App N

Page 24: Building Highly Scalable Apps On Bluemix

Auto-Scaling You can manually scale applications using the

command line or the Bluemix UI Use the auto-scaling service to avoid having to

scale manually…it’s FREE!!! Works with Java Liberty, Node.js, and Ruby runtimes

Java – scale based on CPU, JVM Heap, Memory

Node.js – scale based on CPU and Memory

Ruby – scale based on Memory

24

Page 25: Building Highly Scalable Apps On Bluemix

DEMO

25

Page 26: Building Highly Scalable Apps On Bluemix

Additional Resources http://12factor.net/ - Great rules to follow for

building scalable cloud applications http://www.amazon.co.uk/Building-Scalable-Web

-Sites-Henderson/dp/0596102356 - Book on building scalable websites

http://www.ibm.com/developerworks/cloud/library/cl-bluemix-node-redis-app/index.html - dW article on BlueChatter App

http://developer.ibm.com/bluemix - All things Bluemix

26

Page 28: Building Highly Scalable Apps On Bluemix

Thank you.Get Started: www.bluemix.net

@IBMBluemix

https://www.facebook.com/ibmbluemix