hashicorp / faas-nomad

OpenFaaS plugin for Nomad
https://www.openfaas.com
MIT License
254 stars 46 forks source link

com.openfaas.scale.max and com.openfaas.scale.min have no impact on the minimum and maximum number of replicas #61

Closed hxalid closed 5 years ago

hxalid commented 5 years ago

(Thanks for reporting an issue! Please make sure you click the link above to view the issue guidelines, then fill out the blanks below.)

What are the steps to reproduce this issue?

  1. Deploy OpenFaaS on an existing Nomad cluster
  2. Create and deploy a simple function as
provider:
  name: faas
  gateway: https://openfaas-gateway

functions:
  bcrypt:
    lang: go
    handler: ./bcrypt
    image: "<myregistry>/faas-bcrypt:1.0.0"
    labels:
      datacenters: "dev"
      com.openfaas.scale.min: "2"
      com.openfaas.scale.max: "5"
      com.openfaas.scale.factor: "20"
      com.openfaas.scale.zero: true
    environment:
        read_timeout: 20s
        write_timeout: 20s
        write_debug: true
  1. Load test using some tools, such as Vegeta, to increase the number of replicas.

What happens? It goes up to 20

What were you expecting to happen? It should not go beyond com.openfaas.scale.max, which is 5.

Any logs, error output, etc?

curl -s https://openfaas-gateway/system/function/bcrypt   | jq
{
  "name": "bcrypt",
  "image": "",
  "invocationCount": 0,
  "replicas": 1,
  "envProcess": "",
  "availableReplicas": 1,
  "labels": null,
  "annotations": null
}

curl -s https://openfaas-gateway/system/functions   | jq
[
  {
    "name": "bcrypt",
    "image": "<myregistry>/faas-bcrypt:1.0.0",
    "invocationCount": 10,
    "replicas": 1,
    "envProcess": "",
    "availableReplicas": 0,
    "labels": {
      "com.openfaas.scale.factor": "20",
      "com.openfaas.scale.max": "5",
      "com.openfaas.scale.min": "2",
      "com.openfaas.scale.zero": "true",
      "datacenters": "dev"
    },
    "annotations": null
  }
]

Any other comments?

What versions of software are you using?

Operating System: Ubuntu 16.04

OpenFaaS Version:

"version": {
    "commit_message": "Add OpenFest and IstaCon events in November",
    "sha": "b1d1fe21e0c54611715f8eac611ca98134a342f6",
    "release": "dev"
  }

Nomad Version: … Nomad v0.8.6

nicholasjackson commented 5 years ago

@hxalid I have merged this into master now and built v0.3.5 this is now available on quay in the registry.

Thank you very much for your work on this issue, it is much appreciated.

mabuaisha commented 4 years ago

@nicholasjackson @acornies I'm facing the same issue here, I'm using this openfaas on centos and it seems the scaling is not working here

[centos@serverless-env-bastion warm-starts-scenarios]$ curl -s http://192.168.0.14:8080/system/function/fibfunction | jq
{
  "name": "fibfunction",
  "image": "mabuaisha/fibfunction:latest",
  "invocationCount": 0,
  "replicas": 1,
  "envProcess": "",
  "availableReplicas": 1,
  "labels": {
    "com.openfaas.scale.factor": "20",
    "com.openfaas.scale.max": "5",
    "com.openfaas.scale.min": "3",
    "com.openfaas.scale.zero": "true"
  },
  "annotations": null
}

Since the com.openfaas.scale.min=3 I think the replicas & availableReplicas should match the number 3 not 1, right ?

This is the version of openfaas I'm using

[centos@serverless-env-bastion warm-starts-scenarios]$ curl -s http://192.168.0.14:8080/system/info | jq
{
  "provider": {
    "provider": "",
    "version": {
      "sha": "",
      "release": "0.3.6"
    },
    "orchestration": "nomad"
  },
  "version": {
    "commit_message": "Update swagger for missing secret definitions",
    "sha": "a65df4795bc66147c41161c48bfd4c72f60c7434",
    "release": "0.9.14"
  }
}

Your help is appreciated on this

mabuaisha commented 4 years ago

Should not be the number of initial replicas set to 3 instead of 1, why the initial replicas is set to 1 instead of 3 ?