gianarb / orbiter

Orbiter is an opensource docker swarm autoscaler
Apache License 2.0
505 stars 54 forks source link

Any additional configuration required to make Orbiter autoscale? #62

Open jchariot opened 3 years ago

jchariot commented 3 years ago

This is my first time using Orbiter. Currently, I got this swarmtest.yml :

version: '3.7'

networks:
  my_docker_network:

services:
  orbiter:
    image: gianarb/orbiter
    command: /bin/orbiter daemon --debug
    ports:
      - 8000:8000
    volumes:
      - /var/run/docker.sock:/var/run/docker.dock
    deploy:
      placement:
        constraints:
          - node.role == manager
      mode: replicated
      replicas: 1
  web:
    image: nginx:alpine
    ports:
      - "0.0.0.0:80:80"
      - "0.0.0.0:443:443"
    volumes:
      - ./web:/var/www/web
    networks:
      - my_docker_network
    deploy:
      labels:
        - "orbiter=true"
      replicas: 1
  phpfpm:
    image: php:7.3-fpm-alpine3.9
    volumes:
      - ./web:/var/www/web
    networks:
      - my_docker_network
    deploy:
      labels:
        - "orbiter=true"
      replicas: 1

which I runs with: docker stack deploy -c swarmtest.yml myswarm

I see from docker service ls that they all came up:

$ docker service ls
ID             NAME              MODE         REPLICAS   IMAGE                    PORTS
fv0c3eea5g2n   myswarm_orbiter   replicated   1/1        gianarb/orbiter:latest   *:8000->8000/tcp
ez3r46p6l297   myswarm_phpfpm    replicated   1/1        php:7.3-fpm-alpine3.9
ne5fkzualf1x   myswarm_web       replicated   1/1        nginx:alpine             *:80->80/tcp, *:443->443/tcp

However, when I do a load test using wrk . I see the CPU of the server goes up but the apps never scale up and they always stay at 1 replica no matter what.

Additionally, does this look right?:

$ curl -v -X GET http://127.0.0.1:8000/v1/orbiter/autoscaler
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)
> GET /v1/orbiter/autoscaler HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 29 Jul 2021 14:55:37 GMT
< Content-Length: 11
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host 127.0.0.1 left intact
{"data":[]}

What are other things that I must do in order to make Orbiter autoscale?

dazinator commented 3 years ago

I have only just stumbled accross this project but I think the idea might be that orbitor provides a convenient web api to allow you to trigger the scale up or scale back down operation, it doesnt automatically decide to do the scaling on it's own. It mentions custom labels (in the Readme) that you must add against each service so that it can tell how many instances should be scaled up or down to, when you trigger the scale up or scale down operation by calling its api. If my assumptions are correct, you would need some other way to monitor performance of your services and then call the orbiter api with "up" or "down" to trigger the actual scale operation based on your own decision point / evaluation of your metrics.