SlideShare uma empresa Scribd logo
1 de 48
Baixar para ler offline
Zero to scaleable
in ten minutes
Less than obvious tools & tips for writing software that lasts
Matt Walters
@mateodelnorte
mattwalters5@gmail.com
What do you mean… ‘scaleable’?
As businesses grow, their understanding of
problems they’re solving also grows
Scaleable = easy to understand, maintain, and add to
During that growth, software changes. Good
software is easiest to change, while still getting
things done.
Combining standard, available tools, and repeating
simple, predictable patterns during development will
keep your code understandable, maintainable, and
easily improved.
Our toolkit will be:
• gitslave
• tmuxinator
• rabbitmq
• servicebus
*and some very simple patterns
How do we scale an architecture?
gitslave
Why have a monolith, when you can have a
metarepo?
> man gits
Gitslave Home Page: <http://gitslave.sf.net>
NAME
gits - The git slave repository tool for multi-repository management
SYNOPSIS
gits [-p|--parallel COUNT] [-v|--verbose]+ [--quiet] [--help] [--version] [-n|--no-pager]
[--paginate] [--eval-args] [--exclude SLAVE-REGEXP] [--keep-going] [--no-commit]
[--no-hide] [--no-progress] [--no-master] [--with-ifpresent|--just-ifpresent] SUBCOMMAND
[ARGS]...
OVERVIEW
gits is a program that assists in assembling a meta-project from a number of individual
git repositories which operate (when using gits) as if they were one git repository
instead of many, similar to the way that CVS works by default and svn (v1.5) can be
coerced to work. Some of these individual git repositories may be part of other meta-
projects as well.
gitslave
Why have a monolith, when you can have a
metarepo?
gitslave allows you to have all of your code in one location,
like a monolithic app, while allowing fine grained updates
of each of your solution’s component projects.
one ‘gits pull origin master’ gets all new changes, for all
related projects / repositories, while you can still perform
fine grained operations on any particular repo.
gitslave
Why have a monolith, when you can have a
metarepo?
> ls -la
drwxr-xr-x 18 mateodelnorte staff 612 Jul 14 00:52 .
drwxr-xr-x 77 mateodelnorte staff 2618 Jul 19 23:01 ..
-rw-r--r-- 1 mateodelnorte staff 411 Jul 12 22:22 .eslintrc.js
drwxr-xr-x 12 mateodelnorte staff 408 Jul 20 11:34 .git
-rw-r--r-- 1 mateodelnorte staff 59 Jul 14 00:25 .gitignore
-rw-r--r-- 1 mateodelnorte staff 127 Jul 14 00:26 .gitslave
-rw-r--r-- 1 mateodelnorte staff 2849 Jul 5 15:56 Makefile
drwxr-xr-x 16 mateodelnorte staff 544 Jul 14 01:18 denormalizer
drwxr-xr-x 16 mateodelnorte staff 544 Jul 10 17:51 my-service-one
drwxr-xr-x 18 mateodelnorte staff 612 Jul 14 00:39 my-service-two
drwxr-xr-x 18 mateodelnorte staff 612 Jul 14 00:39 my-site
-rw-r--r-- 1 mateodelnorte staff 1184 Jul 19 23:32
tmuxinator.all.yml
gitslave
Why have a monolith, when you can have a
metarepo?
> cat .gitignore
/denormalizer/
/my-service-one/
/my-service-two/
/my-site/
gitslave
Why have a monolith, when you can have a
metarepo?
> cat .gitslave
"../denormalizer" “denormalizer"
“../my-service-one“ “my-service-one“
"../my-service-two" “my-service-two“
“../my-site" “my-site"
gitslave
brew install gitslave
tmuxinator
Heads up. You need a good view of your
system.
tmuxinator
.yml-based config-driven tmux. that’s it.
name: my-system
root: ./
windows:
- site:
layout: tiled
panes:
- my-site:
- printf ‘033]2;my-site033'
- cd ./my-site
- make run
- services:
layout: tiled
panes:
- my-service-one:
- printf '033]2;my-service-one033'
- cd ./my-service-one
- make run
- my-service-two:
- printf '033]2;my-service-two033'
- cd ./my-service-two
=
tmuxinator
Heads up. You need a good view of your
system.
Panes per process
tmuxinator
Heads up. You need a good view of your
system.
Windows per context, business domain, etc
tmuxinator
gem install tmuxinator
Neat whats next?
We’ve talked about where you’ll house your project, and
the different sub-projects within it.
(hint: one gitslave metarepo and n project repos)
Let’s talk a bit about messaging.
And we’ve talked about how you’ll stare at it while it’s
on your screen.
(hint: tmuxinator)
Why messaging?
Your processes need an interface
Why messaging?
Your processes need an interface
REST
Why messaging?
Your processes need an interface
REST
?What happens when a process dies?
Why messaging?
Your processes need an interface
REST
??
What happens when a process dies?
Why messaging?
Your processes need an interface
Why messaging?
Your processes need an interface
Shared DB
Why messaging?
Your processes need an interface
Shared Spaghetti
Doable, but usually unclear which process ‘owns’ database
structure and data. Can lead to maintenance hell.
Why messaging?
Your processes need an interface
Why messaging?
Your processes need an interface
Queues
Why messaging?
Your processes need an interface
Queues
?
Processes go down with queues…
Why messaging?
Your processes need an interface
Queues
And come right back up with no message loss.
Why messaging?
Your system gets a safety net
Queues
?x5Added benefit:
Planned human
intervention for
errors.
rabbitmq
messaging that just works
• direct send to queue
• fanout / topic routing
• highly available
• highly performant
• used in financial exchanges,
industrial applications and more
• open source
• free
rabbitmq
messaging that just works
brew install rabbitmq
servicebus
super simple messaging in node
• direct send
• pub / sub / fanout / topic -routing
• simple to set up
• highly performant
• used in financial exchanges,
online advertising and more
• open source
• free
• perfect for creating microservices!
servicebus
super simple messaging in node
npm install servicebus —save
servicebus
super simple send+listen messaging in node
// process 1
var bus = require('servicebus').bus();
bus.listen('my.event', function (event) {
console.log(event);
});
// process 2
var bus = require('servicebus').bus();
setInterval(function () {
bus.send('my.event', { my: 'event' });
}, 1000);
servicebus
super simple pub+sub messaging in node
// process 1
var bus = require('servicebus').bus();
bus.subscribe('my.event', function (event) {
console.log(event);
});
// process 2
var bus = require('servicebus').bus();
setInterval(function () {
bus.publish('my.event', { my: 'event' });
}, 1000);
// process 3
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘servicebus').bus();
const create = require(‘./lib/create’);
bus.listen(‘order.create', function (event) {
create(event);
});
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘servicebus’).bus();
const retry = require(‘servicebus-retry’);
bus.use(retry({
store: new retry.RedisStore({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT
})
}));
const create = require(‘./lib/create’);
bus.listen(‘order.create', function (event) {
create(event, (err) => {
if (err) return event.handle.reject();
event.handle.ack();
});
});
(micro)servicebus
some simple patterns get us going
// order-svc refactored bus to ./lib/bus.js
const bus = require(‘servicebus’).bus();
const retry = require(‘servicebus-retry’);
bus.use(retry({
store: new retry.RedisStore({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT
})
}));
module.exports = bus;
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘./bus’);
// moved bus initialization to own module
const create = require(‘./lib/create’);
bus.listen(‘order.create', function (event) {
create(event, (err) => {
if (err) return event.handle.reject();
event.handle.ack();
});
});
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘./bus’);
// moved bus initialization to own module
const create = require(‘./lib/create’);
bus.listen(‘order.create', function (event) {
create(event, (err, order) => {
if (err) return event.handle.reject();
bus.publish(‘order.created’, order, () => {
event.handle.ack();
});
});
});
service publishes to the world when it’s done!
commands tell services
when an actor wants an action
client send commands to instruct a service to do work
commands are sent async, fire and forget
commands are sent directives: order.create
web app order-svc
order.create!
events tell the world
when you’re done
services publish when done performing work
services publish messages to any services that wish to listen
events are sent past-tense: order.created
order-svc fulfillment-svc
order.created!
order.created!
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘./bus’);
// moved bus initialization to own module
const create = require(‘./lib/create’);
bus.listen(‘order.create', function (event) {
create(event, (err, order) => {
if (err) return event.handle.reject();
bus.publish(‘order.created’, order, () => {
event.handle.ack();
});
});
});
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘./bus’);
// moved bus initialization to own module
const cancel = require(‘./lib/cancel’);
const create = require(‘./lib/create’);
bus.listen(‘order.create', function (event) {
create(event, (err, order) => {
if (err) return event.handle.reject();
bus.publish(‘order.created’, order);
bus.publish(‘order.created’, order, () => {
event.handle.ack();
});
});
});
bus.listen(‘order.cancel', function (event) {
cancel(event, (err, order) => {
if (err) return event.handle.reject();
bus.publish(‘order.canceled’, order);
bus.publish(‘order.created’, order, () => {
event.handle.ack();
});
});
code buildup
increases
cognitive load
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘./bus’);
// moved bus initialization to own module
require(‘./lib/handlers/orderCanceled’);
require(‘./lib/handlers/orderCreated’);
// moved handlers to their own modules,
// hiding their complexity from other code
(micro)servicebus
some simple patterns get us going
// order-svc index.js
const bus = require(‘./bus’);
const log = require(‘llog’);
const registerHandler = require(‘servicebus-register-handlers’);
registerHandlers({
bus,
handleError: function handleError (msg, err) {
log.error(`error handling ${msg.type}: ${err}. rejecting message`
+ `w/cid ${msg.cid} and correlationId ${this.correlationId}.`);
log.fatal(err);
msg.handle.reject(() => {
bus.close();
process.exit(1);
});
},
path: ‘./lib/handlers', // handlers are now one listen or subscribe
per file
queuePrefix: 'order-svc',
});
Show the stuff!
quick show and tell
Let’s recap!
‘cause there was a lot!
1. gitslave lets you structure a project like a monolith,
but have the convenience of many repositories
2. tmuxinator gives you a head’s up view of your system,
all running locally
3. messaging provides a durable, convenient interface
between your processes
4. rabbitmq + servicebus enable easy send+listen & pub
+sub messaging patterns between processes
5. processes send commands and publish events
6. simple, expected, structure in your services keeps
cognitive load low, and projects easy to maintain
Thanks!
We’ll cover more on event-driven
architecture, microsvc, CQRS, and
more in a future talk!
Zero to scaleable
in ten minutes
Matt Walters
github & twitter: @mateodelnorte
email: mattwalters5@gmail.com
https://github.com/tmuxinator/tmuxinator
rabbitmq.com
http://gitslave.sourceforge.net/
https://www.npmjs.com/package/servicebus

