Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit c3cf40a

Browse files
committed
Concurrency note added to readme
1 parent 5331c7a commit c3cf40a

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The execution environment where the AWS Lambda function runs is a clone of the A
66

77
With these templates, you can run your AWS Lambda functions **as is** in a Knative powered Kubernetes cluster.
88

9-
The examples below use the [tm](https://github.com/triggermesh/tm/releases/tag/v0.0.7) CLI to interact with Knative but one could also use `kubectl`:
9+
The examples below use the [tm](https://github.com/triggermesh/tm/releases/latest) CLI to interact with Knative but one could also use `kubectl`:
1010

1111
### Docker registry for builds
1212

@@ -16,9 +16,25 @@ builds must be pushed to a Docker registry in order for Kubernetes to be able to
1616
By default `tm` uses [Knative Local Registry](https://github.com/triggermesh/knative-local-registry),
1717
equivalent to adding `--registry-host knative.registry.svc.cluster.local` to the commands below,
1818
so that builds can run without registry authentication.
19-
To override, set `--registry-host` and secrets according to [tm docs](https://github.com/triggermesh/tm#docker-registry).
19+
To override, set `--registry-secret` according to [tm docs](https://github.com/triggermesh/tm#docker-registry).
2020

21-
### Python
21+
### Concurrency
22+
23+
Concurrency in KLR represented by two components: parallel running [bootstrap](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html) processes per container and Knative [container concurrency](https://github.com/knative/serving/blob/master/docs/spec/spec.md#revision) model. By default [AWS runtime interface](https://github.com/triggermesh/aws-custom-runtime) fires up 8 bootstrap processes (functions, in other words) and allows multiple concurrent requests (`containerConcurrency: 0`) to be handled by each container. Default concurrency configuration can be changed on function deployment or update using `tm deploy service` command parameters:
24+
25+
`--concurrency <N>` - sets Knative service `containerConcurrency` value to 5
26+
27+
`--build-argument INVOKER_COUNT=<N>` - passes number of parallel running functions to AWS lambda runtime
28+
29+
Values for these two parameters should be calculated individually for each function and depends on operation characteristics. Knative [autoscaling](https://github.com/knative/docs/blob/master/docs/serving/samples/autoscale-go/README.md) is another important factor that affects service performance, but right now KLR uses default autoscaling configuration.
30+
31+
32+
### Examples
33+
34+
NOTE: all examples below work with [Local Registry](https://github.com/triggermesh/knative-local-registry). If you don't have local registry in knative cluster, you can use external registry as discribed in CLI [documentation](https://github.com/triggermesh/tm#docker-registry)
35+
36+
37+
#### Python
2238

2339
1. Install buildtemplate
2440

@@ -48,7 +64,7 @@ curl python-test.default.dev.triggermesh.io
4864
To use Python 2.7 runtime simply replace version tag in step 1 and 2 with `python-2.7` and `knative-python27-runtime` accordingly.
4965

5066

51-
### Nodejs
67+
#### Nodejs
5268

5369
1. Install node 4.3 buildtemplate
5470

@@ -74,7 +90,7 @@ curl http://node43-test.default.dev.triggermesh.io
7490
{"statusCode":200,"headers":{"Content-Type":"text/html"},"body":"\n <html>\n <style>\n h1 { color: #73757d; }\n </style>\n <body>\n <h1>Landing Page</h1>\n <p>Hey Unknown!</p>\n </body>\n </html>"}
7591
```
7692

77-
### Node 10 with `async` handler
93+
#### Node 10 with `async` handler
7894

7995
1. Prepare function code
8096

@@ -116,7 +132,7 @@ curl http://node-lambda.default.dev.triggermesh.io --data '{"name": "Foo"}'
116132
# {"hello":"Foo"}
117133
```
118134

119-
### Go
135+
#### Go
120136

121137
1. Prepare function code
122138

@@ -172,7 +188,7 @@ curl http://go-lambda.default.dev.triggermesh.io --data '{"Name": "Foo"}'
172188
"Hello Foo!"
173189
```
174190

175-
#### Dependecies
191+
##### Dependecies
176192

177193
To have more control over the go project dependecies, KLR runtime will read and "ensure" `Gopkg.toml` file if it's available in the project's root. Without toml file, only `go get` will be executed before build.
178194
If the project has dependencies stored in a private repository, you can create k8s secret with SSH key that will be used for `git clone` operation:
@@ -182,7 +198,7 @@ cat ~/.ssh/id_rsa | tm set git-auth
182198
```
183199
where `~/.ssh/id_rsa` is a path to SSH private key associated with your git account
184200

185-
### Ruby
201+
#### Ruby
186202

187203
1. Install Ruby 2.5 buildtemplate
188204

0 commit comments

Comments
 (0)