Osiris is a scalable, serverless compute platform that is cloud-agnostic, designed to simplify backend development and eliminate vendor lock-in. Osiris functions are similar to AWS Lambda or Azure Serverless functions but offer a more flexible and developer-friendly approach. This document outlines how Osiris functions are defined, deployed, and executed within the platform.
Osiris functions are defined like regular functions in the developer's chosen programming language. Unlike other serverless platforms that require proprietary function signatures (e.g., AWS Lambda's lambda_handler), Osiris functions are written with standard function names and parameters, returning values directly upon completion.
Example Function Definition (Python):
def add_numbers(a, b):
return a + bExample Function Definition (JavaScript):
function addNumbers(a, b) {
return a + b;
}When a function is deployed to Osiris, it is registered with the platform's gateway/controller. This registration process includes:
- The function's name.
- Expected parameters.
- Metadata necessary for routing and execution.
The gateway/controller maintains a registry of all deployed functions and their states.
To invoke an Osiris function, the calling side utilizes the Osiris SDK. Due to the nature of different programming languages, it is not feasible to entirely mimic native function-call syntax. Instead, the SDK requires the function name as the first argument, followed by the parameters.
Example Function Call (Python with Osiris SDK):
response = osiris.call_function('add_numbers', 3, 5)Example Function Call (JavaScript with Osiris SDK):
osiris.callFunction('addNumbers', 3, 5)
.then(response => console.log(response))
.catch(error => console.error(error));- Function Lookup: The SDK uses the provided function name to look up the corresponding function in the Osiris registry.
- Argument Serialization: The arguments are serialized into JSON format.
- API Call: The SDK makes a RESTful API call (potentially using GraphQL or gRPC) to the Osiris gateway/controller, passing the serialized arguments.
- Request Handling: The gateway/controller receives the API call, deserializes the arguments, and identifies the target function.
- Routing: The gateway/controller routes the request to the appropriate server running the function. If no instance is available, it decides whether to queue the request, start a new instance, or both.
- State Monitoring: The gateway/controller monitors the running state of all functions, managing instances based on demand. It queues requests when necessary and performs cold starts for new instances.
- Load Management: It also shuts down instances that are idle to optimize resource usage.
- Request Reception: The server hosting the function has an Osiris client that receives the request from the gateway/controller.
- Argument Deserialization: The Osiris client deserializes the JSON arguments.
- Function Invocation: The function is called with the deserialized arguments.
- Response Serialization: The function’s return value is serialized into JSON format.
- Response Delivery: The Osiris client sends the serialized response back to the gateway/controller.
- Response Reception: The gateway/controller receives the response from the server.
- Response Serialization: The response is serialized and sent back to the SDK.
- SDK Response Handling: The SDK deserializes the response and provides it to the calling code.
The Osiris platform enables developers to write backend functions in their preferred programming language without conforming to proprietary signatures. The platform uses an SDK on the calling side to handle function invocation, serialization, and API calls. The gateway/controller manages routing, state monitoring, load balancing, and scaling. This approach ensures a seamless, cloud-agnostic serverless experience, abstracting away infrastructure complexities and focusing on developer productivity.