Mais conteúdo relacionado

Mais procurados

#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
Operational Efficiency Hacks Web20 Expo2009
Operational Efficiency Hacks Web20 Expo2009Operational Efficiency Hacks Web20 Expo2009
Operational Efficiency Hacks Web20 Expo2009John Allspaw
 
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and AnsibleService Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and AnsibleIsaac Christoffersen
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup PerformanceGreg Whalin
 
232 deview2013 oss를활용한분산아키텍처구현
232 deview2013 oss를활용한분산아키텍처구현232 deview2013 oss를활용한분산아키텍처구현
232 deview2013 oss를활용한분산아키텍처구현NAVER D2
 
Backy - VM backup beyond bacula
Backy - VM backup beyond baculaBacky - VM backup beyond bacula
Backy - VM backup beyond baculaChristian Theune
 
Behind the Scenes at LiveJournal: Scaling Storytime
Behind the Scenes at LiveJournal: Scaling StorytimeBehind the Scenes at LiveJournal: Scaling Storytime
Behind the Scenes at LiveJournal: Scaling StorytimeSergeyChernyshev
 
Capacity Planning For LAMP
Capacity Planning For LAMPCapacity Planning For LAMP
Capacity Planning For LAMPJohn Allspaw
 
Rackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & PackerRackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & PackerMarc Cluet
 
