GithubHelp home page GithubHelp logo

quantum-nodes's Introduction

Running Quantum on multiple nodes

gif

This example is taken from quantum_swarm but uses a single mix application instead of an Phoenix umbrella application.

Setup

Just run docker-compose build to set everything up.

Libraries

  • Quantum for managing CRON tasks.
  • Distillery to generate the application which runs on the container to simulate a production environment.
  • libcluster for automatic cluster formation. Different strategies can be used to achieve it. In this case we poll from the DNS A records to find other availble nodes to connect to.

Usage

Start the application with docker-compose up. After a while, you should start to receives messages like the following every second:

sample_app_1  | 21:10:40.001 [warn]  Hello from [email protected]

Then in a separate session, you can issue docker-compose up --scale sample_app=X -d where X is the new total number of running instances.

sample_app_3  | 
sample_app_3  | 21:15:43.004 [warn]  Hello from [email protected]
sample_app_3  | 
sample_app_3  | 21:15:44.003 [warn]  Hello from [email protected]
sample_app_2  | 
sample_app_2  | 21:15:45.001 [warn]  Hello from [email protected]
sample_app_2  | 
sample_app_2  | 21:15:46.001 [warn]  Hello from [email protected]
sample_app_2  | 
sample_app_2  | 21:15:47.002 [warn]  Hello from [email protected]
sample_app_1  | 
sample_app_1  | 21:15:48.003 [warn]  Hello from [email protected]

Todo

A couple of things might need some investigating.

On Scale Up

When scaling up, I looks like the first instance receives a :shutdown. I still need to figure out if this comes either from the way docker-compose up --scale works or not. In either case this could be problematic if the shutdown happens before state synchronization between the nodes.

sample_app_1  | 21:11:38.278 [error] GenServer SampleApp.Scheduler.ExecutorSupervisor terminating
sample_app_1  | ** (stop) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
sample_app_1  | Last message: {:DOWN, #Reference<0.1320933371.735313921.234648>, :process, #PID<0.1278.0>, :noproc}
sample_app_1  |
sample_app_1  | 21:11:38.278 [warn]  [swarm on [email protected]] [tracker:handle_topology_change] handoff failed for SampleApp.Scheduler.ExecutionBroadcaster: {:shutdown, {GenServer, :call, [#PID<0.1278.0>, {:swarm, :begin_handoff}, 5000]}}

On scale down

Any remaining node is considered the source of truth. We probably should investigate if there is the possibility of losing information in such a case.

quantum-nodes's People

Contributors

idabmat avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.