Julia lang support for Azure Functions
With Julia lang reaching v1.0 last year, it is emerging as a force in machine learning and other scientific computing applications,
In particular, BlackRock's Aladdin, Conning Asset Management, and Aviva are all using Julia for financial risk modeling and I see a great opportunity for Julia to impact finance among other things. I'd love to be able to use Julia in Azure Functions for my fintech startup.
Minor update: it is now possible to create custom function on azure. Though, there are no samples for julia, but only for r and go, it is possible to adapt them for julia. So, it is now possible to build azure serverless with julia.
Here is outline:
Overall process of writing custom azure function described here:
Create Azure Functions on Linux using a custom image | Microsoft Docs?
Here is example (prototype, proof of concept). We create custom image (based on python image, but it probably could be any, lean base image):
COPY context/ .
RUN tar zxvf julia-1.6.0-linux-x86_64.tar.gz
RUN julia -e "using Pkg; Pkg.add(\"Genie\")"
CMD [ "/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost" ]
Now, some simple web server (server.jl):
import Genie.Router: route
import Genie.Renderer.Json: json
const PORT = parse(Int64, get(ENV, "FUNCTIONS_CUSTOMHANDLER_PORT", "8080"))
Genie.config.run_as_server = true
Genie.config.server_port = PORT
(:message => "order at api") |> json
(:message => "just order") |> json
Config files are all default except for host.json, where we need to start julia with our server:
This is all.
Ruben Gonzalez commented
I've actually had a lot of success implementing Julia in Azure though container instances and container app services. You can put Julia in a docker container and deploy it in a lot of places in Azure. Not to mention you can piggyback a lot of Python support on Azure through PyCall.jl.
That being said, there's a lot of potential but a lot of work to be done. Some things you may want to consider
(1) Julia's package ecosystem is growing unusually fast for the actual amount of contributors. It is a very productive language that you can write very good packages in. This isn't a Julia vs Python horse-race, it's a Julia vs C horse-race, because data science done USING python is actually done IN C. I consider being able to write performant packages in Julia instead of C to be an unfair advantage.
(2) There's a growing amount of Machine Learning done in Julia that can't be done in other languages. Physics-based Neural ODEs are becoming a thing, and it's very difficult to implement in other languages. Estimating custom-defined models with learnable parameters is also very difficult to do outside Julia.
(3) Julia's biggest Achilles' heel (startup latency) is being addressed. PackageCompilers.jl make is extremely easy to use Julia in any architecture without startup lag. The upcoming Julia 1.6 release allows for parallel package loading which dramatically reduces installation time when building docker containers.
(4) It supports "Go"-like multi-threading and has a relatively painless way to do distributed computing which makes building performant app services much easier. Integrating it with Azure ML would likely take the tool to the next level.
Learning Julia and Azure have jointly been the best decisions I've made for my career and I consider knowing how to deploy Julia in Azure an unfair advantage. It may be time to help more people actually leverage this amazing combination.
Ritchie, Anthony commented
We have some use-cases for Julia, would be great to see it as part of the functions offering.
OOF, came here hoping to see this has been implemented. Looking forward to the day.
Ruben Gonzalez commented
However, if you have to loop through and traverse massive JSON objects for data analysis purposes; you either have to do it in a programmatically painful way in a compiled language, or in a painfully slow way in a dynamic language. Have you considered using Julia which forms a bridge between the two paradigms? It is a dynamic compiled language that is easily used by data scientists and engineers who are familiar with Python and MATLAB. Its biggest strength is the fact that it is fast and yet dynamic enough to gracefully handle a large number of unusual scenarios that most compiled languages struggle with. To me it would seem to be the ideal language to use in handling streaming data because of how quickly it handles ill-defined scenarios.
Were this implemented I'd probably start using Azure that same day.
Looking to use this functionality as well. Would be very helpful to have Julia as a first class citizen on Azure.