Is there a feature for setting Min/Max/Fixed function/action replica in Openwhisk?

Viewed 238

I have an Openwhisk setup on Kubernetes using [1]. For some study purpose, I want to have a fixed number of replicas/pods for each action that I deploy, essentially disabling the auto-scaling feature.

Similar facility exists for OpenFaas [2], where during deployment of a function, we can configure the system to have N function replicas at all times. These N function replicas (or pods) for the given function will always be present.

I assume this can be configured somewhere while deploying an action, but being a beginner in OpenWhisk, I could not find a way to do this. Is there a specific configuration that I need to change?

What can I do to achieve this in Openwhisk? Thanks :)

  1. https://github.com/apache/openwhisk-deploy-kube
  2. https://docs.openfaas.com/architecture/autoscaling/#minmax-replicas
1 Answers

OpenWhisk serverless functions follow closer to AWS lambda. You don’t set the number of replicas. OpenWhisk uses various heuristics and can specialize a container in milliseconds and so elasticity on demand is more practical than kube based solutions. There is no mechanism in the system today to set minimums or maximums. A function gets to scale proportional to the resources available in the system and when that capacity is maxed out, requests will queue.

Note that while AWS allows one to set the max concurrency, this isn’t the same as what you’re asking for, which is a fixed number of pre-provisioned resources.

Update to answer your two questions specifically:

Is there a specific configuration that I need to change?

There isn’t. This feature isn’t available at user level or deployment time.

What can I do to achieve this in Openwhisk?

You can modify the implementation in several ways to achieve what you’re after. For example, one model is to extend the stem-cell pool for specific users or functions. If you were interested in doing something like this, the project Apache dev list is a great place to discuss this idea.

Related