SlideShare a Scribd company logo
1 of 49
Download to read offline
A Tale of a Server Architecture


                            Ville Lautanala
                                   @lautis
WHO AM I   @lautis
Flowdock, team collaboration app with software developer as primary target audience.
Right-hand side: chat, left-hand side: inbox or activity stream for your team.
If you’ve read a Node.JS tutorial you probably know needed the architecture.
Facts

         •   Single page JavaScript front-end

         •   WebSocket based communication layer

         •   Three replicated databases

         •   Running on dedicated servers in Germany

         •   99.98% availability



WebSockets == no third-party load-balancers/PaaS for us
99.99% according to CEO, but I’m being conservative
Goal: beat your hosting provider in
                      uptime



Have a good uptime on unreliable hardware.
We don’t want to wake up at night to fix our app like this guy in this picture. The founders had previously a hosting company.
This is not an exact science, every
          app is different.
Architecture Archaeology



We haven’t been always doing very well
Flowdock 2010
                                                          Apache




                                    Messages                                     Rails




                                    MongoDB                                 PostgreSQL




Simple stack, but the messaging part quickly became hairy. It had HTTP streaming, Twitter integration and e-mail server. Lot of
brittle state.
Divide and Conquer



Nice strategy for building your SOA, sorting lists and taking over the world.
GeoDNS


                                                      Stunnel


                                                     HAproxy


                                                         HTTP
                                  WebSocket
                  RSS     IRC                         Streaming
                                     API




                                                                                                 Redis
                                                          API
                                                                                      Rails

                           Message Backend


                                 MongoDB                                            PostgreSQL

These are all different processes.
More components, but this has enabled us to easily add new features to components
Separated concerns...
but many parts to configure
So, you need to setup boxes...
Chef
                   Infrastructure as (Ruby) Code



Chef lets you to automate server configuration with Ruby code.
Chef at Flowdock

          •    Firewall configuration

          •    Distribute SSH host keys

          •    User setup

          •    Join mesh-based VPN

          •    And app/server specific stuff



Firewall set up is based on IP-whitelist. Only nodes in chef can access private services.
SSH host keys prevent MITM
We have a mesh-based VPN, which is automatically configured based on Chef data
•Cookbooks

• Recipes

• Roles
Chef server



Centralized chef server which nodes communicate with and get updates from.
cookbooks/flowdock/oulu.rb
          include_recipe "flowdock:users"
          package "ruby"

          %w{port listen_to flowdock_domain}.each do |e|
            template "#{node[:flowdock][:oulu][:envdir]}/#{e.upcase}" do
              source "envdir_file.erb"
              variables :value => node[:flowdock][:oulu][e]
              owner "oulu"
              mode "0600"
            end
          end

          runit_service "oulu" do
            options :use_config => true
          end

Recipe for our IRC server
roles/rails.rb
                               name "rails"
                               description "Rails Box"
                               run_list(
                                 "recipe[nginx]",
                                 "recipe[passenger]"
                               )
                               override_attributes(
                                 passenger:
                                   { version: "3.0.7" }
                               )

Recipe in Ruby DSL
Each node can be assigned any number of roles
Override attributes can be used to override recipe attributes
Managing Chef cluster


$ knife cookbook upload -a -o cookbooks
Managing Chef cluster

$ knife search node role:flowdock-app-server
Node Name:   imaginary-server
Environment: qa
FQDN:        imaginary-server.flowdock.dmz
IP:          10.0.0.1
Run List:    role[qa], role[flowdock-app-server], role[web-server]
Roles:       qa, flowdock-app-server, web-server
Recipes:     ubuntu, firewall, chef, flowdock, unicorn, haproxy
Platform:    ubuntu 12.04
Tags:
Managing Chef cluster

                         $ knife ssh 'role:qa' 'echo "lol"'
                         imaginary-server lol
                         qa-db1           lol
                         qa-db2           lol




