9 ms·
Show HN: Kubernetes as a back-end for OpenFaaS
- stuartaxelowen 9y agoThis is exciting! Kubernetes is a clear leader, and fits the role of process scheduling for FaaS really well. Excited to see where this goes!
- alexellisuk 9y agoKick the tyres with this intro - https://github.com/alexellis/faas/blob/master/guide/deployment_k8s.md https://github.com/alexellis/faas/blob/master/guide/deployme... and https://blog.alexellis.io/first-faas-python-function/ https://blog.alexellis.io/first-faas-python-function/
- sscarduzio 9y agoThis is my wet dream since lambda came out. But how about performance? What's the "cold" response latency compared to lambda?
- alexellisuk 9y agoOther frameworks listed here have 350ms start time - OpenFaas is a number of times faster. It also depends entirely on the disk storage, RAM generation & speed and CPU. Golang and Python are fastest. I am sure it could be further optimized for a given combination. Tested on a Type 3 Packet Bare Metal host with latest Docker Swarm. Golang sample markdown function - 0.024s / 24ms. The NodeJS example called NodeInfo comes back in around 0.1s / 100ms for a round-trip. A bash built-in (cat) is 0.015s / 15ms. Python is similar to Golang for start time.
- notamy 9y agoSorry for the perhaps silly question, but is this completely cold start for the full round-trip, or is the container "pre-warmed" or something like that?
- jdc0589 9y agoid imagine that could be cold-start time so long as required images were already present on whatever host the job/function got run on.
- cnj 9y agoFor languages on the JVM, having a warmed-up JVM makes a big difference (not only because of the JVM startup, but also because the JIT compiler can work it's magic). Lambda optimizes for this and keeps the JVM around. From this example: https://github.com/alexellis/faas/blob/8ec31d9b89430176c834b2a89985289b2ff62458/sample-functions/BaseFunctions/java/Handler.java https://github.com/alexellis/faas/blob/8ec31d9b89430176c834b... and also from the docs, it looks like the JVM is started for each invocation. When I looked into funktion, it did the same. Do you have any plans to optimize for this use case? It looks like most Open-Source FaaS implementations don't even consider the JVM, so it's really great that OpenFaaS does! I'm planning to play around with it during our next techtime either way, but I'm unfortunately afraid it's too limiting if we have to cold-boot a JVM each time.
- alexellisuk 9y agoJoin us on Slack and let's do some testing and figure it out. Email alex@openfaas.com for an invite.
- alexellisuk 9y agoThe response time for the JVM on modern hardware looked good - similar to Node.js, but last night I tried re-using the forked process in Java and it appears to work very well. That would mean you only pay for the JVM boot once. If you or any other Java users/experts are willing to help test you're most welcome in the community.
- alexellisuk 9y agosscarduzio shoot a mail over to alex@openfaas.com and join us on Slack
- ridruejo 9y agoKubeless is another open source Kubernetes-native serverless implementation. http://kubeless.io/ http://kubeless.io/ http://www.codechannels.com/video/containercamp/bitnami/kubernetes-and-the-rise-of-serverless-angus-lees-bitnami/ http://www.codechannels.com/video/containercamp/bitnami/kube...
- alexellisuk 9y agoKubeless is going to suit you if you only need to run Python or Node.js code. OpenFaaS supports any binary / container for Windows or Linux as a serverless function along with some templates for common languages. This blog post raises some concerns around Kubeless and competition - http://www.devoperandi.com/kubernetes-faas-options-part-1/ http://www.devoperandi.com/kubernetes-faas-options-part-1/
- hardwaresofton 9y agoKubernetes jobs (https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ https://kubernetes.io/docs/concepts/workloads/controllers/jo...) and kubernetes cron jobs (https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ https://kubernetes.io/docs/concepts/workloads/controllers/cr...) make a task like running a fairly robust FaaS infrastructure (this involves things like loadbalancing jobs, tracking state, etc) much simpler -- really excited for a world where people are empowered to create their own clouds rather than get on someone else's. Personal Anecdote: I switched all my personal project infrastructure to use Kubernetes (granted, it's a single node cluster), and went through the process of setting it up myself (no tectonic). The process was difficult but immensely rewarding (I have a super long blog post series incoming about it), and various bits of documentation helped me every step of the way. For the curious, my latest ops iteration was docker-containers-managed-by-systemd-provisioned-by-ansible setup to docker-containers-managed-by-kubernetes-provisioned-by-ansible-on-coreos. I say all that to say that after having personal experience both good and bad with kubernetes, I am thoroughly impressed with it, and have become a huge fan. It is internally consistent with it's principles and concepts, and once you have things set up they mostly just work. When things go wrong (as they do inevitably), the concepts are useful tools and generally hold up, and it's often just a case of finding examples, and giving the documentation a more thorough reading. You can tell when you've learned a truly significant piece of knowledge if you can't stop thinking of all the ways you can apply it. I've had that experience with kubernetes -- just wanted to share, if anyone was on the fence about playing with it.
- alexellisuk 9y agoOpenFaaS is an "open platform" - supporting Docker Swarm, Kubernetes and whatever else you would like to write a back-end for. Kubernetes jobs are a potential back-end for asynchronous processing of functions (only). Right now we're achieving that through a NATS Streaming integration - which is agnostic of the orchestration platform. Checkout the video walk-through for OpenFaaS on K8s.
- philjones88 9y agoCould I get a link to that blog of yours?
- spitcode 9y agoFission is also worth a mention: http://fission.io/ http://fission.io/, I will certainly keep an eye on `faas-netes`
- alexellisuk 9y agoCheckout the beginner tutorial I posted on this story and the CNCF demo / intro video which gives a good tour and overview - https://youtu.be/SwRjPiqpFTk?t=1m8s https://youtu.be/SwRjPiqpFTk?t=1m8s
- soamv 9y agoThanks. Here's the github link for fission: https://github.com/fission/fission https://github.com/fission/fission
- hasenj 9y ago"functions as a service"? Is it what it sounds like? Why?
- alexellisuk 9y agoCan you explain what you mean? If you'd like more intro information checkout - https://blog.alexellis.io/introducing-functions-as-a-service/ https://blog.alexellis.io/introducing-functions-as-a-service...
- hasenj 9y agoI still don't see anything that explicitly distinguish it from "left-pad api" [0] For example: > A serverless function is a small, discrete and reusable chunk of code that: > ... > executes in a few seconds .. Why would you want a function execution to take several seconds? I must be missing something .. [0]: http://left-pad.io/ http://left-pad.io/
- jhgb 9y agoProbably if the function execution time is too small, the overhead isn't worth it? And if it's too large, there's too little granularity? I guess it's the same ideas that guide "ordinary" programming styles, only adjusted to the timings of large networks (milliseconds instead of microseconds).
- alexellisuk 9y agoYou've just cherry-picked a generic industry description of FaaS functions. "Executes within a few seconds as a rule" - otherwise you're not really building an event-driven API, but something else. You can run the code for however long you like and even invoke via async. Left pad adds whitespace to a string? Don't see the connection
- hasenj 9y agoI don't know. I don't think I cherry-picked. The concept sounded ridiculous to me, so I asked for clarification. The article provided for me (which was supposed to introduce the concept to people who haven't heard of it) only seemed to confirm my suspicions. I _must_ be missing something. I mean I probably will still think the idea is unsound, but at least I want to really understand the thinking behind it better before I solidify my negative impression.
- erikb 9y agoI like the idea, but a swarm as app inside k8s? It's like the same technology, right?
- bpicolo 9y agoIt can use either-or, rather than both together
- alexellisuk 9y agoPurely either Swarm or K8s - or if you like write your own back-end for Marathon/Nomad etc.
- lshemesh 9y agoWould be great if this were packaged as a Helm chart.
- mccabe 9y agoMaking a Helm chart available is planned, should subscribe to this issue to get a heads up on when its ready to consume. https://github.com/alexellis/faas-netes/issues/10 https://github.com/alexellis/faas-netes/issues/10
- 0xbadcafebee 9y ago> Function Watchdog > > You can make any Docker image into a serverless function by adding > the Function Watchdog (a tiny Golang HTTP server) > The Function Watchdog is the entrypoint allowing HTTP requests to be > forwarded to the target process via STDIN. The response is sent back to > the caller by writing to STDOUT from your application. Did they actually just reinvent FastCGI ?
- e12e 9y agoI would guess the "handler" is short-lived, in order to maintain agility in updating the "function", so more like CGI than FastCGI?
- zbentley 9y agoFaaS/serverless is very similar to CGI. When talking to new adopters, I describe serverless cynically as an incredibly resource-wasteful rediscovery of CGI using VMs instead of processes; I describe it charitably as a very flexible CGI in which you don't have to think nearly as much about your physical hardware (that runs your webservers) or your platform code (webservers and frameworks, e.g. httpd/wsgi, that need to be configured to provide the right CGI containers/layers) in order to scale. CGI is a very powerful concept whose initial adoption was hindered primarily by a lack of standardization of API interchange formats. It's experiencing a resurgence now, I think, because we've gotten a lot better at API-first design, and also because orchestration layers have gotten a lot better. I feel similarly about Docker/containers: they're basically the rediscovery of static linking, made more popular than it was initially due to the present-day abundance of disk resources and the presence of really easy-to-use-at-scale deployment platforms. Note that I'm not equating static linking/containerization with CGI/serverless in quality. CGI was pretty much universally an improvement over its predecessor. Static linking has and had many flaws, as the Docker crowd is discovering as container-based shops shift into "who built this crazy Dockerfile anyway, and why did they hand-select an ancient version of OpenSSL?!?!" maintenance mode, and ops folks get surprised by the disk, memory, and startup time costs of legacy containerized microservices that turn out (long after their creators move on) to not be so "micro" after all. What's old is new again; the good and the bad.
- alexellisuk 9y ago
- jedberg 9y agoThe FaaS platforms of the three big providers are basically undifferentiated in their feature sets. If anything, the one from Microsoft is the best because it supports more languages. The real differentiator is the ecosystem that it exists within. It is the glue that binds. And in that regard, AWS is the hands down winner. One, because you can do more stuff with your FaaS, and more importantly, it has more triggers than any other platform. It is the list of things that can trigger your functions that truly make a FaaS useful. The problem with self-hosted FaaS is the limited set of triggers, because all the other stuff you run doesn't support triggering the FaaS (yet?). It's a great programming paradigm, but the true value will come when all the other self hosted projects can emit triggers.
- apengwin 9y agoAWS supports the most languages. Azure support for most of the listed languages such as python and php is experimental and not production-ready.
- jedberg 9y agoAt that point it's just a semantics debate. I mean if you include the ability to use shims, then they all support the same languages. But I'd still rather run C# on Azure than anywhere else.