Lambda scaling
==============
Lambda provides several scaling mechanism.
Lambda usage in a specific kubernetes nodes
-------------------------------------------
A lambda can be used in a specific kubernetes nodes. It's a mechanism for sharing resources within a cluster.
For detail information see the `nodes description `_.
To support this mechanism lambda provides kubernetes `node selector `_ mechanism.
See the `pod configuration example `_.
To create a lambda on specific nodes, use the `selector` field in `deploy_parameters` of the `create lambda <./_static/api.html#operation/createLambda>`_ endpoint.
A lambda can be recreated on another node by using `put lambda <./_static/api.html#operation/putLambda>`_ endpoint.
The `selector` provides several node labels:
.. code-block:: json
{
"archive": ...,
"credentials": ...,
"parameters": ...,
"deploy_parameters":
"enable_gpu": ...,
"pod_count": ...,
"namespace": ...,
"selector": {
"node-label-name": "node-label-value",
"node-label-name-two": "node-label-value-two",
...
}
}
By default `selector` value is an empty dictionary. If `selector` isn't defined, the lambda will be created on any node.
Every label has constraints:
A label key may have two segments: an optional prefix and a required name, separated by a slash `/`:
- the name segment is required and must be 63 characters or less
- the name segment must begin and end with an alphanumeric character `[a-z0-9A-Z]`
- the name segment may contain dashes `-`, underscores `_`, dots `.`
- the prefix is optional must be a DNS subdomain: a series of DNS labels separated by dots `.`
- the prefix can't be longer than 253 characters and ends with a slash `/`
- the prefix can't be `kubernetes.io/` or `k8s.io/`, because these prefixes are reserved for Kubernetes core components
Label value constraints:
- the value must be 63 characters or less
- the value can be empty
- if the value isn't empty then must begin and end with an alphanumeric character `[a-z0-9A-Z]`
- the value can contain dashes `-`, underscores `_`, dots `.`, and alphanumerics in between.
For more information about label constraints, see the `syntax and character set `_.
Lambda replication mechanism usage
----------------------------------
The Lambda service provides a kubernetes replication mechanism. This mechanism guarantees the availability of a specified number of identical pods.
For more details, see how a `replica set `_ works.
It is possible to set replicas count for a lambda in `pod_count` parameter in `deploy_parameters`.
By default `pod_count` value is 1.
See `create lambda <./_static/api.html#operation/createLambda>`_ for more details.
Each lambda pod is one replica; see the `Kubernetes documentation `_
for more information about deployment replicas.
Lambda workers usage
--------------------
Lambda provides a mechanism to run several lambda process at the same times.
It is possible to set the count of lambda processes using the `workers` field in `parameters` of the `create lambda <./_static/api.html#operation/createLambda>`_ endpoint.
The count of `workers` can range from 1 to 32. By default `workers` value is 1.