Most useful command: trigger chef run on servers
Testing Chef Recipes

          • Use Chef environments to
             isolate changes

          • Run chef-client on throw-away
             VMs

          • cucumber-chef

sous-chef could be used to automate VM setup
Our experience with cucumber-chef and sous-chef is limited
You need also to monitor stuff e.g. runs have finished on nodes, backups are really taken
Automatic Failover
                                          Avoiding Single Point of Failures




MongoDB works flawlessly as failover is built-in, but how to handle Redis?
HAproxy
                                TCP/HTTP Load Balancer with Failover handling




HAproxy provides easy failover for Rails instances
MongoDB has automatic failover
                      built-in



MongoDB might have many problems, but failover isn’t one of them. Drivers are always connected to master.
Redis and Postgres have
            replication, but failover is manual



Not only do you need to promote master automatically, but also change application configuration.
ZooKeeper
Distributed coordination



Each operation has to be agreed by majority of servers. Eventual consistency.
require 'zk'

        $queue = Queue.new
        zk = ZK.new
        zk.register('/hello_world') do |event|
          # need to reset watch
          data = zk.get('/hello_world', watch: true).first
          # do stuff
          $queue.push(:event)
        end

        zk.create('/hello_world', 'sup?')
        $queue.pop # Handle local synchronization
        zk.set('/hello_world', 'omg, update')


Using the high-level zk gem. Block is run every time value is updated.
ZK gem has locks and other stuff implemented.
zk = ZK.new

zk.with_lock('/lock', :wait => 5.0) do |lock|
  # do stuff
  # others have to wait
end
Redis master failover using
       ZooKeeper
gem install redis_failover



    but in 3 programming languages
Redis Failover
                              W
                 App
                               at                                       te        Node Manager
                                  c   h                             p da
                                                                  U                              Node Manager

                 App                        ZooKeeper




                                                                                                      Mon itor
                 App                                                              Redis Node
                                                                                                  Redis Node


Our apps might not use redis_failover or read ZK directly. Script restarts the app when ZK changes.
HAproxy or DNS based solutions also possible, but this gives us more control over the app restart.
Postgres failover with pgpool-II and
                      ZooKeeper



pgpool manages pg cluster, queries can be distributed to slaves
I’m afraid of pgpool, configuration and monitoring scripts are really scary
Postgres Failover
                                                                      PGpool monitor

                                                  ZooKeeper


                App


                                                     pgpool

                                                                      PG
                                                                                PG


zookeeper/pgpool monitoring is used to provide redundancy to pgpool
If pgpool fails, app needs to reconnect to new server
Zoos are kept
Similar scheme can be used for other master-slave based replications, e.g. handling twitter integration failover.

REMEMBER TO TEST
Test your failover



You might only need some failover few times a year.

Not sure if everything of our stuff is top-notch, but there have been one-time use cases for the complicated stuff.
Chef vs ZooKeeper

                                    Chef                             ZooKeeper

                                                                  Dynamic configuration
                            Configuration files
                                                                       variables


                              Server boostrap                         Failover handling



Chef write long configuration files, ZooKeeper only contains few variables
Chef boostraps server and keeps them up-to-date, ZooKeeper is used to elect master nodes in master-slave scenarios.
Mesh-based VPN between boxes



Encrypted MongoDB traffic between masters and slaves. Saved the day few times when there has been routing issues between
data centers.
SSL endpoints in AWS



Routing issues between our German ISP and Comcast. Move SSL front ends closer to client to fix this and reduce latency. Front-
page loads 150ms faster.
Winning
We don’t need to worry about waking up at nights. The whole team could go sailing and be without internet access at the same
time.
Lessons learned



What have we learned?
WebSockets are cool, but make
                    your life harder



Heroku, Amazon Elastic Load Balancer, CloudFlare and Google App engine don’t work with WS. If you only need to stream stuff,
using HTTP EventStreaming is better choice.
Let it crash



Make your app crash, at least you are there to fix things.
Questions?
Thanks!

