Skip to content

Commit fdb9979

Browse files
committed
Add timeouts tutorial
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 3d72f9c commit fdb9979

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Expanded timeouts
2+
3+
In this tutorial you'll learn how to expand the default timeouts of OpenFaaS to run your functions for longer.
4+
5+
## Part 1 - the core components
6+
7+
When installing with Kubernetes, you need to set various timeout values for the distributed components of the OpenFaaS control plane.
8+
9+
These options are explained in the [helm chart README](https://github.com/openfaas/faas-netes/tree/master/chart/openfaas). The easiest option for new users is to set them all to the same value.
10+
11+
We will set:
12+
13+
* `gateway.upstreamTimeout`
14+
* `gateway.writeTimeout`
15+
* `gateway.readTimeout`
16+
* `faasnetes.writeTimeout`
17+
* `faasnetes.readTimeout`
18+
19+
For async tasks, also set:
20+
21+
* `queueWorker.ackWait`
22+
23+
All timeouts are to be specified in Golang duration format i.e. `1m` or `12s`, or `1m12s`.
24+
25+
```bash
26+
export TIMEOUT=2m
27+
28+
arkade install openfaas \
29+
--set gateway.upstreamTimeout=$TIMEOUT \
30+
--set gateway.writeTimeout=$TIMEOUT \
31+
--set gateway.readTimeout=$TIMEOUT \
32+
--set faasnetes.writeTimeout=$TIMEOUT \
33+
--set faasnetes.readTimeout=$TIMEOUT \
34+
--set queueWorker.ackWait=$TIMEOUT
35+
```
36+
37+
One installed with these settings, you can invoke functions for up to `2m` synchronously and asynchronously.
38+
39+
## Part 2 - Your function's timeout
40+
41+
Now that OpenFaaS will allow a longer timeout, configure your function.
42+
43+
For classic templates using the classic watchdog, you can follow the workshop: [Lab 8 - Advanced feature - Timeouts](https://github.com/openfaas/workshop/blob/master/lab8.md)
44+
45+
For the newer templates based upon HTTP which use the of-watchdog, adapt the following sample: [go-long: Golang function that runs for a long time](https://github.com/alexellis/go-long)
46+
47+
## Further support
48+
49+
Check the [troubleshooting guide](https://docs.openfaas.com/deployment/troubleshooting/) and work through the exercises above.
50+
51+
For Docker Swarm, simply edit `docker-compose.yml` and redeploy the stack.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ nav:
162162
- Logs Provider: ./architecture/logs-provider.md
163163
- Tutorials:
164164
- Workshop: ./tutorials/workshop.md
165+
- Expanded timeouts: ./tutorials/expanded-timeouts.md
165166
- CLI with Node.js: ./tutorials/CLI-with-node.md
166167
- First Python Function: ./tutorials/first-python-function.md
167168
- Test Drive: ./tutorials/test-drive.md

0 commit comments

Comments
 (0)