Explore and discover our latest tutorials
Tech Articles from your friends at Oracle and the developer community.
Serverless functions are part of an evolution in cloud computing that has helped free organizations from many of the constraints of managing infrastructure and resources. They enable developers to focus on writing code for event-driven applications that respond to a variety of triggers without worrying about the underlying platform management.
In the past, application architectures were monolithic, tightly integrated systems forming a single, comprehensive application. However, such systems were expensive and difficult to maintain, resulting in numerous cycles spent on development, redeployment, and reintegration. Businesses need to remain agile, responding to both customer and industry needs in a timely fashion. To address some of these concerns, we have seen developers gradually moving from building monolithic applications to using containers and microservices. Microservices were introduced to create isolation and modularity in development, with a suite of code blocks acting in concert to form a single application.
Figure 1. Physical, Virtualization, Cloud Compute, Containers, Serverless
In addition, cloud providers offered a way to free companies from the need to host these applications themselves. Such serverless architecture removed the burden from organizations to manage their own physical or virtual servers, as well as any of the other platform components required for the application to run. With it, businesses were provided the means to quickly adapt to the needs of their customers and allow developers to be free to focus on their code.
Serverless functions are one of the inherent features of serverless computing. These functions offer targeted, on-demand, and single-purpose application functionality that runs only when triggered by preconfigured events and for the time that they’re required. This means that unlike the always-on product model of systems like database servers, you only pay for resources that you consume during function execution and nowhere else.
Figure 2. How do Serverless Functions Works?
As a developer, you create code for your serverless application. The serverless function code is then pushed out to a container registry. An event or a trigger is used to invoke the serverless function. When the event configured for a function occurs, the serverless function image runs as a container and executes the code. The function runs only when it is invoked, and you pay only for the resources and invocation time used by the application.
Additionally, since these serverless functions are often hosted by the cloud provider, the organization doesn’t have to worry about managing deployments or scaling. And self-contained, easier-to-maintain code means that products can be brought to market faster, freeing developers to focus on building and maintaining their applications without the worry of additional overhead. In the end, this translates to huge cost savings since you only pay for the resources that you need, when you need them.
Serverless technology, like others in cloud computing, is not a one-size-fits-all approach. Consideration should always be given to how it will be utilized and whether it is appropriate for your organization.
In general, if you’re workload can be described by one of the following, a serverless approach may be for you:
More specifically, according to the Cloud Native Computing Foundation (CNCF) whitepaper, the top 10 serverless use cases include:
Tasks that can vary in frequency and complexity.
Here, these functions would perform in a fashion like a traditional SQL trigger, except that they can also perform a variety of parallel functions external to the database itself, such as invoking an external service (like sending an email) or updating an additional database.
Scalable tasks that can protect downstream services from sudden and drastic increases in load.
Tasks that require high performance, scalability, and computationally intensive processing, but are part of non-transactional, non-request/response workloads.
Here, functions would read and process messages from an event stream. In many cases, this would require that the data be compared against a set of context objects (e.g., in a NoSQL or in-mem DB) or aggregated and stored in an object or a database system.
Scalable tasks that don’t suffer from non-zero cold start-up times.
People generally expect some delays when engaging in a conversation, so some latency due to processing times or service start-up won’t adversely affect customer perceptions.
Scalable tasks that provide fast, on-demand service and/or quick development cycles when time-to-market is critical.
This use case ties into the core advantages of serverless functions by allowing cloud providers to manage backend tasks while developers focus on providing services that both the customer and organization require.
Functions as a Service (FaaS) is a cloud services platform that allows customers to rapidly build and deploy serverless functions. FaaS allows developers to write code as self-contained functions executed in response to discrete events like image uploads or in-app events. The beauty and utility of the FaaS model are that it provides significant cost savings since these underlying functions are triggered as ephemeral events, naturally scaling on demand, and only using as many resources as are needed at the time. FaaS platforms are offered by most cloud providers and are increasingly being adopted by developers to reduce complexity and increase the velocity of development. Oracle Functions, AWS Lambda, and Microsoft Azure Functions are some of the FaaS offerings commonly being used by developers to build serverless functions.
Oracle provides you with a robust platform to easily develop and deploy serverless applications through Oracle Cloud Infrastructure (OCI), Oracle Functions service. Oracle Functions is a fully managed, multi-tenant, highly scalable, on-demand, FaaS platform. This means that you can get the services and resources you need when you need them.
At its core, Oracle Functions are built on enterprise-grade Oracle Cloud Infrastructure and powered by Fn Project, Docker, and CloudEvents. Fn Project is an Apache 2.0 licensed open-source engine. Fn Project is remarkably flexible. It’s a container-native, serverless platform that can be run anywhere, either in the cloud or on-premises. Fn Project allows you to develop and test a function locally, then deploy it directly to Oracle Functions when you’re ready.
Since the architecture that Oracle Functions relies on is both serverless and scalable, it means that there's no infrastructure or software administration for you to worry about. Oracle Functions simply ensures that your app is highly available, scalable, secure, and monitored, leaving you to focus on delivering the best experience possible. Oracle Functions also allows you to develop in virtually any language (Java, Python, Node, Go, Ruby, or C#), letting you choose what’s best for your application. For more advanced use cases, you can even bring your own Dockerfile. And the icing on the cake is that once you deploy your code and then call it either directly or trigger it in response to specific events, you only get billed for the resources you use on execution.
All these features of Oracle Functions make them an ideal way to enhance the experience of both customers and developers alike. They not only make the deployment of new code quicker and easier to automate, but they also significantly decrease the possibility of downtime during deployment and let your services readily adapt to user demand.
Developing your first function has never been easier. We provide you with multiple paths to the tools you need to get started. You can access Oracle Functions through the Console, CLI, or a REST API. Additionally, you can access the functions you deploy by using the CLI or by making signed HTTP requests.
We realize that security is more important than ever and Oracle Functions is integrated with OCI Identity and Access Management (IAM), providing easy authentication with native Oracle Cloud Infrastructure identity functionality.
To get up and running quickly with Oracle Functions, see the Functions QuickStart Guides and the resources listed below.