[ANN] AWS Lambda Julia runtime

Hello all,

I’ve seen the question of using Julia in AWS Lambda come up a few times in the past, but as far as I can see without any definite solution. AWS have built out their Lambda container functionality a bit since then, so I’ve tried to simplify the process of creating Julia docker containers - for use in AWS Lambda - here:

Users can fill in entires in a short-ish config file, write their code into a function.jl file, then use bash scripts to create a local image, test that image, and then push it up to AWS and create a lambda function based on it, when the time comes.

Julia seems to work reasonably well here - cold-start times are not great (about 10 seconds), but from a warm start it is very fast, and not excessively memory-intensive.

For the time being I’ve only tested this on Linux. Any bug reports/issues welcome.

Chris

18 Likes

Very interesting :+1: Thanks for putting this together!

You might want to bring PackageCompiler.jl into the mix to improve the cold-start times. See e.g. @dilumaluthge’s work here: GitHub - JuliaContainerization/SimpleContainerGenerator.jl: Create container images for using Julia packages (especially useful in environments without Internet access)

4 Likes

Thanks, yes - that’s an interesting package - I’m just looking at it and trying to figure out if it would help. At the moment I have the dependencies being precompiled at the stage of creating the docker image - does it offer performance gains beyond that?

Yes, absolutely! PackageCompiler.jl will generate a custom system image for the Julia compiler used in the container which will remove almost all of the start-up latency. Here is a nice example:

1 Like

Chris, this ia really great.
Functions As A Service - remember you heard it here first !

Ok, yes, that seems like quite a dramatic improvement. I’ll look at bringing this in.

1 Like

Much appreciated!

I seem to remember one issue being the size of Julia and its dependencies surpassing some limits imposed by AWS. Is that no longer the case? How did you get around that? Or did Julia get smaller?

I think I posted about those limits. But now see this announcement!
As an aside, I am told that if you have an Alexa then requests to Alexa are handled by lambdas. They eat their own dog food.
Alexa! Integrate this function for me for values of 0 to 2pi

3 Likes

Have you checked this?
https://github.com/tk3369/aws-lambda-container-julia

2 Likes

I think the Lambda container size limit used to be 250mb and has now been raised to 10GB (as of December last year). The images I’m getting are about 500mb so the previous limit would have been a problem.

1 Like

No, which slightly surprises me, because I did a fair bit of googling on this topic.

I just found this work @harris-chris
It looks amazing. :stars:
Like John says, this is the future.

Ubiquitous functions. Callable by URL.
The AWS Step Functions is a primitive implementation of chaining arbitrary functions.
We need latency between functions to move closer to what they are when in the same runtime.

If we could wrap all the owner that is Julia into easily digestible lambdas, it would be easy for other to integrate into systems that have much more developed toolchains for this web world.

But this paradigm of polyglot functions is much bigger than that.
We have ongoing discussions with AWS and have brought this up.

Best wishes and thanks for this Chris
Eric

Thanks for your kind words Eric!

1 Like

This will be even cooler when StaticCompiler.jl is more mature:
https://github.com/tshort/StaticCompiler.jl

it’s had a bunch of work lately

2 Likes

I would love to use this package, but I’m a bit out of my element in setting it up. Currently I’m on step two, creating the local_image, and getting two errors:

collectFormLemmas_package [4ad52ae1-b5e6-4573-96f0-52480c524a03]
...
ERROR: LoadError: ArgumentError: Package collectFormLemmas_package does not have Distributed in its dependencies:```

My code is a script, not a package, but the docs seemed to indicate that that should be fine.  Any help would be very much appreciated.

Hello - yes, a script should be fine. From the error it sounds as though it may be trying to use the Distributed package, eg via using Distributed. If so, you will need to pass dependencies=["Distributed"] to the create_responder function. If you are able to share the script (the easiest way would be to open an issue on the Jot github page: [https://github.com/harris-chris/Jot.jl/issues](https://github.com/harris-chris/Jot.jl/issues`)), then that might be helpful, but I know sometimes these things are proprietary.