building scalable micro-services with nodejs

36

Upload: hotelquickly-ltd

Post on 08-Aug-2015

472 views

Category:

Technology


2 download

TRANSCRIPT

Node.js

Scalable Micro-Services

Server side javascript

Makes it great for IO bound tasks

Single threaded

Event driven

Best for asynchronous things

What do you think when you hear ‘scalable’?

What do I think when I hear ‘scalable’?

Will this code scale with your employees?

What is a Micro-Service?

Separate monolithic functionality into smaller parts.

MY AWESOME MONOLITH

git

git git gitgit

svn? git git

Design Pattern

Then distribute those parts in an individually scalable fashion,

behind an API Facade.

service

API Facade

service serviceservice service serviceservice

Room Available

?

Monolithic API

Payment

3rd party

3rd party

Translation

3rd party

Client request Server response

Room Available?

API Facade

Payment Translation

3rd party

3rd party

3rd party

Client request Server response

With a powerful pattern comes great responsibility

Not everything can / should be microtized

Lower level design problems will be multiplied

across codebases

What is the secret sauce?

The Pyramid Of Doom

How to:

DEAL WITH IT

Named Functions Flatten Dat Code

Async Library Also Flattens Dat Code

No Asynchronous IO?

.then(what the function (do) { we(do)……..

• Pending

• Fulfilled

• Rejected

Basic Promises

Advanced Promising

BONUS SLIDE

Next generation

Scaling your micro services?

Cluster

pm2

Finding the right libraries

Q Bluebird