Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set limits for functions faasd + containerd #87

Closed
enkov opened this issue Jun 26, 2020 · 10 comments · Fixed by #108
Closed

How to set limits for functions faasd + containerd #87

enkov opened this issue Jun 26, 2020 · 10 comments · Fixed by #108

Comments

@enkov
Copy link

enkov commented Jun 26, 2020

Hello!
How can I set limits for functions? I tried this

version: 1.0
provider:
  name: openfaas
  gateway: http://127.0.0.1:8080
functions:
  hello-world:
    lang: python3
    handler: ./hello-world
    image: test/hello-world:latest
    limits:
      memory: 1Mi
    requests:
      memory: 1Mi

And this

version: 1.0
provider:
  name: openfaas
  gateway: http://127.0.0.1:8080
functions:
  hello-world:
    lang: python3
    handler: ./hello-world
    image: test/hello-world:latest
    limits:
      memory: 1m
    requests:
      memory: 1m

And it doesn't work.

@alexellis
Copy link
Member

Hi it's not supported at present. A number of features will not be available in faasd.

What's the usecase you have with regards to the limiting and what would you expect to happen if that was exceeded?

@enkov
Copy link
Author

enkov commented Jun 26, 2020

Hello!
I want to limit ram of function and if function exceed it, kill function. I thought it would work like in kubernetes, if limit reached OOM killer kills app.
And if I am right containerd can set limits.
Can You tell will it be available some day?

@alexellis
Copy link
Member

Once killed are you expecting it to be restarted?

What specific workload are you running right now? Also 1MB of RAM isn't that realistic, so I'm wondering if this is a genuine need or more because that's just what you expected? The answer will help us triage the request

@enkov
Copy link
Author

enkov commented Jun 26, 2020

Once killed I expect what function will be restarted and can be called again because there can be different input data.
I want to start users code and want to limit it.
1MB RAM is a test example for testing limits. For the real workload, I will set bigger values for RAM.

@alexellis
Copy link
Member

Ok, got it. What are you specifically wanting to use faasd with at the present time?

@enkov
Copy link
Author

enkov commented Jun 26, 2020

I need a solution that can run in kubernetes and on baremetal. After some research, I found that openfaas is the best solution because it can be deployed on baremetal with faasd.

@alexellis
Copy link
Member

OK I don't think I'm asking correctly or maybe you are not so keen to share - but do you have a use-case, if so what? (languages, usage of it, application, events, other requirements etc?)

@enkov
Copy link
Author

enkov commented Jun 26, 2020

My use case is to let users start their scripts for some calculations.
Data for these scripts will come from different sources(database, queue).
And I don't know how good these scripts work with memory and I want to limit them, so one script will not use all available resources.
Most of the scrips will use python3.

@alexellis
Copy link
Member

Is this a multi-tenant environment then? I would be very careful of using faasd for that, since it has no isolation or way of blocking a container running as root (at present)

You may prefer openfaas on Kubernetes backed by gVisor or Kata containers. You'll also find the requests/limits there.

But, for anyone landing here: we will look into container limits for faasd. Contributions are welcome :-)

@alexellis
Copy link
Member

This code could be of use to us from Michael’s boss project. I can see a way to set a limit, but not sure if “requests” is a containerd or K8s concept. @AkihiroSuda do you know?

https://github.com/crosbymichael/boss/blob/bbbfd63bba42337c0dbfa073a14ac7e8d91bf525/opts/opts.go#L152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants