Skip to content

Commit e7e47da

Browse files
committed
Add async functions to the docs
Adds section on async / parallel processing to the trouble- shooting guide Adds section to the auto-scaling doc Signed-off-by: Alex Ellis (VMware) <[email protected]>
1 parent 6bf7b68 commit e7e47da

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

docs/architecture/autoscaling.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ Auto-scaling in OpenFaaS allows a function to scale up or down depending on dema
44

55
## Scaling by requests per second
66

7-
OpenFaaS ships with a single auto-scaling rule defined in the configuration for AlertManager. AlertManager reads usage (requests per second) metrics from Prometheus in order to know when to fire an alert to the API Gateway.
7+
OpenFaaS ships with a single auto-scaling rule defined in the mounted configuration file for AlertManager. AlertManager reads usage (requests per second) metrics from Prometheus in order to know when to fire an alert to the API Gateway.
88

99
The API Gateway handles AlertManager alerts through its `/system/alert` route.
1010

1111
The auto-scaling provided by this method can be disabled by either deleting the AlertManager deployment or by scaling the deployment to zero replicas.
1212

1313
The AlertManager rules ([alert.rules](https://github.com/openfaas/faas/blob/master/prometheus/alert.rules.yml)) for Swarm can be viewed here and altered as a configuration map.
1414

15+
All calls made through the gateway whether to a synchronous function `/function/` route or via the asynchronous `/async-function` route count towards this method of auto-scaling.
16+
1517
### Min/max replicas
1618

1719
The minimum (initial) and maximum replica count can be set at deployment time by adding a label to the function.

docs/deployment/troubleshooting.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Troubleshooting guide
22

3+
## Asynchronous functions
4+
5+
Any function can be invoked asynchronously by changing the route on the gateway from `/function/<name>` to `/async-function/<name>`. A `202 Accepted` message will be issued in response to asynchronous calls.
6+
7+
If you would like to receive a value from an asynchronous call you should pass a HTTP header with the URL to be used for the call-back.
8+
9+
```
10+
$ faas invoke figlet --Header "X-Callback-Url=https://request.bin/mybin"
11+
```
12+
13+
Alternatively you can specify another asynchronous or synchronous function to run instead.
14+
15+
* Parallelism
16+
17+
By default there is one queue-worker replica deployed which is set up to run a single task of up to 30 seconds in duration with one task in parallel. You can increase the parallelism by scaling the queue-worker up - i.e. 5 replicas for 5 parallel tasks.
18+
19+
You can tune the values for the number of tasks each queue worker may run in parallel as well as the maximum duration of any asynchronous task that worker processes. Edit the Kubernetes helm chart, YAML or Swarm docker-compose.yml files.
20+
21+
The [OpenFaaS workshop](https://github.com/openfaas/workshop) has more instructions on running tasks asynchronously.
22+
323
## Timeouts
424

525
Default timeouts are configured at the HTTP level and must be set both on the gateway and the function.

0 commit comments

Comments
 (0)