Published on

Why platform teams should consider OpenFAAS for Serverless solutions

Authors
  • avatar
    Name
    Parminder Singh
    Twitter

Platform engineering teams support Engineers and dev teams through building architecture, mentorship, frameworks, technology direction, technology strategy, consulting, standing up new services, building internal applications and infrastructure. It's imperative that platform teams are equipped with a robust toolkit, enabling them to streamline their workflow and deliver services with enhanced efficiency and ease.

Following are some infrastructure related challenges faced by the platform teams.

  • Scalability: Handling dynamic user loads and data volumes without over-provisioning resources.
  • Complexity in Deployment and Management: Managing the lifecycle of a diverse range of applications with varying dependencies and configurations.
  • Cost Management: Balancing performance needs with budget constraints, particularly in resource allocation and maintenance.
  • Integration Hurdles: Ensuring seamless integration with existing systems.
  • Developer Productivity: Providing a framework that boosts developer productivity, allowing them to focus on writing code without worrying about underlying infrastructure.
  • Security and Compliance: Adhering to stringent security standards and regulatory compliance, especially in sensitive sectors.

There's more than one way to crack a nut, but OpenFAAS can be one solid tool in the arsenal that can be used to handle some of these challenges.

OpenFaaS (Functions as a Service) is a versatile serverless framework that makes it easy for developers to deploy event-driven functions and microservices to Kubernetes. It is a portable functions platform that can be used to write functions in any language and package them in containers. Each function is built into an a Docker image and when deployed, creates containers and scales them up or down depending on scaling parameters. There's huge community support as well.

From OpenFAAS Docs

If you have resource limitations or don't have the capacity to manage the complexity of Kubernetes or simply want to try it out, faasd is an excellent deployment option. faasd uses containerd along with the same core OpenFaaS components from the main project and runs on a single host with very modest requirements, making it fast and easy to manage. Writing automation, glue-code, web portals, cron jobs, bots, or webhook receivers are a perfect use case.

Some Notes:

  • Scalability: With OpenFaaS, auto-scaling is effortless. It scales functions on-demand, ensuring efficient resource utilization without manual intervention. You can scale based on capacity, requests per second or CPU. On a per function basis, you can also scale to 0 which can be used with any of the above criteria.
  • Simplified Deployment: OpenFaaS simplifies the deployment process with containerization. You can use REST APIs or faas-cli to deploy functions. faas-cli has a template engine that can be used to create new functions in different programming languages. The openfaas/templates repository lists various templates include NodeJs, Python, Java, C#, etc.
  • Async functions. OpenFAAS enables long-running functions to run in background and allows decoupling the HTTP transaction between the function and the caller.
From async docs
  • Triggers: OpenFAAS ships with HTTP, Async, cron and CLI as supported triggers. OpenFAAS Pro supports Apache Kafka topics, Postgres events, AWS SQS events, etc. There are other community supported triggers as well giving multiple options and integration possibilities.
  • Miroservices: Even though functions are the default use case and have the best support, OpenFAAS can host microservices via custom docker images.
  • Seamless Integration: OpenFaaS offers excellent integration capabilities with existing systems, DevOps CI/CD pipelines and cloud services via REST APIs or CLI.
  • Monitoring: OpenFAAS ships with various components that expose metrics like CPU usage, RAM usage, invocation counter, time consumed per invocation, etc. that can used to monitor the health of functions and services.
  • Open Architecture: The faas-provider can be used to write a custom back-end for OpenFAAS and provides CRUD for functions and an invoke capability. By implementing the required endpoints one can switch to use a custom container orchestrator or back-end system with the existing OpenFaaS ecosystem and tooling. faas-netest (Kubernetes provider) and faasd are official providers. Some community providers are documented here.
From faas-provider doc
  • Enhanced Performance: By deploying functions close to the data source and efficient load balancing, OpenFaaS optimizes latency and throughput.
  • Security and Compliance: OpenFaaS provides robust security features, including automatic TLS, authentication, and easy compliance with organizational policies.

OpenFaaS can be a very useful tool in the arsenal of any platform engineering team allowing them to focus on delivering value rather than being bogged down by the complexities of infrastructure management. OpenFAAS docs are an excellent resource to learn more and get started.

Some example use cases to use OpenFAAS:

  1. Create an endpoint for a WebHook for Teams/Slack notifications. The webhook could contain more fine-grained logic to filter out some of these notifications based on frequency, etc.
  2. Create an endpoint to generate a summary and trending information on code quality statistics created by CI/CD pipelines. This endpoint can be run periodically (via cron provider).
  3. Create staging environment for applications built by DevOps pipelines.
  4. Write an endpoint for VS Code plugin to review code via a custom GPT.

Let me know your thoughts.