More Related Content

What's hot

Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Shaer Hassan
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsMarcelo Pinheiro
 
Combining the strength of erlang and Ruby
Combining the strength of erlang and RubyCombining the strength of erlang and Ruby
Combining the strength of erlang and RubyMartin Rehfeld
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefAntons Kranga
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011Fabio Akita
 
Australian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStackAustralian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStackMatt Ray
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
Meetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend itMeetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend itStefan Schimanski
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Łukasz Proszek
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點William Yeh
 
Scaling Your App With Docker Swarm using Terraform, Packer on Openstack
Scaling Your App With Docker Swarm using Terraform, Packer on OpenstackScaling Your App With Docker Swarm using Terraform, Packer on Openstack
Scaling Your App With Docker Swarm using Terraform, Packer on OpenstackBobby DeVeaux, DevOps Consultant
 
10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기DongHee Lee
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) serverDmitry Lyfar
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chefLeanDog
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet CampPuppet
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on InfinispanLance Ball
 

What's hot (19)

Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability Systems
 
Combining the strength of erlang and Ruby
Combining the strength of erlang and RubyCombining the strength of erlang and Ruby
Combining the strength of erlang and Ruby
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011
 
Australian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStackAustralian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStack
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Meetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend itMeetup - Principles of the kube api and how to extend it
Meetup - Principles of the kube api and how to extend it
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Scaling Your App With Docker Swarm using Terraform, Packer on Openstack
Scaling Your App With Docker Swarm using Terraform, Packer on OpenstackScaling Your App With Docker Swarm using Terraform, Packer on Openstack
Scaling Your App With Docker Swarm using Terraform, Packer on Openstack
 
10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) server
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
 

Viewers also liked

8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATION
8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATION8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATION
8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATIONCloudBooks
 
Product / Market Fit – Our Travels Towards It
Product / Market Fit – Our Travels Towards ItProduct / Market Fit – Our Travels Towards It
Product / Market Fit – Our Travels Towards ItFlowdock
 
Lean Startups in Japanese Companies takashi tsutsumi_masato_iino
Lean Startups in Japanese Companies takashi tsutsumi_masato_iinoLean Startups in Japanese Companies takashi tsutsumi_masato_iino
Lean Startups in Japanese Companies takashi tsutsumi_masato_iinoStanford University
 
Customer Development Methodology
Customer Development MethodologyCustomer Development Methodology
Customer Development MethodologyVenture Hacks
 
Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016 Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016 Stanford University
 
Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016Stanford University
 
Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016Stanford University
 
Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016Stanford University
 
Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016Stanford University
 
Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016Stanford University
 
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016Stanford University
 

Viewers also liked (11)

8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATION
8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATION8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATION
8 MOST EFFECTIVE APPS FOR INTERNAL COMMUNICATION
 
Product / Market Fit – Our Travels Towards It
Product / Market Fit – Our Travels Towards ItProduct / Market Fit – Our Travels Towards It
Product / Market Fit – Our Travels Towards It
 
Lean Startups in Japanese Companies takashi tsutsumi_masato_iino
Lean Startups in Japanese Companies takashi tsutsumi_masato_iinoLean Startups in Japanese Companies takashi tsutsumi_masato_iino
Lean Startups in Japanese Companies takashi tsutsumi_masato_iino
 
Customer Development Methodology
Customer Development MethodologyCustomer Development Methodology
Customer Development Methodology
 
Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016 Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016
 
Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016
 
Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016
 
Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016
 
Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016
 
Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016
 
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
 

Similar to A Tale of a Server Architecture's Evolution

Handling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeperHandling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeperryanlecompte
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?Altoros
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发shaokun
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
Ruby on Rails All Hands Meeting
Ruby on Rails All Hands MeetingRuby on Rails All Hands Meeting
Ruby on Rails All Hands MeetingDan Davis
 
