Skip to content

Commit

Permalink
Adding details about action/container concurrency feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorlan committed Dec 20, 2018
1 parent 9b33f57 commit e707519
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This guide will give you an overview of Adobe I/O Runtime, explain how it works,
[Guides](guides.md)

* [Creating Actions](guides/creating_actions.md): actions, web actions, invoking and managing, setting params
* [Throughput Tuning](guides/throughput_tuning.md): how to maximize the number of action invocations
* [Securing Web Actions](guides/securing_web_actions.md): learn how to control the access to web actions
* [Creating REST APIs](guides/creating_rest_apis.md): learn to create REST APIs from web actions
* [Using Packages](guides/using_packages.md): Working with packages
Expand Down
1 change: 1 addition & 0 deletions guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Adobe I/O Runtime consists of more than simply deploying individual actions and invoking them directly in the CLI. With Runtime, you can deploy groups of related actions as packages and share them with others; set up actions as webhooks so you can incorporate automatic responses to events in your applications; and access Runtime actions through the API. The following pages guide you through the process:

* [Creating Actions](guides/creating_actions.md): actions, web actions, invoking and managing, setting params
* [Throughput Tuning](guides/throughput_tuning.md): how to maximize the number of action invocations
* [Securing Web Actions](guides/securing_web_actions.md): learn how to control the access to web actions
* [Creating REST APIs](guides/creating_rest_apis.md): learn to create REST APIs from web actions
* [Using Packages](guides/using_packages.md): Working with packages
Expand Down
1 change: 1 addition & 0 deletions guides/system_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ When creating actions or debugging issues, it is important to know the system se
| minuteRate (ations)| no more than N actions may be invoked per namespace per minute. If exceded, the error is `429: TOO MANY REQUESTS` | not configurable, per namespace | 600/minute | 600/minute |
| logs | A container is not allowed to write more than N MB to stdout | per action | 10MB | 0MB - 10MB |
| concurrent | No more than N activations may be submitted per namespace either executing or queued for execution. If exceded, the error is `429: TOO MANY REQUESTS` | Not configurable, per namespace | 100 | 100 |
| action/container concurrency | The number of action invocations send to the same container in parallel | per action | 1 | 10.000 |
| codeSize | The maximum size of the action including dependencies, archived | not configurable, per action | 22MB | 0MB - 22MB |
| parameters | The maximum size of the parameters that can be attached | not configurable, per action/package/trigger | 1MB | 0 - 1MB |
| payload | The maximum POST content size plus any carried parameters for an action invocation or trigger firing | not configurable, per action/trigger | 1MB | 0 - 1MB |
Expand Down
20 changes: 20 additions & 0 deletions guides/throughput_tuning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Throughput Tuning

The main instrument you can use for tuning how a given action is executed and enable a higher number of executions for it, is the value you set for the `action/container concurrency`. This value is not related to the concurrent value per namespace or minuteRate value.

The default value is `1` and it means that only one action is invoked into a container at the same time. Suppose that you want to execute 100 times the HelloWorld action, at the same time or in short period of time (seconds/minutes). With the default value (`1`) it means that the system will use up to 100 different containers (some might be reused if the 100 invocations are not overlapping).

If you change the value to `100`, then the system will reuse a single container and execute all 100 invocations in the same container.

There is a second benefit for using a higher number: you get around of the cold-start issue. When the system doesn't have any containers left, it has to create new ones. This cold-start can add lot of latency to your application.

You can set any value between 1 and 10.000. In the example below, the limit is set to `200`:
```
wsk action create actionName fileName.js -c 200
```

Some considerations to keep in mind when you change the default value:
1. Depending on how much memory/resources your action consumes, you can use a smaller or a higher value. A good average number to start with is `500`. You should experiment to make sure the value you choose is working
2. Make sure that your code is working when being executed in parallel. Using global variables to store values that are different between invocations is a recipe for disaster
3. If your Action works on some large data that is not different between invocations, then storring that data in a global variable can maximize the chances that the next execution can reuse it

5 changes: 5 additions & 0 deletions reference/runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ Adobe I/O Runtime supports Node.js version 10. The following npm modules are pre
5. `request` version 2.88.0
6. `request-promise` version 4.2.2

This is how you can specify explicitly this kind:
```
wsk action create actionName fromFile.js --kind nodejs:10 asap
```

We will publish this image on GitHub and Docker Hub.

0 comments on commit e707519

Please sign in to comment.