Faas: Backlog: User-configureable memory/RAM limits per function

Created on 29 Sep 2017  路  8Comments  路  Source: openfaas/faas

Expected Behaviour


With some back-ends a hard-coded memory limit is needed - we should be able to set this at deployment time by passing additional parameters.

Current Behaviour


Leave unbounded or set a hard-limit

Possible Solution


For DC/OS in particular - memory limits need to be set - so we'd pass additional data in the Create/Deploy endpoint.

Individual providers can opt in or ignore the metadata.

Scope

  • [ ] Kubernetes
  • [ ] Docker Swarm
enhancement hacktoberfest skilintermediate

Most helpful comment

I'll start looking into this.
My suggestion would be to have a structure like this:

resources:
    limits:
        cpus: '0.001'
        memory: 50M
    reservations:
        cpus: '0.0001'
        memory: 20M

that will be propagated from the faas-cli, read from the myfunctions.yml or from a commandline arguments: --limit-cpu, --limit-memory, --reserve-cpu, --reserve-memory.
Then we can have implementations in the gateway for different backends.

If no one objects on this, I'll start working on it...

All 8 comments

I'll start looking into this.
My suggestion would be to have a structure like this:

resources:
    limits:
        cpus: '0.001'
        memory: 50M
    reservations:
        cpus: '0.0001'
        memory: 20M

that will be propagated from the faas-cli, read from the myfunctions.yml or from a commandline arguments: --limit-cpu, --limit-memory, --reserve-cpu, --reserve-memory.
Then we can have implementations in the gateway for different backends.

If no one objects on this, I'll start working on it...

Yes!! I really want this feature. Can you advise us how to achieve this in faas-cli or faas-netes?

Currently I want to hard-code the limitation for memory. But I have no useful clue to set it. Currently I found deploy handler may is the correct place to set it. But what variable a response for the resource limited?

@nenadilic84 are these both compatible with the notions of reservations and limits in Docker Swarm and Kubernetes? If so then please go ahead and start with the YAML only (not the CLI) so we can get to done and start testing.

CC/ @realbot would this work for you too?

@alexellis @nenadilic84 Yes!

Would you like to collaborate with @nenadilic84 on Slack since you are both there and interested in seeing this happen?

@nenadilic84 let's talk about that on slack

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexellis picture alexellis  路  7Comments

ndarilek picture ndarilek  路  3Comments

alexellis picture alexellis  路  6Comments

VenkateshSrini picture VenkateshSrini  路  7Comments

hotjunfeng picture hotjunfeng  路  5Comments