Whirr dev-up-puppetconf2011
Whirr dev-up-puppetconf2011Whirr dev-up-puppetconf2011
Whirr dev-up-puppetconf2011Puppet
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applicationsCorley S.r.l.
 
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...Joonas Lehtinen
 
Building a Better Mousetrap for the Cloud
Building a Better Mousetrap for the CloudBuilding a Better Mousetrap for the Cloud
Building a Better Mousetrap for the Cloudelliando dias
 
Deploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalkDeploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalkJulien SIMON
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?Srijan Technologies
 
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve ParityDeveloper Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve ParityMichael Hofmann
 
Cloud Foundry Open Tour China
Cloud Foundry Open Tour ChinaCloud Foundry Open Tour China
Cloud Foundry Open Tour Chinamarklucovsky
 

Similar to A Tale of a Server Architecture's Evolution (20)

Handling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeperHandling Redis failover with ZooKeeper
Handling Redis failover with ZooKeeper
 
DevOps
DevOpsDevOps
DevOps
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?
 
Where is my scalable API?
Where is my scalable API?Where is my scalable API?
Where is my scalable API?
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Nodejs
NodejsNodejs
Nodejs
 
Ruby on Rails All Hands Meeting
Ruby on Rails All Hands MeetingRuby on Rails All Hands Meeting
Ruby on Rails All Hands Meeting
 
Whirr dev-up-puppetconf2011
Whirr dev-up-puppetconf2011Whirr dev-up-puppetconf2011
Whirr dev-up-puppetconf2011
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applications
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Node js
Node jsNode js
Node js
 
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
 
Building a Better Mousetrap for the Cloud
Building a Better Mousetrap for the CloudBuilding a Better Mousetrap for the Cloud
Building a Better Mousetrap for the Cloud
 
Deploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalkDeploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalk
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
 
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve ParityDeveloper Experience Cloud Native - Become Efficient and Achieve Parity
Developer Experience Cloud Native - Become Efficient and Achieve Parity
 
Cloud Foundry Open Tour China
Cloud Foundry Open Tour ChinaCloud Foundry Open Tour China
Cloud Foundry Open Tour China
 

Recently uploaded

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
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...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

