Lambda scaling
==============
Lambda provides several scaling mechanism.
Lambda usage in a specific kubernetes nodes
-------------------------------------------
Lambda can be used in a specific kubernetes nodes. It's a mechanism for sharing resources in a cluster.
For detail information see `nodes description `_.
For support this mechanism lambda provides kubernetes `node selector `_ mechanism.
See `pod configuration example `_.
To create a lambda with specific nodes, use the `selector` field in the `deploy_parameters` on the `create lambda <./_static/api.html#operation/createLambda>`_ endpoint.
Lambda can be recreated with 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 empty dictionary. If `selector` isn't defined, the lambda will be created on any node.
Every label has constraints:
    Label key may have two segments an optional prefix and required name, separated by a slash `/`:
    - the name segment is required and must be 63 characters or less
    - the name segment must beginning and ending with an alphanumeric character `[a-z0-9A-Z]`
    - the name segment may contains 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 could contain dashes `-`, underscores `_`, dots `.`, and alphanumerics between.
For more information about label constraints see `syntax and character set `_.
Lambda replication mechanism usage
----------------------------------
Lambda service provides a kubernetes replication mechanism. This mechanism guarantees the availability of a specified number of identical pods.
For more details see how `replica set `_ works.
It is possible to set replicas count for 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 `Kubernetes documentation `_
for more information about deployment replicas.
Lambda workers usage
--------------------
Lambda provides 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 the `parameters` on 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.