Armagan Amcalar
Online Webinar
Feb 2nd, 2016
Armagan Amcalar
Head of Software Engineering @ unu GmbH
Founder @ Lonca Works
dashersw
We love it.
We develop all kinds of software with it.
Programming model encourages stateful app design.
We love to daemonize it, all apps are running as daemons.
It doesn't scale well as a monolith.
Works great as single process.
Works OK as a cluster.
What if you need more computing power?
How about horizontal scalability?
Because we have more problems
We're not just building express apps
Where's the flexibility and agility in that?
Be fast with your API response
Asynchronous processing (e.g., analytics)
You may need to scale very dynamically
High availability (fault tolerance)
WHERE ARE MODULAR, COMPOSABLE DESIGN AND EVENTS?
Separate code base
Multi processes for each service
A bug in a service crashes only that service
Consumes minimal resources
Scales well, needs minimal additional resources
Supports event-driven architecture
Request–response flow breakdown
Hard to manage
Communication between services
Transactional processes
Dynamic service configuration
Service registry & discovery
Health checks & monitoring
Use as service discovery
Update config on any change in services
Load balance between services
Needs a service registry! Consul can help!
Demo based on the technique presented here by Dr. Graham Jenson
node.js framework for building;
zero-configuration,
scalable,
fault-tolerant,
distributed applications
auto-discovery
mesh network, peer-to-peer communication
pubsub pattern
requester/responder pattern
client-side communication with websockets
load balancing with different strategies
daemon monitor
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);
});
With cote.js we can;
Apply sophisticated programming paradigms
Scale nearly infinitely
Have fault-tolerant systems
Armagan Amcalar
armagan@amcalar.com
twitter: @dashersw
github: dashersw
blog: arm.ag
get these slides at:
https://slides.com/armaganamcalar/node-webinar
e-commerce app case study:
https://github.com/dashersw/cote-workshop