Skip to content

Commit cd2ba21

Browse files
committed
docs: document new resilience, observability, and call features
- Add API documentation for `call()`, load shedding, and introspection methods to `usage.md`. │ │ - Update `architecture.md` with a new section on the Telemetry & Observability Layer. - Update `README.md` Core Capabilities to include the new features. - Update `README.md` to reflect that Node.js support is on hold.
1 parent bb486d7 commit cd2ba21

3 files changed

Lines changed: 61 additions & 10 deletions

File tree

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,26 @@
1717

1818
## Overview
1919

20-
**Iris** is a hybrid distributed runtime built in Rust with first-class **Python** and **Node.js** bindings. It combines three execution styles:
20+
**Iris** is a hybrid distributed runtime built in Rust with first-class **Python** bindings. It combines three execution styles:
2121
- **Actor Mesh:** Stateful, message-driven workflows with high concurrency.
2222
- **Native Offload/JIT:** CPU-heavy hot paths accelerated via Cranelift. This path is experimental, currently paused, and may be dropped in future releases.
23-
- **Cross-Language API:** Service-oriented apps mixing Rust, Python, and Node.js.
23+
- **Cross-Language API:** Service-oriented apps mixing Rust and Python.
2424

2525
Iris uses a **cooperative reduction-based scheduler** for fairness, providing built-in supervision, hot swapping, discovery, and location-transparent messaging across nodes.
2626

2727
> [!NOTE]
28-
> Node.js bindings are currently in Alpha and reaching feature parity with Python.
28+
> Node.js bindings are currently on hold and are not actively developed or supported.
2929
3030
---
3131

3232
## Core Capabilities
3333

3434
- **Hybrid Concurrency:** Mix "Push" green-thread actors with "Pull" OS-thread actors.
35-
- **Atomic Hot-Swap:** Update live application logic (Python/Node) without zero downtime.
35+
- **Atomic Hot-Swap:** Update live application logic (Python) with zero downtime.
3636
- **Global Discovery:** Register and resolve named services locally or over the network.
37-
- **Self-Healing:** Path-scoped supervisors and structured `EXIT` reasons for fault tolerance.
37+
- **Resilience:** Built-in supervision, load shedding, and network-aware exit reasons for self-healing systems.
38+
- **Observability:** Deep runtime introspection, system metrics, and actor health tracking.
39+
- **Async Request/Reply:** Built-in `call()` semantics for ergonomic, awaitable actor communication.
3840
- **Vortex-Transmuter (Experimental):** Instruction-bound preemption, transactional ghosting primitives, and guarded bytecode transmutation with explicit fallback telemetry (see [Vortex-Transmuter Guide](docs/vortex.md)).
3941
- **JIT Acceleration:** Transparently compile Python math functions to native machine code.
4042
- **Quantum Speculation:** Optional multi-variant JIT selection with runtime telemetry, bounded by compile budget and cooldown controls (see [JIT Internals & Configuration](docs/jit.md)).

docs/architecture.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Iris allows updating live application logic without stopping the runtime.
3030
- **State Preservation:** In-flight messages remain in the mailbox; only the "behavior" pointer is swapped.
3131
- **Versioning:** Supports rolling back to previous behavior versions.
3232

33+
## Telemetry & Observability Layer
34+
35+
Iris includes a built-in `TelemetryManager` that provides real-time instrumentation of the actor mesh.
36+
- **Event Stream:** Captures actor life-cycles (`Spawned`, `Stopped`, `Crashed`) and message throughput.
37+
- **Health Tracking:** Tracks actor health status (`Starting`, `Ready`, `Busy`, `Degraded`) for cluster-wide health checks.
38+
- **Mailbox Depth:** Provides visibility into queue depths for identifying bottlenecks.
39+
- **Metrics API:** Aggregated system-wide statistics available via a high-performance concurrent registry.
40+
3341
## Distributed Mesh Protocol
3442

3543
Iris nodes communicate over TCP using a length-prefixed binary protocol.

docs/usage.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ rt.spawn_with_mailbox(mailbox_worker)
8181
## Sending messages
8282

8383
- `send(pid: int, data: bytes-like) -> bool` — send user payload (`bytes`, `bytearray`, `memoryview`) to a PID.
84+
- `call(pid: int, data: bytes-like, timeout: Optional[float] = None) -> Awaitable[bytes]` — send a request and await a response (async).
8485
- `send_many(pid: int, payloads: Iterable[bytes-like]) -> int` — batch-send payloads and return accepted count.
8586
- `send_named(name: str, data: bytes-like) -> bool` — resolve and send by registered name.
8687
- `send_buffer(pid: int, buffer_id: int) -> bool` — zero-copy send via buffer ID (use `allocate_buffer`).
@@ -91,13 +92,53 @@ rt.spawn_with_mailbox(mailbox_worker)
9192
Example:
9293

9394
```python
95+
# Async request-reply
96+
response = await rt.call(pid, b"ping", timeout=2.0)
97+
print("response", response)
98+
9499
timer = rt.send_after(pid, 200, b'tick')
95-
# cancel
96-
rt.cancel_timer(timer)
100+
```
101+
102+
---
103+
104+
## Observability & Introspection
105+
106+
Iris provides deep visibility into the live runtime state via the following APIs:
107+
108+
- `list_actors() -> list[int]` — list all active local actor PIDs.
109+
- `actor_info(pid: int) -> Optional[dict[str, str]]` — get metadata, health, and status for a specific actor.
110+
- `set_actor_health(pid: int, status: str)` — manually update actor health (e.g. `'busy'`, `'degraded'`, `'ready'`).
111+
- `get_metrics() -> dict[str, int]` — retrieve system-wide metrics (actor count, message throughput).
112+
113+
Example:
114+
115+
```python
116+
for pid in rt.list_actors():
117+
info = rt.actor_info(pid)
118+
print(f"Actor {pid}: {info['health']}")
119+
120+
metrics = rt.get_metrics()
121+
print(f"Throughput: {metrics['messages_received']} msgs")
122+
```
123+
124+
---
125+
126+
## Resilience & Load Shedding
127+
128+
To prevent cascade failures under extreme load, Iris can shed traffic by rejecting new actors and messages.
129+
130+
- `set_system_capacity(cap: int)` — set the maximum number of concurrent actors allowed.
131+
- `set_load_shedding(enabled: bool)` — enable or disable the load shedding subsystem.
132+
- `is_load_shedding_active() -> bool` — check if the system is currently rejecting work due to capacity.
133+
134+
Example:
135+
136+
```python
137+
rt.set_system_capacity(10_000)
138+
rt.set_load_shedding(True)
97139

98-
# batch send
99-
accepted = rt.send_many(pid, [b"a", bytearray(b"b"), memoryview(b"c")])
100-
print("accepted", accepted)
140+
if rt.is_load_shedding_active():
141+
print("Warning: System at capacity, load shedding active.")
101142
```
102143

103144
---

0 commit comments

Comments
 (0)