|
1 | 1 | --- |
2 | 2 | title: Runtimes |
3 | | -description: List of OpenServerless' supported runtimes |
| 3 | +description: |
4 | 4 | #weight: 60 |
5 | 5 | draft: false |
6 | 6 | --- |
7 | 7 |
|
8 | | -## Supported Runtimes |
9 | | -This document is still 🚧 **work in progress** 🚧 |
| 8 | +# Apache OpenServerless (OPS) Runtimes Explained |
10 | 9 |
|
11 | | -The programming languages currently directly supported by OpenServerless are: |
| 10 | +Apache OpenServerless (OPS) is a serverless platform built on Apache OpenWhisk, designed to execute functions in a scalable, event-driven environment. OPS leverages OpenWhisk's runtime model while extending its capabilities to support additional customization via Docker. |
12 | 11 |
|
13 | | -- [🚧 Node](actions-nodejs) |
| 12 | +--- |
| 13 | + |
| 14 | +## Overview of OPS Runtimes |
| 15 | + |
| 16 | +A **runtime** in OPS is a preconfigured environment that executes a serverless function. |
| 17 | +Since serverless platforms allocate compute resources dynamically, a runtime ensures: |
| 18 | + |
| 19 | +1. **Portability** – Developers can write code in different languages without managing dependencies. |
| 20 | +2. **Scalability** – The system provisions and scales runtimes automatically based on demand. |
| 21 | +3. **Isolation** – Each Action runs within its own dedicated runtime environment, ensuring security and consistency. |
| 22 | +4. **Resource Efficiency** – The platform optimizes resource allocation by suspending inactive runtimes and reusing active ones when possible. |
| 23 | + |
| 24 | +OPS natively supports the following runtimes: |
| 25 | +- **Python** |
| 26 | +- **Node.js** |
| 27 | +- **PHP** |
| 28 | + |
| 29 | +However, since OPS is built on OpenWhisk, it inherits compatibility with all [OpenWhisk-supported runtimes](https://openwhisk.apache.org/documentation.html#runtimes) (e.g., Java, Go) and allows users to define custom runtimes using Docker containers. |
| 30 | + |
| 31 | +For greater flexibility, developers can also package their own runtime environments using Docker to create "black box" actions. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## How OPS Runtimes Work |
| 36 | + |
| 37 | +### 1. Runtime Lifecycle |
| 38 | +OPS follows OpenWhisk's runtime model, where each function invocation occurs in an isolated container. The lifecycle includes: |
| 39 | +1. **Initialization**: A container is provisioned with the selected runtime. |
| 40 | +2. **Execution**: The function code runs within the container. |
| 41 | +3. **Idle**: The container is paused (but retained) for reuse (Warm Start). |
| 42 | +4. **Destroying**: Idle containers are garbage-collected after some time. |
| 43 | + |
| 44 | +### 2. Cold vs. Warm Starts |
| 45 | +- **Cold Start**: A new container is created, increasing latency. |
| 46 | +- **Warm Start**: Reuses a paused container for faster execution. |
| 47 | + |
| 48 | +### 3. Runtime Composition |
| 49 | +Each runtime includes: |
| 50 | +- **Language Interpreter/Compiler**: (e.g., Python 3.12, Node.js 21). |
| 51 | +- **Action Interface**: A proxy that implements a canonical protocol to integrate with the OpenWhisk platform. |
| 52 | +- **Dependencies**: Preinstalled libraries (e.g., `requests` for Python). |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## Actions |
| 57 | + |
| 58 | +**Actions** are the fundamental execution units in Apache OpenServerless. They are stateless functions that run on the OpenWhisk platform. |
| 59 | + |
| 60 | +An action can be used to update a database, respond to an API call, communicate with another system, ecc. |
14 | 61 |
|
15 | | -- [🚧 Python](actions-python) |
| 62 | +To use a function as an action, it must conform to the following: |
16 | 63 |
|
17 | | -- [🚧 Go](actions-go) |
| 64 | +- The function accepts a dictionary as input and produces a dictionary as output. The input and output dictionaries are |
| 65 | +key-value pairs, where the key is a string and the value is any valid JSON value. The dictionaries are |
| 66 | +canonically represented as JSON objects when interfacing to an action via the REST API or the `ops` CLI. |
18 | 67 |
|
19 | | -- [🚧 Java](actions-java) |
| 68 | +- The function must be called `main` or exposed as main |
20 | 69 |
|
21 | | -- [🚧 PHP](actions-php) |
|
0 commit comments