No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docker-stuff
lib/jar
src
.gitignore
Dockerfile
README.md
how-to-ami.md
pom.xml
run.sh
setup-dependencies.sh

README.md

Docktimizer

Short Description

With the advent of Docker, it became popular to bundle Web applications (apps) and their libraries into lightweight linux containers and offer them to a wide public by deploying them in the cloud. Compared to previous approaches, like deploying apps in cloud-provided virtual machines (VMs), the use of containers allows faster start-up and less overhead. However, having containers inside VMs makes the decision about elastic scaling more flexible but also more complex. Docktimizer makes those decisions based on a sound mathematical optimization problem. Our evaluation of Docktimizer showed that it can reduce the average cost per request by about 20-28%. More details can be found here: http://ssrg.nicta.com.au/publications/nictaabstracts/8901.pdf

Docktimizer implements autoscaling of Docker containers on VMs. In this setting, four dimensions of scaling have to be considered: VMs and containers can be adjusted horizontally (changes in the number of instances) and vertically (changes in the computational resources available to instances). Docktimizer uses mathematical optimization algorithms to make the scaling decisions, but its usage does not require any in-depth knowledge of these algorithms.

License

Copyright 2015 National ICT Australia Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Software Dependencies, Versions and Licenses

Installation

  • setup database
    • create database "dockerplacement";
    • or start a MYSQL Database using Docker:
docker
  run
  --detach
  -v /home/core/datadir:/var/lib/mysql
  --env MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
  --env MYSQL_USER=${MYSQL_USER}
  --env MYSQL_PASSWORD=${MYSQL_PASSWORD}
  --env MYSQL_DATABASE=${MYSQL_DATABASE}
  --name ${MYSQL_CONTAINER_NAME}
  --publish ${MYSQL_PORT}:3306
  mysql:5.7;
  • start the HAPRoxy using Docker:
 docker run --name ha -p 3001:3000
     -p 1936:1936
     -p 8082:8081
     -d bonomat/haproxy-updater
  • If you want to use CPLEX

    • Copy CPLEX library into lib/ AND in src/main/resources/natives
  • build without tests:

mvn clean install -Dmaven.test.skip=true
  • build with tests:
mvn clean install
  • run debug mode
java -jar -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y target/DockerPlacement.jar
  • run normal
 java -jar target/DockerPlacement.jar
  • or use provided run script
./run.sh
  • run with the dockerfile with:
docker run  --name docker
    --link mysql:mysql
    --link ha:ha
    -p 8088:8088 -p 5005:5005  
    -v /home/core/lib:/local/git/lib:ro
    -v /home/core/properties:/local/git/properties  
    -v /home/core/lib/natives:/local/git/src/main/resources/natives:ro
    -it --rm  bonomat/docker-placement bash
  • used variables are
    • DOCKER_PROPERTY_FILE=/path/to/docker-properties, see example: src/main/resources/docker-config/docker-swarm.properties.example

    • OPENSTACK_PROPERTY_FILE/path/to/cloud-properties, see example: src/main/resources/cloud-config/cloud-config.properties.example

    • MYSQL_PROPERTY_FILE=properties/mysql.properties, see example: src/main/resources/mysql-config/mysql.properties.example

    • LOADBALANCER_PROPERTY_FILE=properties/mysql.properties, see example: src/main/resources/ha-proxy/ha-proxy.properties.example

Package Structure

The project contains the following main packages:

  • au.csiro.data61.docktimizer.controller: This package contains the main controllers and has the following classes

    • HAProxyLoadBalancerController: is used to update the HA Proxy
    • JavaDockerController: is used to control the Docker containers on the Backend VMs
    • OpenStackCloudController: is used to control the VM instances, i.e., starting/stoping VMs
    • MysqlDatabaseController: is used for saving/storing data in a mysql database
  • au.csiro.data61.docktimizer.exception:

    • a collection of custom exceptions
  • au.csiro.data61.docktimizer.helper:

    • HAProxyConfigGenerator: is used to generate the HAProxy config file
    • NativeLibraryLoader: is used to load the solver libaries
    • MILPSolver: is used to solve the optimization model, it will either use CPlex or falls back on an open-source solver
  • au.csiro.data61.docktimizer.hibernate:

    • just some helpers for hibernate
  • au.csiro.data61.docktimizer.interfaces:

    • the interfaces for the controller
  • au.csiro.data61.docktimizer.models:

    • models used within the optimization model
  • au.csiro.data61.docktimizer.placement: That's the core package, containing the optimization model itself:

    • DockerPlacement: assemblies the optimization model
    • DockerPlacementService: fills in the data to the model and processes the results
  • au.csiro.data61.docktimizer.service:

    • DockerPlacementRESTApi: contains a RESTful API for controlling the docker placment tool
  • au.csiro.data61.docktimizer.testClient:

    • Contains some test client tools
  • au.csiro.data61.docktimizer:

    • DockerPlacementServer: starts up a HTTP server and publishes the RESTful API