Overview
Faasta is a cutting-edge Function-as-a-Service (FaaS) platform designed for exceptional speed and efficiency. With cold start times under 1ms and a memory overhead of less than 1KB, Faasta delivers unparalleled performance through its modern WebAssembly architecture.
Key features include:
- WebAssembly-powered execution
- WASI P2 and WASIHTTP standards compliance
- Ultra-fast cold starts
- Secure function isolation
- Self-hosting capabilities
WASI P2 and WASIHTTP
Faasta implements the WebAssembly System Interface (WASI) Preview 2 specification and the WASIHTTP standard to enable:
- Standardized HTTP request and response handling
- Component-based architecture for better modularity
- Consistent interface for interacting with the host system
- Portable functions that can run on any WASI P2 compatible runtime
Because Faasta uses these open standards, your functions are not locked to a specific platform and can be hosted anywhere that supports these standards.
Architecture
Faasta's architecture consists of:
- Runtime Engine: Powered by Wasmtime for efficient WebAssembly execution
- API Gateway: Handles routing HTTP requests to the appropriate functions
- Function Store: Manages WebAssembly module storage and retrieval
- Authentication: Secures your functions with GitHub authentication
Writing Functions
Faasta functions are written in Rust and compiled to WebAssembly. Here's a basic example:
use spin_sdk::http::{IntoResponse, Response};
use spin_sdk::http_component;
#[http_component]
fn hello_world(req: http::Request<()>) -> anyhow::Result<impl IntoResponse> {
let name = req.uri().query()
.unwrap_or("")
.split('&')
.find_map(|pair| {
let mut parts = pair.split('=');
if parts.next() == Some("name") {
parts.next()
} else {
None
}
})
.unwrap_or("World");
Ok(Response::builder()
.status(200)
.header("content-type", "text/plain")
.body(format!("Hello, {}!", name))
.build())
}
Self-Hosting
Faasta is fully self-hostable. You can run your own instance of the Faasta server to host your functions on your own infrastructure.
Follow these steps to self-host Faasta:
- Clone the Faasta repository
- Build the server with
cargo build --release
- Configure your server with the provided configuration files
- Start the server with
cargo run --release
- Deploy functions to your self-hosted instance