holy-lambda

steveb8n 2022-12-07T00:24:33.558019Z

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…

Karol Wójcik 2022-12-10T11:05:45.183079Z

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

steveb8n 2022-12-10T11:17:12.614799Z

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

steveb8n 2022-12-10T11:17:50.219019Z

HL main benefit was start time

steveb8n 2022-12-10T11:18:31.100299Z

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

steveb8n 2022-12-07T00:24:59.156769Z

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

steveb8n 2022-12-07T00:25:15.911639Z

Lambada is pretty old. is there something more recent?

steveb8n 2022-12-07T00:26:36.676889Z

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

steveb8n 2022-12-07T02:03:53.870829Z

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

Karol Wójcik 2022-12-07T09:28:34.987319Z

HL also supports jar deployments

Karol Wójcik 2022-12-07T09:29:33.050259Z

https://github.com/FieryCod/holy-lambda-on-java-17

Karol Wójcik 2022-12-07T09:29:49.720529Z

But yeah it requires a custom layer for it

steveb8n 2022-12-07T10:12:41.064809Z

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

Karol Wójcik 2022-12-09T09:42:21.923589Z

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?

steveb8n 2022-12-09T09:45:09.725839Z

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

steveb8n 2022-12-09T09:45:54.830759Z

Did you mean to ask a question?

steveb8n 2022-12-09T05:48:00.315559Z

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

steveb8n 2022-12-09T05:48:21.629039Z

using lambada for entrypoint

steveb8n 2022-12-09T05:48:30.710439Z

using tools.build for uberjar

steveb8n 2022-12-09T05:48:51.371339Z

using aws http api gateway to invoke it

steveb8n 2022-12-09T05:49:07.556789Z

gateway integration uses an alias -> version

steveb8n 2022-12-09T05:49:52.895389Z

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

steveb8n 2022-12-09T05:52:04.708389Z

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

steveb8n 2022-12-09T05:53:45.351809Z

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

steveb8n 2022-12-09T05:54:37.271779Z

subsequent requests are 5ms billed

steveb8n 2022-12-09T05:55:54.338279Z

when it sleeps, restore time is consistently < 300ms

steveb8n 2022-12-09T05:56:23.993309Z

looks very good

steveb8n 2022-12-09T05:57:29.852539Z

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)

steveb8n 2022-12-09T05:57:54.170749Z

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

steveb8n 2022-12-09T06:00:05.021929Z

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

steveb8n 2022-12-09T06:00:44.791799Z

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

steveb8n 2022-12-09T06:01:08.229079Z

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