Giter Club home page Giter Club logo

restfulswarm's Introduction

RESTfulSwarm

An environment for core simulation based on Docker Swarm

Swarm

  • Ubuntu 16.04
  • Python 3
  • Docker >=17.12 (with experimental feature)
  • CRIU
  • Flask
  • ZeroMQ
  • Swagger
  • MongoDB
  • NFS
# configure SC/FE/JM
./dependences.sh

# configure GM
./dependences.sh GM

# configure Worker
./dependences.sh Worker

# configure DB
# example: ./dependences.sh DB myusr mypwd mydb
./dependences.sh DB $usr $pwd $db $address

Notion

  • Actor:Main components in the skeleton

    1. FE: FrontEnd
    2. JM: JobManager
    3. GM: GlobalManager
    4. DC: Discovery
  • Job: A list of containers with same network

    1. Job name format: 'job'Submit_time-session_id

      example: job1533585500968-1533585495

  • Task: Container in Docker

    1. Task name format: jobname_task

      example: job1533585500968-1533585495_task1

  • Session:

    1. ManagementEngine launch the system once
  • Job Definition(sample):

     {
        "job_name": "job1533585500968-1533585495",
        "job_info": {
          "network": {
            "name": "RESTfulSwarmNetwork",
            "driver": "overlay",
            "subnet": "129.59.0.0/16"
          },
          "tasks": {
            "job1533585500968-1533585495_task1": {
              "container_name": "job1533585500968-1533585495_task1",
              "node": "",
              "image": "image_name",
              "detach": true,
              "command": "",
              "req_cores": 2,
              "cpuset_cpus": "",
              "mem_limit": "10m",
              "ports": {"3000/tcp": 3000},
              "volumes": {},
              "environment": {},
              "status": "Ready"
            }
          }
        },
        "status": "Ready",
        "start_time": 0,
        "end_time": 0
     }  
  • Define arguments for actors(required arguments for running actor script):

     {
        "FE": {
            "address": "129.0.0.1"
        },
        "JM": {
            "address": "129.0.0.2",
            "wait_time": 0.1,
            "scheduling_strategy": {
              "best-fit": 1,
              "first-fit": 0,
              "first-fit-decreasing": 0,
              "best-fit-decreasing": 0,
              "no-scheduler": 0
            }
        },
        "GM": {
            "address": "129.0.0.3"
        },
        "DC": {
            "address": "129.0.0.4"
        }
     }
  • Start System in Experimental mode (FE, JM, GM and DC are in same node):

    1. Start ManagementEngine
      python3 Management.py
    2. Start worker
       # frequency: time interval of sending containers status to DC
       python3 Worker.py $frequency

Architecture

Architecture

SC--StressClient (Job# vs. Time)

  • Role: Generate test data and feed data into the system
  • SC types:
    1. Steady Stress Client
      • F(t) = a, a is steady constant
    2. Bursty Stress Client
      • Exponential distribution, with configurable constant lambda
    3. Incremental Stress Client
      • F(t) = at + b, a and b are constant
    4. Random Stress Client
      • F(t) = a, a is random constant

FE--FrontEnd (RESTful)

  • Role: Receive data from Stress Client and initialize Job collection in MongoDB
  • Swagger Interface

FrontEnd

JM--JobManager

  • Role:

    1. Send RESTful call to GM
    2. Apply scheduling strategy on requested & free resources to get scheduling and waiting decision
    3. Maintain a job queue to buffer waiting jobs
    4. Update MongoDB when job info changed
  • Provided Functions:

    1. Deploy job (POST)
    2. Deploy single task (POST)
    3. Migrate task (POST)
    4. Migrate job (POST)
    5. Update task (POST)
    6. Checkpoint task (POST)
    7. Remove worker in Swarm mode (GET)
    8. Describe Worker nodes (GET)
    9. Describe GM (GET)
  • Scheduling Strategies

    1. Bin Packing
      • Best Fit
      • First Fit
      • Best Fit Decreasing
      • First Fit Decreasing
    2. Node Scheduling
      • Client specify worker node and cpuset_cpus information
    3. Priority Scheduling (in-progress)
  • Job state chart

JobState

GM--GlobalManager (RESTful)

  • Role:

    1. Notify worker nodes to conduct commands passed from JM
    2. Initialize Swarm environment and play the role of master node
    3. Update MongoDB
    4. Periodically prune unused resources in swarm cluster
    5. NFS master
  • Swagger Interface

GlobalManager

Woker

  • Role:
    1. Worker node in Swarm mode
    2. Deploy tasks
    3. Periodically collect finished tasks info and notify Discovery to update task status
    4. NFS client

DIS--Discovery

  • Role:
    1. Received notification from Workers to update Job and tasks status

ME--ManagementEngine

  • Role:
    1. Launch SC, FE, JM, GM, DIS, ME as separate processes in one VM/PM
    2. Launch all remote workers using SSH
    3. Terminate processes running in either local machine or remote worker machines

MongoDB Interface

WorkersInfo JobInfo WorkersResourceInfo

Note: StressClient, Discovery, FrontEnd and JobManager have been dockerrized.

restfulswarm's People

Contributors

vuzhuangweikang avatar zhuangweikang avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

trellixvulnteam

restfulswarm's Issues

Installation issue

When i tried to install this simulator on Ubuntu machine it displays so many errors when i run ./dependences.sh file.

pymongo insert doc error

pymongo.errors.ServerSelectionTimeoutError: :27017: [Errno -2] Name or service not known
File "/home/ubuntu/RESTfulSwarm/mongodb_api.py", line 48, in insert_doc
return col.insert_one(data).inserted_id

mongodb version: 3.2.21
pymongo version: 3.2

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.