vSphere APIs for performance monitoring
vSphere APIs for performance monitoringvSphere APIs for performance monitoring
vSphere APIs for performance monitoringAlan Renouf
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011bobmcwhirter
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxbobmcwhirter
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps beginsJeff Hung
 
Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존동수 장
 
How to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - WebinarHow to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - WebinarCommon Sense
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
Benchmarking top IaaS providers - A practical study
Benchmarking top IaaS providers - A practical studyBenchmarking top IaaS providers - A practical study
Benchmarking top IaaS providers - A practical studyKeerthi Balasundram
 
Benchmarking top IaaS providers - A practical study
Benchmarking top IaaS providers -  A practical studyBenchmarking top IaaS providers -  A practical study
Benchmarking top IaaS providers - A practical studyKeerthi Balasundram
 
How to scale up, out or down in Windows Azure
How to scale up, out or down in Windows AzureHow to scale up, out or down in Windows Azure
How to scale up, out or down in Windows AzureCommon Sense
 

Mais procurados (20)

#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Operational Efficiency Hacks Web20 Expo2009
Operational Efficiency Hacks Web20 Expo2009Operational Efficiency Hacks Web20 Expo2009
Operational Efficiency Hacks Web20 Expo2009
 
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and AnsibleService Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
232 deview2013 oss를활용한분산아키텍처구현
232 deview2013 oss를활용한분산아키텍처구현232 deview2013 oss를활용한분산아키텍처구현
232 deview2013 oss를활용한분산아키텍처구현
 
Backy - VM backup beyond bacula
Backy - VM backup beyond baculaBacky - VM backup beyond bacula
Backy - VM backup beyond bacula
 
Behind the Scenes at LiveJournal: Scaling Storytime
Behind the Scenes at LiveJournal: Scaling StorytimeBehind the Scenes at LiveJournal: Scaling Storytime
Behind the Scenes at LiveJournal: Scaling Storytime
 
Capacity Planning For LAMP
Capacity Planning For LAMPCapacity Planning For LAMP
Capacity Planning For LAMP
 
Rackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & PackerRackspace Hack Night - Vagrant & Packer
Rackspace Hack Night - Vagrant & Packer
 
vSphere APIs for performance monitoring
vSphere APIs for performance monitoringvSphere APIs for performance monitoring
vSphere APIs for performance monitoring
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps begins
 
Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존
 
How to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - WebinarHow to scale up, out or down in Windows Azure - Webinar
How to scale up, out or down in Windows Azure - Webinar
 
Ha & drs gotcha's
Ha & drs gotcha'sHa & drs gotcha's
Ha & drs gotcha's
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Benchmarking top IaaS providers - A practical study
Benchmarking top IaaS providers - A practical studyBenchmarking top IaaS providers - A practical study
Benchmarking top IaaS providers - A practical study
 
Benchmarking top IaaS providers - A practical study
Benchmarking top IaaS providers -  A practical studyBenchmarking top IaaS providers -  A practical study
Benchmarking top IaaS providers - A practical study
 
How to scale up, out or down in Windows Azure
How to scale up, out or down in Windows AzureHow to scale up, out or down in Windows Azure
How to scale up, out or down in Windows Azure
 

Semelhante a Zero to scaleable in ten minutes

(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...Amazon Web Services
 
Continuous Deployment: The Dirty Details
Continuous Deployment: The Dirty DetailsContinuous Deployment: The Dirty Details
Continuous Deployment: The Dirty DetailsMike Brittain
 
Saltstack - Orchestration & Application Deployment
Saltstack - Orchestration & Application DeploymentSaltstack - Orchestration & Application Deployment
Saltstack - Orchestration & Application Deploymentinovex GmbH
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
Microservices and Friends
Microservices and FriendsMicroservices and Friends
Microservices and FriendsYun Zhi Lin
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Michael Renner
 
You got a couple Microservices, now what? - Adding SRE to DevOps
You got a couple Microservices, now what?  - Adding SRE to DevOpsYou got a couple Microservices, now what?  - Adding SRE to DevOps
You got a couple Microservices, now what? - Adding SRE to DevOpsGonzalo Maldonado
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationSean Chittenden
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13Dave Gardner
 
How to Contribute Code to MySQL?
How to Contribute Code to MySQL?How to Contribute Code to MySQL?
How to Contribute Code to MySQL?Thava Alagu
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13Dave Gardner
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)DECK36
 
