Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lionralfs/scala-graalvm-lambda
https://github.com/lionralfs/scala-graalvm-lambda
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lionralfs/scala-graalvm-lambda
- Owner: lionralfs
- Created: 2022-12-30T22:39:22.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-05T18:14:20.000Z (about 1 year ago)
- Last Synced: 2023-11-05T19:25:01.388Z (about 1 year ago)
- Language: Scala
- Size: 220 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
my attempt at setting up a lambda that is written in scala but uses graalvm to create a single, static binary + a custom
aws runtime (see [`Bootstrap.scala`](./src/main/scala/example/Bootstrap.scala))1. create a bucket to store the lambda code
2. run `./deployment/deploy.sh `
3. wait
4. go into the aws console and invoke the function via the `Test` tab### Results
(not scientific at all, first row is non-coldstarts, second row are the coldstarts, in milliseconds):
![Results](./results.png)
Loadtest:
```sh
npx artillery quick --count 20 --num 1000
```Query:
```
filter @type = "REPORT"
| parse @log /\d+:\/aws\/lambda\/(?.*)/
| stats
count(*) as invocations,
pct(@duration+coalesce(@initDuration,0), 0) as p0,
pct(@duration+coalesce(@initDuration,0), 25) as p25,
pct(@duration+coalesce(@initDuration,0), 50) as p50,
pct(@duration+coalesce(@initDuration,0), 75) as p75,
pct(@duration+coalesce(@initDuration,0), 90) as p90,
pct(@duration+coalesce(@initDuration,0), 95) as p95,
pct(@duration+coalesce(@initDuration,0), 99) as p99,
pct(@duration+coalesce(@initDuration,0), 100) as p100
group by function, ispresent(@initDuration) as coldstart
| sort by coldstart, function
```### for local testing
1. `./deployment/build.sh`
2. `docker build -t docker-lambda .`
3. `docker run -p 9000:8080 docker-lambda:latest`
4. Send a test event: `curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d 'Hello world!'`### Resources
- https://github.com/andthearchitect/aws-lambda-java-runtime
- https://docs.aws.amazon.com/lambda/latest/dg/images-test.html
- https://github.com/aws/aws-lambda-runtime-interface-emulator/
- https://towardsdatascience.com/aws-lambda-with-custom-docker-images-as-runtime-9645b7baeb6f
- https://aripalo.com/blog/2020/aws-lambda-container-image-support/
- https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html
- https://aws.amazon.com/blogs/compute/build-a-custom-java-runtime-for-aws-lambda/
- https://www.formkiq.com/blog/tutorials/aws-lambda-graalvm/
- https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime