Ultra-fast serverless functions powered by GraalOS

September 20, 2023 | 3 minute read
Rishikesh Palve
Principal Product Manager
Text Size 100%:

At Oracle Cloud World 2023, we announced GraalOS, a new cloud native runtime technology, and our plans to bolster Oracle Cloud Infrastructure (OCI) Functions using this technology. Powered by GraalOS, OCI Functions can enable serverless functions to launch in seconds and use up to 50% less memory for most workloads, as compared to traditional functions. The faster function startup means that the need to enable provisioned concurrency is reduced to ensure low latency invocations. Initially, the acceleration capabilities provided by GraalOS will be available for Java developers, with support for more languages planned in the future.

OCI Functions is a serverless compute service, also known as functions as a service (FaaS), that enables you to create, run, and scale applications in response to events or requests without managing any infrastructure. You pay only for the resources you use. Currently, OCI Functions provides a container-native serverless platform built on the open source Fn Project that packages and runs functions as containers.

One of the main challenges of using traditional serverless functions is slow cold starts. A cold start occurs when a function is invoked for the first time or after a period of inactivity. The new GraalOS-based OCI Functions capability, also called Graal functions, takes an innovative approach to address the problem of slow cold starts. It compiles functions ahead of time into faster and smaller native executables and runs them on a more efficient GraalOS runtime instead of containers. This speed-up boosts the performance of Graal functions with significantly faster startup time and less memory required than Fn-based functions.

What is GraalOS?

GraalOS is a faster and more efficient cloud runtime that takes advantage of the latest processor architectures to deliver higher performance using fewer resources. It uses the advanced GraalVM native image ahead-of-time compilation technology to build an application into a standalone native machine executable, which includes only the code required for runtime processing. It excludes unused classes, methods, and fields from the native executable. These native machine executables are much smaller, start up faster, and use fewer resources than Java applications run on Java virtual machines (JVMs) with just-in-time compilation.

Benefits of serverless functions powered by GraalOS

Ultra-fast cold starts

During a cold start of a function, it takes several seconds or longer to set up the runtime environment, pull the function image and start it. If the function is developed in Java, JVM startup time adds to the cold start latency. To avoid slow cold starts, you can enable provisioned concurrency to ensure that a runtime environment is available for a specified number of concurrent invocations. However, using provisioned concurrency, you incur costs even when your function isn’t running

Graal functions bring the benefits of GraalVM ahead-of-time compilation to serverless functions. Graal functions are compiled into standalone native executables that start up instantly, compared to Fn-based Java functions that execute on a JVM inside a container. The native executables are also small, reducing the time required to pull them from a registry. This functionality enables Graal functions to provide consistent, subsecond invocation latency, reducing the need for provisioned concurrency.

Less memory required

Graal functions don’t only start up significantly faster; they also use fewer resources. Graal functions are deployed as native executables that use only a fraction of memory and CPU resources required by a JVM. For most of the use cases, Graal functions use 50% less memory than Fn-based Java functions executing the same business logic.

Out-of-the-box integration with cloud services

OCI services, such as Events, Connector Hub, Data Integration, API Gateway, and Notifications, provide built-in triggers for OCI Functions. You can use the same triggers to invoke Graal functions. With the built-in triggers, you can use Graal Cloud Native (GCN) to easily integrate cloud services, such as Database, Object Storage, Secrets, and call them from your function. GCN enables developers to quickly write function code and compile them ahead of time into native executables. It provides cloud-agnostic APIs to integrate cloud services into your code without coupling to proprietary cloud provider APIs. Using GCN launcher, you can generate the boilerplate code required to integrate cloud services into your function, eliminating the need to write custom code.

Powered by GraalOS and Graal Cloud Native, all these benefits of OCI Functions make it the best serverless platform for building and running functions.

Try it out soon!

Sign up to be considered for an early access or to be notified when this new capability is released.

Rishikesh Palve

Principal Product Manager

OCI Serverless Containers, Kubernetes, and Functions services.

Previous Post

Hello world! OCI Generative AI is here!

Luis Cabrera-Cordon | 4 min read

Next Post

How Oracle intends to become your most trusted cloud platform

Mahesh Thiagarajan | 6 min read