Skip to content

Commit

Permalink
Merge pull request #55 from velimir/code-load-mode
Browse files Browse the repository at this point in the history
allow specify code loading mode through CODE_LOADING_MODE variable
  • Loading branch information
Evgeny Bob authored Dec 28, 2018
2 parents fcb61ae + 9a56bfc commit ffaca4f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,28 @@ Current testing has shown that it does not make sense to run Erlang
on AWS Lambda functions with less then 256MB RAM.
Having 512-1024MB is optimal for most of the use cases.

### Configuration

#### Code loading mode

Depending on a use case, erlang [code loading mode](http://erlang.org/doc/man/code.html)
[can](https://github.com/alertlogic/erllambda/issues/46) significantly affect execution performance.

To switch between `interactive` or `embedded` modes set `CODE_LOADING_MODE` environment variable on
AWS Lambda function creation step with a desired value:

<pre>
aws --profile default --region &lt;region&gt; \
lambda create-function \
--function-name &lt;your_function&gt; \
--memory-size 1024 \
--handler &lt;your_function_module_name&gt; \
--zip-file fileb://_build/prod/&lt;your_function&gt;-0.0.0.zip \
<b>--environment "Variables={CODE_LOADING_MODE=interactive}"</b>
--runtime provided \
--role &lt;role-arn&gt;
</pre>

### Basic Deployment

See [Erllambda Example](https://github.com/alertlogic/erllambda_example) for the step-by-step procedure to deploy your Lambda.
Expand Down
3 changes: 2 additions & 1 deletion priv/erlang-start
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export NATIVELIB_DIR=${ERTS_LIB_DIR}
export REL_NAME="$(basename $SCRIPT)"
PROGNAME=appmod;
export ERL_CRASH_DUMP="/dev/null"
CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"

replace_os_vars() {
awk '{
Expand Down Expand Up @@ -61,7 +62,7 @@ ARGS="$@"

set -- "$ERTS_DIR/bin/erlexec" -noshell -noinput -Bd \
-boot "$REL_DIR/$REL_NAME" \
-mode embedded \
-mode "$CODE_LOADING_MODE" \
-boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
-config "$CONFIG_PATH" \
-args_file "$VMARGS_PATH"
Expand Down

0 comments on commit ffaca4f

Please sign in to comment.