You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/localstack/configuration.md
+1
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,7 @@ This section covers configuration values that are specific to AWS services.
99
99
||`docker` (default) | Run each function invocation in a separate Docker container. |
100
100
||`local` (fallback) | Run Lambda functions in a temporary directory on the local machine. |
101
101
||`docker-reuse`| Create one Docker container per function and reuse it across invocations. |
102
+
|`LAMBDA_STAY_OPEN_MODE`|`1` (default) | Usage of the [stay-open mode]({{< ref "lambda-executors#stay-open-mode" >}}) of Lambda containers. Only applicable if `LAMBDA_EXECUTOR=docker-reuse`. |
102
103
|`LAMBDA_REMOTE_DOCKER`|| determines whether Lambda code is copied or mounted into containers |
103
104
||`true` (default) | your Lambda function definitions will be passed to the container by copying the zip file (potentially slower). It allows for remote execution, where the host and the client are not on the same machine.|
104
105
||`false`| your Lambda function definitions will be passed to the container by mounting a volume (potentially faster). This requires to have the Docker client and the Docker host on the same machine. Also, `HOST_TMP_FOLDER` must be set properly, and a volume mount like `${HOST_TMP_FOLDER}:/tmp/localstack` needs to be configured if you're using docker-compose. |
Copy file name to clipboardExpand all lines: content/en/localstack/lambda-executors.md
+20-1
Original file line number
Diff line number
Diff line change
@@ -45,10 +45,29 @@ A typical invocation of a dummy python lambda can take around 3 seconds from sta
45
45
All supported lambda types can be used with this executor.
46
46
47
47
48
-
### Docker re-use
48
+
### Docker reuse
49
49
50
50
Configuration: `LAMBDA_EXECUTOR=docker-reuse`
51
51
52
+
#### Stay-open mode
53
+
LocalStack allows to use the stay-open mode of its lambda containers.
54
+
The containers stay open and wait for further invocations, without executing the initialization code of the lambda multiple times.
55
+
This results in way faster execution times, especially if the lambda has long-running initialization code.
56
+
57
+
The stay-open mode is the new default method when using `docker-reuse` as lambda executor, however, it has some restrictions:
58
+
59
+
* Only works if LocalStack runs in a Docker container
60
+
* Large Payloads (multiple MBs) do not work
61
+
* Problems with error handling in some runtimes
62
+
63
+
A list of failing tests with this mode can be found [in this GitHub issue](https://github.com/localstack/localstack/pull/5088).
64
+
65
+
66
+
#### Docker-exec execution mode
67
+
This mode is the default if LocalStack is started in host mode.
68
+
If you experience failures using the stay-open mode (either due to the mentioned restrictions or networking problems), you can force this mode by setting `LAMBDA_STAY_OPEN_MODE=0`.
69
+
52
70
This execution mode provides a balance between the speed of a local execution and the feature set and isolation of the `docker` executor.
53
71
While the initial call, which creates the container, will take roughly the same time of `docker` executor, the subsequent invocations will only take around 1 second (start to finish, invoked using the awscli), which roughly the time an actual aws invocation using this method takes.
54
72
The container is kept running 10 minutes after the last invocation for this lambda, then it will be destroyed (and recreated if necessary for the next invocation).
73
+
The complete lambda process is called using `docker-exec` each time of the invocation. While the invocation is still faster than `docker` execution mode, it is not as fast as with the stay-open mode (since the lambda has to be loaded and initialized every time).
0 commit comments