SOFIA is a lightweight, Erlang-based framework designed for building scalable, fault-tolerant, and distributed service-oriented systems. Unlike traditional Service-Oriented Architecture (SOA), which relies on centralized Enterprise Service Buses (ESB) and heavy-weight orchestration engines (such as BPMN), SOFIA implements federated peer-to-peer interoperability directly at the actor level.
- Federated Service Registry (
sofia_registry): Fully decentralized service registration and discovery using Erlang process groups (pg). - Stateful Circuit Breaker (
sofia_breaker): Low-latency, Erlang Term Storage (ETS)-backed circuit breaker protecting distributed service calls from cascading failures. - Federated Configuration Sync (
sofia_config): Decoupled, replicated configuration settings synchronized across nodes via lightweight cluster RPCs. - Protocol Gateway (
sofia_gateway): Dynamic protocol bridging translating external sensor/web requests (e.g. JSON maps) into native message tuples. - QoS-Aware & Content-Based Router (
sofia_router): Dynamic, sidecar-less routing that ranks candidate service endpoints lexicographically by stateful circuit breaker states (sofia_breaker), process mailbox queue depths, and historical invocation latencies recorded in Mnesia telemetry spans (sofia_tracer), while supporting caller-defined content-based routing rules. - Data Transformer (
sofia_transformer): Schema mapping and normalization of message parameters directly in client context. - Saga Orchestrator (
sofia_saga): Fault-tolerant distributed transaction coordinator executing rollbacks in reverse order on failure. - Zero Bloat: No centralized broker, no complex workflow orchestration engines, and no SOAP/XML overhead.
SOFIA supports self-describing services, offering a decentralized alternative to traditional Interface Definition Languages (IDLs) like OpenAPI/Swagger or gRPC protocol buffers. Service providers register metadata contracts detailing schemas directly with sofia_registry. Client stubs retrieve these contracts and validate request payloads locally prior to invocation:
sequenceDiagram
participant Developer as Service Provider
participant Registry as sofia_registry
participant Client as Service Consumer
Developer->>Registry: register_service(calc_service, Pid, ContractMap)
Note over Registry: Stores Contract in State
Client->>Registry: get_contract(calc_service)
Registry-->>Client: returns ContractMap
Client->>Client: Validate request schema locally
Client->>Developer: Safe Invocation
To compile the SOFIA application, ensure you have Erlang/OTP 27 and rebar3 installed. Then, run the following command from the root directory:
rebar3 compileSOFIA utilizes EUnit to validate its core modules. Run the test suite using:
rebar3 eunitSOFIA includes a complete quantitative benchmark suite and automated Makefile in usecases/ to evaluate its performance, scalability, and transaction latency against State-of-the-Art (SOTA) middleware layers (Redis, Consul, and HTTP collectors).
For a complete setup guide and convenience runners, see usecases/README.md.
-
Option A: Interactive Erlang Shell
rebar3 shell
1> sofia_bench:run().
-
Option B: Master Reproducibility Suite
./usecases/run_reproducibility_suite.sh
-
Option C: Bare-Metal SOTA Benchmarks (Redis & Consul)
./usecases/run_sota_benchmarks.sh
-
Option D: Convenience Makefile (
usecases/Makefile)cd usecases make check # Runs unit tests, benchmarks, cluster evaluation, and compiles paper PDF make test # Runs EUnit test suite make bench # Runs subsystem micro-benchmarks make cluster # Runs multi-node clustered deployment benchmarks make paper # Compiles IEEE TSC manuscript PDF
For complete walkthroughs and domain integrations, see:
- Tutorial Series (tutorial/index.md): Modular step-by-step instructions on setting up local multi-node clusters, registering services, and implementing patterns.
- Standardized Runnable Use Cases (usecases/): Executable implementations of the five domain-specific federated service use cases demonstrating SOFIA's core capabilities in action.
- Verifiable Use Cases (Usecases.md): Real-world templates for water quality monitoring, industrial carbon tracking, and clinic referrals using SOFIA.