holy-lambda 2022-12-07

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…

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

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

HL main benefit was start time

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

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

Lambada is pretty old. is there something more recent?

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

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

HL also supports jar deployments

But yeah it requires a custom layer for it

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

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?

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

Did you mean to ask a question?

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

using lambada for entrypoint

using tools.build for uberjar

using aws http api gateway to invoke it

gateway integration uses an alias -> version

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

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

2022-12-09T16:46:52.123+11:00 RESTORE_START Runtime Version: java:11.v15 Runtime Version ARN: arn:aws:lambda:ap-southeast-2:runtime0a25e3e7a1cc9ce404bc435eeb2ad358d8fa64338e618d0c224fe509403583ca 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

subsequent requests are 5ms billed

when it sleeps, restore time is consistently < 300ms

looks very good

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)

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

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

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

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