Applications with Node.js Resistance Is Futile, Resilience Is...

56
Distributed Cloud Native Applications with Node.js Resistance Is Futile, Resilience Is Crucial

Transcript of Applications with Node.js Resistance Is Futile, Resilience Is...

Distributed Cloud Native

Applications with Node.js

Resistance Is Futile, Resilience Is Crucial

Hristo Iliev & Stoyan Rachev

Abacus committers

hello!

2

Distributed Cloud

Native Applications

with Node.js

Resistance Is Futile, Resilience Is

Crucial

1.

Abacus

Architecture 101

COMPUTE STORAGE SERVICES

CF Abacus Billing Engine Invoice

Metering APIs

App Usage

Monetizing Your Applications Using Cloud Foundry Abacus and Billing Engines - Pankaj Kumar, SAP

COMPUTE STORAGE SERVICES

CF Abacus Billing Engine Invoice

Metering APIs

App Usage

Monetizing Your Applications Using Cloud Foundry Abacus and Billing Engines - Pankaj Kumar, SAP

Usage event

Collector

receives and

stores usage

Meter

applies

metering

formulas

Accumulator

accumulates

daily and

monthly usage

Aggregator

aggregates by

org, space,

service etc

Reporting

provides usage

summaries

collector

DB

meter

DB

accumulator

DB

aggregator

DB

Usage

Docs

2.

Network

Pitfalls & recipes

“Fallacies of distributed computing:

� The network is reliable� Latency is zero� Bandwidth is infinite� Topology doesn't change

https://blogs.oracle.com/jag/resource/Fallacies.html

Network Problems

Unreliable network

Insufficient bandwidth / latency

Application availability� Crashes� Updates

Fault Tolerance

Retry� Seriously?! �

Fault Tolerance

Retry� Seriously?! �� Yes: with exponential backoff

Fault Tolerance

Retry� Seriously?! �� Yes: with exponential backoff

Circuit Breakers� Hystrix style

Bandwidth & Latency

Scaling� Cost, discovery, ...

Bandwidth & Latency

Scaling� Cost, discovery, ...

Batching� ↓Connections & latency� ↑Throughput

Bandwidth & Latency

Scaling� Cost, discovery, ...

Batching� ↓Connections & latency� ↑Throughput

Throttling� Limit requests

Availability

Platform� Updates

Application� Restarts� Updates

Replay

Monitoring & Discovery

Monitoring

Monitoring & Discovery

Monitoring

Cell

App 1 App 2

App 3 App 1

App 2

Router

Monitoring & Discovery

Monitoring

Instance access?

Cell

App 3

Router

Monitoring & Discovery

Monitoring

Indexed apps� “collector-0”� Single instance

Monitoring & Discovery

Performance? Security?

Monitoring

Indexed apps� “collector-0”� Single instance

App 1 App 2

Router / LB

Container networking

Direct container-to-container communication

Indexed apps� “collector-0”� Single instance

App-to-App� Via router / LB

Container Networking

MonitoringDiscoveryPerformanceSecurity

3.

Node.js

Functional Programming

Functional Programming� Composition

Node.js

Functional Programming� Composition

Asynchronous control flow� Generators

Node.js

Functional Programming� Composition

Asynchronous control flow� Generators

yieldable(throttle(retry(breaker(batch(request)))))

Node.js

4.

Monitoring

health & metrics

HealthTrafficCircuit stateError percentage

Hystrix Streams

Hystrix

Dashboard

Hystrix + Turbine + Eureka

Turbine

Aggregate data

Hystrix

Data streams

Eureka

Service discovery

Direct communication� Networking release

Eureka client� Code instrumentation

Service Discovery

Mozzle

https://github.com/Bo0mer/mozzle

Mozzle + RIG

Riemann + InfluxDB

Store data

Mozzle

Pull metrics from CF

Grafana

Visualize

CF metrics

in

Grafana

5.

Alerts

on problems

Monitoring & Alerts

Alerts

Monitoring & Alerts� Reactive

Alerts

Monitoring & Alerts� Reactive

Anomaly Detection� Pro-active

Alerts

6.

Deployment

to Cloud Foundry

Applications vs. Processes

12-factor apps� Factor VI: Processes

Abacus: set of processes

CF: single-process apps

Applications vs. Processes

Process support� deployment� management� flexibility

7.

Database

Partitioning & operations

Data Size� Small documents� TB / day

Datasets

One huge dataset� How big?� When do I delete?� Performance?� DevOps?� Costs?

Datasets

One huge dataset� How big?� When do I delete?� Performance?� DevOps?� Costs?

Datasets

Several large datasets� How many?� How big?� Data distribution?� Load-balancing?� DevOps?� More Costs!?

Partitioning

from the start

Benefits� Manageability � Performance� Availability� Load balancing

https://en.wikipedia.org/wiki/Partition_(database)

Partitioning

Keys� App-level� Time-based

Partitioning

Retention� Backup / restore� Delete

Partitioning

thanks!

Any questions?

You can find us [email protected], [email protected]

[email protected], [email protected]

Credits

Special thanks to all the people who made and released these awesome resources for free:� Presentation template by SlidesCarnival� Photographs by Unsplash

SlidesCarnival icons are editable shapes.

This means that you can:● Resize them without losing quality.● Change fill color and opacity.

Isn’t that nice? :)

Examples:

Now you can use any emoji as an icon!And of course it resizes without losing quality and you can change the color.

How? Follow Google instructions https://twitter.com/googledocs/status/730087240156643328

������������������������������������ and many

more...

Extra graphics