Fork me on GitHub
#holy-lambda
<
2022-12-07
>
steveb8n00:12:33

Q: I’m getting ready to build a jvm lambda to test snapstart. wondering if I should build a raw lambda using :gen-class or use some lib like Lambada etc? seeking suggestions in thread…

steveb8n00:12:59

since HL is designed to wrap a Docker container, I suppose that rules it out

steveb8n00:12:15

Lambada is pretty old. is there something more recent?

steveb8n00:12:36

or is no libs w/ JSON -> CLJ conversion at entrypoint the best. I suspect this is a good/simple option (e.g. no extra deps) but want to consider other options

steveb8n02:12:53

hmm, Lambada is so small,I think I’ll vendor it to get started

Karol Wójcik09:12:34

HL also supports jar deployments

Karol Wójcik09:12:49

But yeah it requires a custom layer for it

steveb8n10:12:41

Good to know. If Lambada adds complexity I'll try the HL option

steveb8n05:12:00

@UJ1339K2B initial signs are good. I have snapstart working with a simple jvm clojure lambda

steveb8n05:12:21

using lambada for entrypoint

steveb8n05:12:30

using tools.build for uberjar

steveb8n05:12:51

using aws http api gateway to invoke it

steveb8n05:12:07

gateway integration uses an alias -> version

steveb8n05:12:52

CI deploy step that creates the version needs to poll/wait since it takes longer for version to create

steveb8n05:12:04

but once version creates, can switch alias and starts < 1 sec with these logs….

steveb8n05:12:45

2022-12-09T16:46:52.123+11:00 RESTORE_START Runtime Version: java:11.v15 Runtime Version ARN: arn:aws:lambda:ap-southeast-2::runtime:0a25e3e7a1cc9ce404bc435eeb2ad358d8fa64338e618d0c224fe509403583ca 2022-12-09T16:46:52.329+11:00 RESTORE_REPORT Restore Duration: 247.55 ms 2022-12-09T16:46:52.335+11:00 START RequestId: afe6be9e-6bab-4655-8664-5c2ab04ec703 Version: 7 2022-12-09T16:46:52.606+11:00 END RequestId: afe6be9e-6bab-4655-8664-5c2ab04ec703 2022-12-09T16:46:52.606+11:00 REPORT RequestId: afe6be9e-6bab-4655-8664-5c2ab04ec703 Duration: 270.71 ms Billed Duration: 388 ms Memory Size: 1024 MB Max Memory Used: 115 MB Restore Duration: 247.55 ms

steveb8n05:12:37

subsequent requests are 5ms billed

steveb8n05:12:54

when it sleeps, restore time is consistently < 300ms

steveb8n05:12:23

looks very good

steveb8n05:12:29

an interesting test would be to benchmark a CPU bound lambda with java vs graal (since java is supposed to be 2x faster once hot code paths are loaded)

steveb8n05:12:54

my lambdas are io bound so doesn’t really affect me

steveb8n06:12:05

I’ll start using aws client lib now to emulate real world use and will report back if anything strange happens

steveb8n06:12:44

Q: does this mean the end of HL or is there still a use-case?

steveb8n06:12:08

I’m a HL fan as you know but removing the build complexity is pretty nice

Karol Wójcik09:12:21

For me it will probably mean it. There is no point of maintaining such complex project if JVM Lambdas are satisfactory. How it compares with HL on GraalVM?

steveb8n09:12:09

I thought that might be true. I guess any fix for a platform will eventually be fixed by the platform itself

steveb8n09:12:54

Did you mean to ask a question?

Karol Wójcik11:12:45

Oh yes. I’m wondering if HL is any better in this example.

steveb8n11:12:12

No better for my use case. JVM clojure means simpler ci builds, more compatible libs and local Dev env more like prod environment

steveb8n11:12:50

HL main benefit was start time

steveb8n11:12:31

Also has less memory requirements so that may still be a reason to use it at high scale