Why Managed Service Providers Should Embrace Container Technology
Why Managed Service Providers Should Embrace Container TechnologyWhy Managed Service Providers Should Embrace Container Technology
Why Managed Service Providers Should Embrace Container TechnologySagi Brody
 
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS Erik Osterman
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on RailsAvi Kedar
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltStack
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksLindsay Holmwood
 

Semelhante a Zero to scaleable in ten minutes (20)

(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
 
Continuous Deployment: The Dirty Details
Continuous Deployment: The Dirty DetailsContinuous Deployment: The Dirty Details
Continuous Deployment: The Dirty Details
 
Saltstack - Orchestration & Application Deployment
Saltstack - Orchestration & Application DeploymentSaltstack - Orchestration & Application Deployment
Saltstack - Orchestration & Application Deployment
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
BPMS1
BPMS1BPMS1
BPMS1
 
BPMS1
BPMS1BPMS1
BPMS1
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
 
Microservices and Friends
Microservices and FriendsMicroservices and Friends
Microservices and Friends
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
You got a couple Microservices, now what? - Adding SRE to DevOps
You got a couple Microservices, now what?  - Adding SRE to DevOpsYou got a couple Microservices, now what?  - Adding SRE to DevOps
You got a couple Microservices, now what? - Adding SRE to DevOps
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern Automation
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13
 
How to Contribute Code to MySQL?
How to Contribute Code to MySQL?How to Contribute Code to MySQL?
How to Contribute Code to MySQL?
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
 
Why Managed Service Providers Should Embrace Container Technology
Why Managed Service Providers Should Embrace Container TechnologyWhy Managed Service Providers Should Embrace Container Technology
Why Managed Service Providers Should Embrace Container Technology
 
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof Networks
 

Último

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Zero to scaleable in ten minutes

  • 1. Zero to scaleable in ten minutes Less than obvious tools & tips for writing software that lasts Matt Walters @mateodelnorte mattwalters5@gmail.com
  • 2. What do you mean… ‘scaleable’? As businesses grow, their understanding of problems they’re solving also grows Scaleable = easy to understand, maintain, and add to During that growth, software changes. Good software is easiest to change, while still getting things done.
  • 3. Combining standard, available tools, and repeating simple, predictable patterns during development will keep your code understandable, maintainable, and easily improved. Our toolkit will be: • gitslave • tmuxinator • rabbitmq • servicebus *and some very simple patterns How do we scale an architecture?
  • 4. gitslave Why have a monolith, when you can have a metarepo? > man gits Gitslave Home Page: <http://gitslave.sf.net> NAME gits - The git slave repository tool for multi-repository management SYNOPSIS gits [-p|--parallel COUNT] [-v|--verbose]+ [--quiet] [--help] [--version] [-n|--no-pager] [--paginate] [--eval-args] [--exclude SLAVE-REGEXP] [--keep-going] [--no-commit] [--no-hide] [--no-progress] [--no-master] [--with-ifpresent|--just-ifpresent] SUBCOMMAND [ARGS]... OVERVIEW gits is a program that assists in assembling a meta-project from a number of individual git repositories which operate (when using gits) as if they were one git repository instead of many, similar to the way that CVS works by default and svn (v1.5) can be coerced to work. Some of these individual git repositories may be part of other meta- projects as well.
  • 5. gitslave Why have a monolith, when you can have a metarepo? gitslave allows you to have all of your code in one location, like a monolithic app, while allowing fine grained updates of each of your solution’s component projects. one ‘gits pull origin master’ gets all new changes, for all related projects / repositories, while you can still perform fine grained operations on any particular repo.
  • 6. gitslave Why have a monolith, when you can have a metarepo? > ls -la drwxr-xr-x 18 mateodelnorte staff 612 Jul 14 00:52 . drwxr-xr-x 77 mateodelnorte staff 2618 Jul 19 23:01 .. -rw-r--r-- 1 mateodelnorte staff 411 Jul 12 22:22 .eslintrc.js drwxr-xr-x 12 mateodelnorte staff 408 Jul 20 11:34 .git -rw-r--r-- 1 mateodelnorte staff 59 Jul 14 00:25 .gitignore -rw-r--r-- 1 mateodelnorte staff 127 Jul 14 00:26 .gitslave -rw-r--r-- 1 mateodelnorte staff 2849 Jul 5 15:56 Makefile drwxr-xr-x 16 mateodelnorte staff 544 Jul 14 01:18 denormalizer drwxr-xr-x 16 mateodelnorte staff 544 Jul 10 17:51 my-service-one drwxr-xr-x 18 mateodelnorte staff 612 Jul 14 00:39 my-service-two drwxr-xr-x 18 mateodelnorte staff 612 Jul 14 00:39 my-site -rw-r--r-- 1 mateodelnorte staff 1184 Jul 19 23:32 tmuxinator.all.yml
  • 7. gitslave Why have a monolith, when you can have a metarepo? > cat .gitignore /denormalizer/ /my-service-one/ /my-service-two/ /my-site/
  • 8. gitslave Why have a monolith, when you can have a metarepo? > cat .gitslave "../denormalizer" “denormalizer" “../my-service-one“ “my-service-one“ "../my-service-two" “my-service-two“ “../my-site" “my-site"
  • 10. tmuxinator Heads up. You need a good view of your system.
  • 11. tmuxinator .yml-based config-driven tmux. that’s it. name: my-system root: ./ windows: - site: layout: tiled panes: - my-site: - printf ‘033]2;my-site033' - cd ./my-site - make run - services: layout: tiled panes: - my-service-one: - printf '033]2;my-service-one033' - cd ./my-service-one - make run - my-service-two: - printf '033]2;my-service-two033' - cd ./my-service-two =
  • 12. tmuxinator Heads up. You need a good view of your system. Panes per process
  • 13. tmuxinator Heads up. You need a good view of your system. Windows per context, business domain, etc
  • 15. Neat whats next? We’ve talked about where you’ll house your project, and the different sub-projects within it. (hint: one gitslave metarepo and n project repos) Let’s talk a bit about messaging. And we’ve talked about how you’ll stare at it while it’s on your screen. (hint: tmuxinator)
  • 16. Why messaging? Your processes need an interface
  • 17. Why messaging? Your processes need an interface REST
  • 18. Why messaging? Your processes need an interface REST ?What happens when a process dies?
  • 19. Why messaging? Your processes need an interface REST ?? What happens when a process dies?
  • 20. Why messaging? Your processes need an interface
  • 21. Why messaging? Your processes need an interface Shared DB
  • 22. Why messaging? Your processes need an interface Shared Spaghetti Doable, but usually unclear which process ‘owns’ database structure and data. Can lead to maintenance hell.
  • 23. Why messaging? Your processes need an interface
  • 24. Why messaging? Your processes need an interface Queues
  • 25. Why messaging? Your processes need an interface Queues ? Processes go down with queues…
  • 26. Why messaging? Your processes need an interface Queues And come right back up with no message loss.
  • 27. Why messaging? Your system gets a safety net Queues ?x5Added benefit: Planned human intervention for errors.
  • 28. rabbitmq messaging that just works • direct send to queue • fanout / topic routing • highly available • highly performant • used in financial exchanges, industrial applications and more • open source • free
  • 29. rabbitmq messaging that just works brew install rabbitmq
  • 30. servicebus super simple messaging in node • direct send • pub / sub / fanout / topic -routing • simple to set up • highly performant • used in financial exchanges, online advertising and more • open source • free • perfect for creating microservices!
  • 31. servicebus super simple messaging in node npm install servicebus —save
  • 32. servicebus super simple send+listen messaging in node // process 1 var bus = require('servicebus').bus(); bus.listen('my.event', function (event) { console.log(event); }); // process 2 var bus = require('servicebus').bus(); setInterval(function () { bus.send('my.event', { my: 'event' }); }, 1000);
  • 33. servicebus super simple pub+sub messaging in node // process 1 var bus = require('servicebus').bus(); bus.subscribe('my.event', function (event) { console.log(event); }); // process 2 var bus = require('servicebus').bus(); setInterval(function () { bus.publish('my.event', { my: 'event' }); }, 1000); // process 3
  • 34. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘servicebus').bus(); const create = require(‘./lib/create’); bus.listen(‘order.create', function (event) { create(event); });
  • 35. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘servicebus’).bus(); const retry = require(‘servicebus-retry’); bus.use(retry({ store: new retry.RedisStore({ host: process.env.REDIS_HOST, port: process.env.REDIS_PORT }) })); const create = require(‘./lib/create’); bus.listen(‘order.create', function (event) { create(event, (err) => { if (err) return event.handle.reject(); event.handle.ack(); }); });
  • 36. (micro)servicebus some simple patterns get us going // order-svc refactored bus to ./lib/bus.js const bus = require(‘servicebus’).bus(); const retry = require(‘servicebus-retry’); bus.use(retry({ store: new retry.RedisStore({ host: process.env.REDIS_HOST, port: process.env.REDIS_PORT }) })); module.exports = bus;
  • 37. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘./bus’); // moved bus initialization to own module const create = require(‘./lib/create’); bus.listen(‘order.create', function (event) { create(event, (err) => { if (err) return event.handle.reject(); event.handle.ack(); }); });
  • 38. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘./bus’); // moved bus initialization to own module const create = require(‘./lib/create’); bus.listen(‘order.create', function (event) { create(event, (err, order) => { if (err) return event.handle.reject(); bus.publish(‘order.created’, order, () => { event.handle.ack(); }); }); }); service publishes to the world when it’s done!
  • 39. commands tell services when an actor wants an action client send commands to instruct a service to do work commands are sent async, fire and forget commands are sent directives: order.create web app order-svc order.create!
  • 40. events tell the world when you’re done services publish when done performing work services publish messages to any services that wish to listen events are sent past-tense: order.created order-svc fulfillment-svc order.created! order.created!
  • 41. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘./bus’); // moved bus initialization to own module const create = require(‘./lib/create’); bus.listen(‘order.create', function (event) { create(event, (err, order) => { if (err) return event.handle.reject(); bus.publish(‘order.created’, order, () => { event.handle.ack(); }); }); });
  • 42. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘./bus’); // moved bus initialization to own module const cancel = require(‘./lib/cancel’); const create = require(‘./lib/create’); bus.listen(‘order.create', function (event) { create(event, (err, order) => { if (err) return event.handle.reject(); bus.publish(‘order.created’, order); bus.publish(‘order.created’, order, () => { event.handle.ack(); }); }); }); bus.listen(‘order.cancel', function (event) { cancel(event, (err, order) => { if (err) return event.handle.reject(); bus.publish(‘order.canceled’, order); bus.publish(‘order.created’, order, () => { event.handle.ack(); }); }); code buildup increases cognitive load
  • 43. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘./bus’); // moved bus initialization to own module require(‘./lib/handlers/orderCanceled’); require(‘./lib/handlers/orderCreated’); // moved handlers to their own modules, // hiding their complexity from other code
  • 44. (micro)servicebus some simple patterns get us going // order-svc index.js const bus = require(‘./bus’); const log = require(‘llog’); const registerHandler = require(‘servicebus-register-handlers’); registerHandlers({ bus, handleError: function handleError (msg, err) { log.error(`error handling ${msg.type}: ${err}. rejecting message` + `w/cid ${msg.cid} and correlationId ${this.correlationId}.`); log.fatal(err); msg.handle.reject(() => { bus.close(); process.exit(1); }); }, path: ‘./lib/handlers', // handlers are now one listen or subscribe per file queuePrefix: 'order-svc', });
  • 45. Show the stuff! quick show and tell
  • 46. Let’s recap! ‘cause there was a lot! 1. gitslave lets you structure a project like a monolith, but have the convenience of many repositories 2. tmuxinator gives you a head’s up view of your system, all running locally 3. messaging provides a durable, convenient interface between your processes 4. rabbitmq + servicebus enable easy send+listen & pub +sub messaging patterns between processes 5. processes send commands and publish events 6. simple, expected, structure in your services keeps cognitive load low, and projects easy to maintain
  • 47. Thanks! We’ll cover more on event-driven architecture, microsvc, CQRS, and more in a future talk!
  • 48. Zero to scaleable in ten minutes Matt Walters github & twitter: @mateodelnorte email: mattwalters5@gmail.com https://github.com/tmuxinator/tmuxinator rabbitmq.com http://gitslave.sourceforge.net/ https://www.npmjs.com/package/servicebus