Microservices Architecture
and Containers.
Jacob Clark (@imjacobclark)
Monolithic architectures
● Fundamental components are interwoven
● Typically composed of Client, Server & Database
● Examples being WordPress, Jenkins, GitLab
● Changes mean complete compilation/redeploy
● Difficult to scale
● Generally easier to build
● Generally easier to deploy
Posts Content Users
Plugins DashboardThemes
WordPress
HTTP Server
MySQL
Microservices architectures
● An application built as a suite of small services
● Standalone, scalable & distributed
● Communicate over a standard protocol (REST, message queues)
● Programmatically react to failures
● Evolutionary architecture principle (don't microservice all the things...)
● Improved automation and delivery
● Not tied to a single language or framework
Client
Comments
Content
Plugins
Dashboard
Themes
Posts
HTTP Server (Loadbalancing)
json
json
json
octet stream
json
html html
Themes
Themes
Plugins
Plugins
Comments
Comments
Posts
Posts
DB adaptor
json
The problem
● omg boxes???
● Horrendous deployment times
● Maintaining large infrastructure
● A simple architecture now hugely complicated
● Cost is exponential
● Monitoring??
● Does my cloud provider even support programmatic
provisioning??
The solution... containers!
● Applications and their dependencies only (not an entire OS)
● Single kernel opposed to multikernel
● Built into the foundations of Unix (LXC, etc)
● Run as an isolated processes in userspace
● Resources are isolated from the host and other
containers (much like Virtualisation)
● Consistent, portable and packageable environments by
default (no need for Vagrant or Packer)
Putting them together...
● Microservices inside containers make for easy to
distribute services
● Developers can build on identical and consistent
environments
● Containers can be hosted on private repositories,
making individual service deployment faster (dependencies aren't
pulled from third party mirrors)
● Deployment build jobs are considerably smaller
ClientDashboard Themes
Plugins Comments
Posts
DB
adaptor
Database
Host 02
Themes
Plugins
CommentsPosts
DB
adaptor
Host 03
Themes
Plugins
CommentsPosts
DB
adaptor
Host 04
Host 01
HTTP Load Balancer
Host 05
Content
Docker
● It’s creating a container standard (libcontainer)
● Cross-platform thanks to Microsoft Azure
● 75’000+ pre-built `Dockerized` applications, including
Ubuntu, MongoDB & Node.
● Backed by eBay, Spotify, Rackspace, New Relic and
more
Dockerising a Node app...
server.js
package.json
Dockerfile
docker build -t bbc-example-app .
docker run -t -i -p 1337:1337 bbc-example-app
CoreOS
● OS designed for launching containers
● Built for clustering
● Built in service discovery with automatic failover
● Docker by default
● Backed by Google, Rackspace, Cisco and Mozilla
● Fleet for centralised service management of
an entire cluster
● Systemd for cluster service management
● Etcd service discovery via a cluster
distributed key-value store
● Confd for dynamic configuration reloading
● https://github.com/imjacobclark/devnews-coreos
Scaling Node on CoreOS
kthxbi

Microservices Architecture and Containers.

  • 1.
  • 2.
    Monolithic architectures ● Fundamentalcomponents are interwoven ● Typically composed of Client, Server & Database ● Examples being WordPress, Jenkins, GitLab ● Changes mean complete compilation/redeploy ● Difficult to scale ● Generally easier to build ● Generally easier to deploy
  • 3.
    Posts Content Users PluginsDashboardThemes WordPress HTTP Server MySQL
  • 5.
    Microservices architectures ● Anapplication built as a suite of small services ● Standalone, scalable & distributed ● Communicate over a standard protocol (REST, message queues) ● Programmatically react to failures ● Evolutionary architecture principle (don't microservice all the things...) ● Improved automation and delivery ● Not tied to a single language or framework
  • 6.
    Client Comments Content Plugins Dashboard Themes Posts HTTP Server (Loadbalancing) json json json octetstream json html html Themes Themes Plugins Plugins Comments Comments Posts Posts DB adaptor json
  • 7.
    The problem ● omgboxes??? ● Horrendous deployment times ● Maintaining large infrastructure ● A simple architecture now hugely complicated ● Cost is exponential ● Monitoring?? ● Does my cloud provider even support programmatic provisioning??
  • 8.
    The solution... containers! ●Applications and their dependencies only (not an entire OS) ● Single kernel opposed to multikernel ● Built into the foundations of Unix (LXC, etc) ● Run as an isolated processes in userspace ● Resources are isolated from the host and other containers (much like Virtualisation) ● Consistent, portable and packageable environments by default (no need for Vagrant or Packer)
  • 9.
    Putting them together... ●Microservices inside containers make for easy to distribute services ● Developers can build on identical and consistent environments ● Containers can be hosted on private repositories, making individual service deployment faster (dependencies aren't pulled from third party mirrors) ● Deployment build jobs are considerably smaller
  • 10.
    ClientDashboard Themes Plugins Comments Posts DB adaptor Database Host02 Themes Plugins CommentsPosts DB adaptor Host 03 Themes Plugins CommentsPosts DB adaptor Host 04 Host 01 HTTP Load Balancer Host 05 Content
  • 11.
    Docker ● It’s creatinga container standard (libcontainer) ● Cross-platform thanks to Microsoft Azure ● 75’000+ pre-built `Dockerized` applications, including Ubuntu, MongoDB & Node. ● Backed by eBay, Spotify, Rackspace, New Relic and more
  • 12.
    Dockerising a Nodeapp... server.js package.json Dockerfile docker build -t bbc-example-app . docker run -t -i -p 1337:1337 bbc-example-app
  • 13.
    CoreOS ● OS designedfor launching containers ● Built for clustering ● Built in service discovery with automatic failover ● Docker by default ● Backed by Google, Rackspace, Cisco and Mozilla
  • 14.
    ● Fleet forcentralised service management of an entire cluster ● Systemd for cluster service management ● Etcd service discovery via a cluster distributed key-value store ● Confd for dynamic configuration reloading ● https://github.com/imjacobclark/devnews-coreos Scaling Node on CoreOS
  • 15.