DISTRIBUTED AND FAULT TOLERANT
MICROSERVICE APPLICATIONS WITH

cote.js
 

 

Armagan Amcalar

Özgür Yazılım ve Linux Günleri 2015, Istanbul
27 March 2015

Who am I?

Armağan Amcalar
Co-founder, Chief Software Architect
Startup Kitchen

hobby projects

pedals.io
trax.io

Monolithic Applications
and

Microservices With Service Oriented Architecture

Monolithic Applications

Single code-base
A single process to rule them all (the whole application)
A bug anywhere can crash the whole system
May consume lots of stale resources
Hard to scale; needs even more stale resources
Request-response flow is one huge piece that can break almost anywhere in-between

 

(Relatively) easy to manage

Microservices

Separate code base for each service
Multi processes for each service
A bug in a service crashes only that service
Consumes minimal resources
Scales well, needs minimal additional resources
Request-response flow breakdown into multiple service calls

 

(Relatively) hard to manage

 

Event Driven Architecture

Publisher-Subscriber pattern

Observer pattern

Publisher-Subscriber Pattern

Just like DOM events, what we're used to build.
Instead of click events, you have custom events (e.g. in jQuery)
Instead of DOM element interaction, you have daemon interaction, acting on certain events

Observer Pattern

First-of-its-kind event driven pattern
You observe an object property, not an arbitrary event
Like all your click handlers have to have the same name
Limits possibilities

cote.js

An open-source framework developed at Startup Kitchen for building distributed and fault-tolerant applications

 

Partially funded by TUBITAK

 

Used in production from day one

cote.js features

auto-discovery
mesh network, peer-to-peer communication
publisher-subscriber pattern
request-response pattern
client-side communication over websockets
load balancing with different strategies
daemon monitor

Example architecture

pub-sub example

var Publisher = require('cote').Publisher,
    publisher = new Publisher({
        name: 'publisher',
        broadcasts: ['update']
    }),
    workId = 0;

publisher.on('ready', function() {
    setInterval(function() {
        console.log('emitting', ++workId);
        publisher.publish('update', workId);
    }, 3000);
});
var Subscriber = require('cote').Subscriber,
    subscriber = new Subscriber({
        name: 'subscriber'
    });

subscriber.on('update', function(message) {
    console.log('update', message);
});

simple demo

 

check it out on github

Workshop subject

E-Commerce application

Frontend

Back office

Reporting

Payment processor

Data interface

get the code at github

Thank you!

Contribute to cote.js

Stay in touch!

Armağan Amcalar

armagan@amcalar.com
twitter: @aamcalar
github: dashersw
blog: arm.ag

Distributed and Fault-Tolerant Microservice Applications with Cote.js

By Armağan Amcalar

Distributed and Fault-Tolerant Microservice Applications with Cote.js

Cote.js is an open-source auto-discovery mesh network framework for building fault-tolerant, highly available and scalable software at no additional cost. Cote.js allows developers to build microservices easily with various communication patterns.

  • 4,307