A Tale of a Server Architecture's Evolution

  • 1. A Tale of a Server Architecture Ville Lautanala @lautis
  • 2. WHO AM I @lautis
  • 3.
  • 4. Flowdock, team collaboration app with software developer as primary target audience. Right-hand side: chat, left-hand side: inbox or activity stream for your team. If you’ve read a Node.JS tutorial you probably know needed the architecture.
  • 5. Facts • Single page JavaScript front-end • WebSocket based communication layer • Three replicated databases • Running on dedicated servers in Germany • 99.98% availability WebSockets == no third-party load-balancers/PaaS for us 99.99% according to CEO, but I’m being conservative
  • 6. Goal: beat your hosting provider in uptime Have a good uptime on unreliable hardware.
  • 7. We don’t want to wake up at night to fix our app like this guy in this picture. The founders had previously a hosting company.
  • 8. This is not an exact science, every app is different.
  • 9. Architecture Archaeology We haven’t been always doing very well
  • 10. Flowdock 2010 Apache Messages Rails MongoDB PostgreSQL Simple stack, but the messaging part quickly became hairy. It had HTTP streaming, Twitter integration and e-mail server. Lot of brittle state.
  • 11. Divide and Conquer Nice strategy for building your SOA, sorting lists and taking over the world.
  • 12. GeoDNS Stunnel HAproxy HTTP WebSocket RSS IRC Streaming API Redis API Rails Message Backend MongoDB PostgreSQL These are all different processes. More components, but this has enabled us to easily add new features to components
  • 14. but many parts to configure
  • 15. So, you need to setup boxes...
  • 16. Chef Infrastructure as (Ruby) Code Chef lets you to automate server configuration with Ruby code.
  • 17. Chef at Flowdock • Firewall configuration • Distribute SSH host keys • User setup • Join mesh-based VPN • And app/server specific stuff Firewall set up is based on IP-whitelist. Only nodes in chef can access private services. SSH host keys prevent MITM We have a mesh-based VPN, which is automatically configured based on Chef data
  • 19. Chef server Centralized chef server which nodes communicate with and get updates from.
  • 20. cookbooks/flowdock/oulu.rb include_recipe "flowdock:users" package "ruby" %w{port listen_to flowdock_domain}.each do |e| template "#{node[:flowdock][:oulu][:envdir]}/#{e.upcase}" do source "envdir_file.erb" variables :value => node[:flowdock][:oulu][e] owner "oulu" mode "0600" end end runit_service "oulu" do options :use_config => true end Recipe for our IRC server
  • 21. roles/rails.rb name "rails" description "Rails Box" run_list(   "recipe[nginx]", "recipe[passenger]" ) override_attributes( passenger: { version: "3.0.7" } ) Recipe in Ruby DSL Each node can be assigned any number of roles Override attributes can be used to override recipe attributes
  • 22. Managing Chef cluster $ knife cookbook upload -a -o cookbooks
  • 23. Managing Chef cluster $ knife search node role:flowdock-app-server Node Name: imaginary-server Environment: qa FQDN: imaginary-server.flowdock.dmz IP: 10.0.0.1 Run List: role[qa], role[flowdock-app-server], role[web-server] Roles: qa, flowdock-app-server, web-server Recipes: ubuntu, firewall, chef, flowdock, unicorn, haproxy Platform: ubuntu 12.04 Tags:
  • 24. Managing Chef cluster $ knife ssh 'role:qa' 'echo "lol"' imaginary-server lol qa-db1 lol qa-db2 lol Most useful command: trigger chef run on servers
  • 25. Testing Chef Recipes • Use Chef environments to isolate changes • Run chef-client on throw-away VMs • cucumber-chef sous-chef could be used to automate VM setup Our experience with cucumber-chef and sous-chef is limited You need also to monitor stuff e.g. runs have finished on nodes, backups are really taken
  • 26. Automatic Failover Avoiding Single Point of Failures MongoDB works flawlessly as failover is built-in, but how to handle Redis?
  • 27. HAproxy TCP/HTTP Load Balancer with Failover handling HAproxy provides easy failover for Rails instances
  • 28. MongoDB has automatic failover built-in MongoDB might have many problems, but failover isn’t one of them. Drivers are always connected to master.
  • 29. Redis and Postgres have replication, but failover is manual Not only do you need to promote master automatically, but also change application configuration.
  • 31. Distributed coordination Each operation has to be agreed by majority of servers. Eventual consistency.
  • 32. require 'zk' $queue = Queue.new zk = ZK.new zk.register('/hello_world') do |event| # need to reset watch data = zk.get('/hello_world', watch: true).first # do stuff $queue.push(:event) end zk.create('/hello_world', 'sup?') $queue.pop # Handle local synchronization zk.set('/hello_world', 'omg, update') Using the high-level zk gem. Block is run every time value is updated. ZK gem has locks and other stuff implemented.
  • 33. zk = ZK.new zk.with_lock('/lock', :wait => 5.0) do |lock| # do stuff # others have to wait end
  • 34. Redis master failover using ZooKeeper
  • 35. gem install redis_failover but in 3 programming languages
  • 36. Redis Failover W App at te Node Manager c h p da U Node Manager App ZooKeeper Mon itor App Redis Node Redis Node Our apps might not use redis_failover or read ZK directly. Script restarts the app when ZK changes. HAproxy or DNS based solutions also possible, but this gives us more control over the app restart.
  • 37. Postgres failover with pgpool-II and ZooKeeper pgpool manages pg cluster, queries can be distributed to slaves I’m afraid of pgpool, configuration and monitoring scripts are really scary
  • 38. Postgres Failover PGpool monitor ZooKeeper App pgpool PG PG zookeeper/pgpool monitoring is used to provide redundancy to pgpool If pgpool fails, app needs to reconnect to new server
  • 39. Zoos are kept Similar scheme can be used for other master-slave based replications, e.g. handling twitter integration failover. REMEMBER TO TEST
  • 40. Test your failover You might only need some failover few times a year. Not sure if everything of our stuff is top-notch, but there have been one-time use cases for the complicated stuff.
  • 41. Chef vs ZooKeeper Chef ZooKeeper Dynamic configuration Configuration files variables Server boostrap Failover handling Chef write long configuration files, ZooKeeper only contains few variables Chef boostraps server and keeps them up-to-date, ZooKeeper is used to elect master nodes in master-slave scenarios.
  • 42. Mesh-based VPN between boxes Encrypted MongoDB traffic between masters and slaves. Saved the day few times when there has been routing issues between data centers.
  • 43. SSL endpoints in AWS Routing issues between our German ISP and Comcast. Move SSL front ends closer to client to fix this and reduce latency. Front- page loads 150ms faster.
  • 44. Winning We don’t need to worry about waking up at nights. The whole team could go sailing and be without internet access at the same time.
  • 46. WebSockets are cool, but make your life harder Heroku, Amazon Elastic Load Balancer, CloudFlare and Google App engine don’t work with WS. If you only need to stream stuff, using HTTP EventStreaming is better choice.
  • 47. Let it crash Make your app crash, at least you are there to fix things.

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. Flowdock, team collaboration app with software developer as primary target audience.\nRight-hand side: chat, left-hand side: inbox or activity stream for your team.\nIf you’ve read a Node.JS tutorial you probably know needed the architecture.\n
  5. WebSockets == no third-party load-balancers/PaaS for us\n99.99% according to CEO, but I’m being conservative\n
  6. WebSockets == no third-party load-balancers/PaaS for us\n99.99% according to CEO, but I’m being conservative\n
  7. WebSockets == no third-party load-balancers/PaaS for us\n99.99% according to CEO, but I’m being conservative\n
  8. WebSockets == no third-party load-balancers/PaaS for us\n99.99% according to CEO, but I’m being conservative\n
  9. WebSockets == no third-party load-balancers/PaaS for us\n99.99% according to CEO, but I’m being conservative\n
  10. Have a good uptime on unreliable hardware.\n
  11. We don’t want to wake up at night to fix our app like this guy in this picture. The founders had previously a hosting company.\n
  12. \n
  13. We haven’t been always doing very well\n
  14. Simple stack, but the messaging part quickly became hairy. It had HTTP streaming, Twitter integration and e-mail server. Lot of brittle state.\n
  15. Works well also for sorting lists and taking over the world\n
  16. Works well also for sorting lists and taking over the world\n
  17. Works well also for sorting lists and taking over the world\n
  18. Nice strategy for building your SOA, sorting lists and taking over the world.\n
  19. These are all different processes. \nMore components, but this has enabled us to easily add new features to components\n
  20. \n
  21. \n
  22. \n
  23. \n
  24. Chef lets you to automate server configuration with Ruby code.\n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. Firewall set up is based on IP-whitelist. Only nodes in chef can access private services.\nSSH host keys prevent MITM\nWe have a mesh-based VPN, which is automatically configured based on Chef data\n
  31. Firewall set up is based on IP-whitelist. Only nodes in chef can access private services.\nSSH host keys prevent MITM\nWe have a mesh-based VPN, which is automatically configured based on Chef data\n
  32. Firewall set up is based on IP-whitelist. Only nodes in chef can access private services.\nSSH host keys prevent MITM\nWe have a mesh-based VPN, which is automatically configured based on Chef data\n
  33. Firewall set up is based on IP-whitelist. Only nodes in chef can access private services.\nSSH host keys prevent MITM\nWe have a mesh-based VPN, which is automatically configured based on Chef data\n
  34. Firewall set up is based on IP-whitelist. Only nodes in chef can access private services.\nSSH host keys prevent MITM\nWe have a mesh-based VPN, which is automatically configured based on Chef data\n
  35. \n
  36. \n
  37. Centralized chef server which nodes communicate with and get updates from.\n
  38. Recipe for our IRC server\n
  39. Recipe in Ruby DSL\nEach node can be assigned any number of roles\nOverride attributes can be used to override recipe attributes\n
  40. \n
  41. \n
  42. Most useful command: trigger chef run on servers\n
  43. sous-chef could be used to automate VM setup\nOur experience with cucumber-chef and sous-chef is limited\nYou need also to monitor stuff e.g. runs have finished on nodes, backups are really taken\n\n
  44. sous-chef could be used to automate VM setup\nOur experience with cucumber-chef and sous-chef is limited\nYou need also to monitor stuff e.g. runs have finished on nodes, backups are really taken\n\n
  45. sous-chef could be used to automate VM setup\nOur experience with cucumber-chef and sous-chef is limited\nYou need also to monitor stuff e.g. runs have finished on nodes, backups are really taken\n\n
  46. sous-chef could be used to automate VM setup\nOur experience with cucumber-chef and sous-chef is limited\nYou need also to monitor stuff e.g. runs have finished on nodes, backups are really taken\n\n
  47. MongoDB works flawlessly as failover is built-in, but how to handle Redis?\n
  48. HAproxy provides easy failover for Rails instances\n
  49. IP failover has less latency than DNS-based solution, but we got the DNS failover for free\n
  50. IP failover has less latency than DNS-based solution, but we got the DNS failover for free\n
  51. IP failover has less latency than DNS-based solution, but we got the DNS failover for free\n
  52. IP failover has less latency than DNS-based solution, but we got the DNS failover for free\n
  53. MongoDB might have many problems, but failover isn’t one of them. Drivers are always connected to master.\n
  54. Not only do you need to promote master automatically, but also change application configuration.\n
  55. \n
  56. Each operation has to be agreed by majority of servers. Eventual consistency.\n
  57. \n
  58. \n
  59. \n
  60. \n
  61. Using the high-level zk gem. Block is run every time value is updated.\nZK gem has locks and other stuff implemented.\n
  62. \n
  63. \n
  64. \n
  65. Our apps might not use redis_failover or read ZK directly. Script restarts the app when ZK changes.\nHAproxy or DNS based solutions also possible, but this gives us more control over the app restart.\n\n
  66. pgpool manages pg cluster, queries can be distributed to slaves\nI’m afraid of pgpool, configuration and monitoring scripts are really scary\n
  67. zookeeper/pgpool monitoring is used to provide redundancy to pgpool\nIf pgpool fails, app needs to reconnect to new server\n
  68. Similar scheme can be used for other master-slave based replications, e.g. handling twitter integration failover.\n\nREMEMBER TO TEST\n
  69. You might only need some failover few times a year.\nNot sure if everything of our stuff is top-notch, but there have been one-time use cases for the complicated stuff.\n
  70. Chef write long configuration files, ZooKeeper only contains few variablesChef boostraps server and keeps them up-to-date, ZooKeeper is used to elect master nodes in master-slave scenarios.\n
  71. Encrypted MongoDB traffic between masters and slaves. Saved the day few times when there has been routing issues between data centers.\n
  72. Routing issues between our German ISP and Comcast. Move SSL front ends closer to client to fix this and reduce latency. Front-page loads 150ms faster.\n
  73. We don’t need to worry about waking up at nights. The whole team could go sailing and be without internet access at the same time.\n
  74. What have we learned?\n
  75. Heroku, Amazon Elastic Load Balancer, CloudFlare and Google App engine don’t work with WS. If you only need to stream stuff, using HTTP EventStreaming is better choice.\n
  76. Decoupling had instant effect on our uptime\n
  77. Make your app crash, at least you are there to fix things.\n
  78. \n
  79. \n