-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Lambda runtime? #134
Comments
I was wondering if a custom runtime would let us more completely manage resource lifecycles (so that it could run the finalizers when the runtime shuts down, instead of skipping them like it does now). I'm not sure if that's actually supported or not either. |
That's a good idea, that one has bothered me as well. I don't see anything in the custom runtime docs about a shutdown phase, but I did look into this at least a couple times: there is a "Lambda Extensions" API (do you know anything about this?) that does get a shutdown hook:
https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html It's frustrating if the extension has access to this important lifecycle event, that the lambda itself does not. |
Not official by any means, but I found this:
The key words there being current execution. This suggests that until the response is given for the event in hand, that the endpoint will always return the same event (and not the next one). It is also notable that it is a |
I suppose it makes sense, considering how function calls will be retried in the event of an exception. Oh well 🤷♂️ |
So new thoughts on this: now that Scala Native support is slowly rippling through, would be super awesome to have Feral Native. This would necessitate writing our own Lambda runtime. And in fact, said runtime would not have to be specific to Scala Native: it could be pure code that cross-compiles for all three platforms. Deploying a Lambda with a custom runtime is certainly more difficult, but it can also offer several advantages since we'd control all the threads and be able to allocate global resources without doing weird unsafe stuff. This suggests we could benefit from an abstraction that allows the runtime to be swapped out on any platform, e.g. for the AWS JVM runtime or our own runtime. |
Oh dear, I'm repeating myself 😂 #209 (comment) |
I've pushed a branch that shuffles the repo to setup for this. It:
The idea is that:
|
Following from #132, @Baccata points out that AWS offers a similarly low level interface to build a custom Lambda Runtime.
https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html
The advantage of implementing a custom runtime is the capability to process multiple events concurrently, but it's unclear if AWS supports this. On the one hand, polling for incoming events is completely within the lambda's control, and an id is used to pair responses with events so they don't necessarily need to be processed in order. But on the other, there are some strange assumptions such as the use of environment variables to pass around tracing headers, which makes me think this is unsupported behavior.
This should be further investigated.
The text was updated successfully, but these errors were encountered: