by gavinray · 5y ago · 0 comments
Does anyone who knows this stuff, know if there is something like Docker, but lightweight (capable of running thousands of processes with couple hundred MB memory) and doesn't require being deployed on bare-metal or an orchestration tool?
I was looking for the equivalent of IE Knative/OpenFaaS, without needing Kubernetes or k3d. Users can write functions/handlers in whatever language, and deploy them on the platform, and the whole thing is either run as something as convenient as a container or a single static binary.
I tried to find something, read up on Firecracker, emailed some people a lot smarter than me. Nothing fitting this bill seemed to exist, so I opted to build my own using GraalVM.
(Which is working, but isn't as flexible about application packaging as a Dockerfile. It imposes some restrictions on how things need to be written to deploy on my platform.)
Just curious if something like this DOES exist and I just didn't manage to find it. Building something yourself is always the worst answer, unless you're smarter than everyone in your field. Or you know something other people don't.
Which I am not/do not.
I guess I could make a Docker image that had a CGI-compliant server and an admin endpoint where you POST'ed file contents?
The current design I went with is that you upload a .zip or .tar.gz file that contains a "manifest.json" and then your source code.
The "manifest.json" points to the entrypoint file for each function you want to deploy, and says what HTTP endpoint it should live at, and what language it is.
It supports JS/TS, Python, Ruby, WASM, and LLVM langs (C/C++/Rust/Swift/Haskell/etc):
{
"version": 1,
"handlers": [
{
"name": "javascript-signup",
"language": "JAVASCRIPT",
"endpoint": "/api/signup",
"entrypoint_file": "src/signup.js"
},
{
"name": "python-login",
"language": "PYTHON",
"endpoint": "/api/login",
"entrypoint_file": "src/login.py"
},
]
}
The platform runs as a single static binary, or a JVM application (can be in a container), and it does a bunch of magic with GraalVM to convert the source code into executable functions, perform any kind of bundling/dependency library installation, etc, and finally creates the HTTP endpoints.I’d say the base is CGI + chroot, and then you grow over this base.
If you want to rebuild AWS Lambda, though, check their documentation on custom runtimes and some “how to make your own docker using cgroups” guides.
Firecracker is used to improve workload/tenant isolation, but if all you’re running is trusted, you might skip this part.
IE, OSv is not something I would put on my $5 Digital Ocean droplet, or use to run a general application. As opposed to something like, a Golang/Rust binary, or a Docker Container. I was looking for something I could give to users to let them self-host this Function-as-a-Service platform. Whether that's locally on their laptop for testing, or running somewhere as a cloud service (but probably as a very cheap one).
When I asked the founder of a container-based startup about whether Firecracker would be useful for a scenario like this replacing Docker, he told me:
"... this confuses me a bit as they are very different things. Firecracker is a hypervisor to run MicroVM's (IE: hardware virtualization)"
But again, I have no clue about this stuff. Hence why I asked---
tl;dr = "Can I put this in a container and give it to people to run?" I guess haha
What is confusing to a lot of people that haven't deployed these things yet is there is no traditional user-land they are familiar (eg: ssh in and run lots of things) with so then the question of 'orchestration' comes up. If you're deploying to the public cloud or your digital ocean instance they are typically deployed as vms and push the orchestration onto the cloud provider of choice that way you don't have to manage networking/storage/etc. It's actually very straight-forward - we can deploy them to AWS in tens of seconds for instance.
Your friend is not incorrect though. If you want to own the "orchestration" layer you'll want/need to put it on bare metal. This is for performance reasons as even nested virtualization is slow and if you are going for the unikernel performance benefit it would get removed.
As for throwing it in a container - technically you can but it's an extra layer that most people wouldn't do in actual practice.
Maybe I ought to do more reading in this area. Based on what you're saying, it sounds like there is a possibility to target them towards this usecase.
Somehow it is kind of ironic to see how the industry goes in circles.
In general public clouds don't play well with unikernels because they can't/won't support microVMs and/or their control plane overhead swamps the boot time benefit. You can always build your own orchestration system on bare metal but then you have an inner platform.
Both https://nanos.org and https://ops.city are Go unikernels running on Google Cloud. (I'm with NanoVMs that is the maintainer of these projects.)
i dont understand, except from a purely market position perspective why 'hypervisor images' and 'containers' are such radically different things.