Commit graph

18 commits

Author SHA1 Message Date
Developer
265992c3db feat: per-actor mailbox backpressure with configurable overflow
Add optional bounded mailboxes to prevent unbounded memory growth.
MailboxOverflow enum: DropNewest (discard incoming) or DropOldest
(evict oldest to make room). Default capacity=0 preserves unbounded
behavior for full backward compatibility.

messages_dropped counter added to WorkerStats for observability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 11:54:16 +00:00
Developer
7d00e65a0a feat: load-aware actor placement + work stealing research
Replace blind round-robin placement with load-aware strategy that reads
per-worker stats (actor count + mailbox depth) and biases toward lighter
workers. Falls back to round-robin when stats are equal (initial burst).

Deep research on work stealing across Tokio (steal-half, LIFO slot),
Go (M:N scheduler), BEAM (proactive migration), and ForkJoinPool.
Full actor migration is feasible but deferred due to message-loss window.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 11:46:53 +00:00
Developer
cf616199b2 feat: shutdown unpark + bug-inspired tests
shutdown() now wakes all parked workers immediately for fast exit.
5 new tests from competitor bug patterns: ractor #310 (destructive
snapshots), kameo #185 (startup delivery), actix #515 (mailbox bypass),
plus stats-under-load and shutdown-wakes-parked validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 11:34:58 +00:00
Developer
acacc1b758 feat: thread parking for instant worker wakeup
Replace thread::sleep with thread::park_timeout in worker backoff loop.
Workers register their thread handle via OnceLock<Thread> on startup.
When send_to or spawn routes work to a worker, Thread::unpark() wakes
it instantly instead of waiting for the sleep timer to expire.

Inspired by tokio's parker state machine and Linux NO_HZ adaptive ticks.

Implementation:
- Runtime stores Vec<OnceLock<Thread>> for worker thread handles
- Workers call OnceLock::set(thread::current()) on startup
- Runtime::send_any, spawn_any, and WorkerContext cross-worker sends
  call notify_worker() → Thread::unpark() on the target worker
- TickContext carries worker_threads reference for cross-worker notification
- Zero new dependencies (std::sync::OnceLock + std:🧵:park_timeout)

Benefits:
- Parked workers wake instantly when work arrives (vs up to 1ms sleep delay)
- No overhead on hot path — unpark() is no-op if thread isn't parked
- Single-threaded tick() mode unaffected (OnceLock never set)

All 58 tests pass (52 runtime_api + 5 transport + 1 doctest).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 11:31:34 +00:00
076f1194bf feat: tui, agent interface, stats hook (#29)
Runtime dashboard now features a TUI option and an interface for LLM tool use. Removed some bloat from stats collecting and replaced with a hook function to dump runtime stats into.
2026-02-11 15:23:26 +00:00
2da9198ee9 fix: stats datatypes and refactor channel signature (#28) 2026-02-10 07:35:58 +00:00
ef08d3e7a5 feat: transport protocol (#27)
Address actors via ID, send messages over transport (TCP, QUIC, etc)
2026-02-09 19:05:37 +00:00
1a64f421bf feat: runtime dashboard and docs (#23)
Live and replay demo for a runtime dashboard. Added docs with svg files.
2026-02-09 09:04:57 +00:00
09504d0b67 cfuzz (#22) 2026-02-09 07:24:16 +00:00
9beca6c5dc feat: gossip simulation (#21)
Simulate a simple push-pull epidemic broadcast.
2026-02-08 16:18:39 +00:00
08a655d88a refactor: graph-optimization (#17)
Use spectral analysis tool to find spurious edges in the code DAG, refactoring to prune.
2026-02-07 16:51:40 +00:00
Zachery Aaron Shores-Chmielewski
6897d71e4b feat: refactor based on spectral spectral_analysis
Asking the agent to refactor to reduce spectral complexity, it worked. Trivial change, but this did reduce code complexity.
2026-02-07 17:36:45 +07:00
Zachery Aaron Shores-Chmielewski
d3fdf9e550 feat: worker thread api (#6)
Make the worker thread api clearly seperated and ready for test harness
2026-02-06 21:45:19 +07:00
796bd1f2c5 feat: runtime information display (#9)
Show basic information from the runtime, such as number of actors, worker threads, etc.
2026-02-06 13:35:46 +00:00
85c7c557ee feat: python bindings (#7)
Python bindings allowing us to interact with the library in a python REPL
2026-02-06 12:47:51 +00:00
5a9af73de6 refactor: major library changes (#5)
Refactoring to logically separate component modules in order to make it easier to develop tests, metrics, tracing, etc.
2026-02-06 11:25:37 +00:00
Zachery Aaron Shores-Chmielewski
c56a05433f feat: Stress tests, benchmarking, and non-failing queues and inboxes #3
Adds some basic benchmarking, stress tests. They still need to be properly examined to ensure they are testing the correct properties, but fit for "good enough". Implements the HybridChannel type, which features a channel buffer that can withstand overflows. It does so by providing a dequeue behind a mutex. Without overflow, will push messages into the lock free ArrayQueue implemented by crossbeam_queue; when that buffer fills, will use the locking portion provided by the Mutex<VecDequeue>.

In the future we can even further optimize this, perhaps with some linked list implementations of lock-free channels, but, like the benchmarks, this fits the "good enough" bar for now.
2026-01-26 14:14:00 +07:00
b422605f6b feat: Multithreaded runtime (#2)
Implements a tunable configuration for a single or multi-threaded runtime.

Co-authored-by: Zachery Aaron Shores-Chmielewski <zachanon@gmail.com>
Reviewed-on: http://zachery.lol/code/code/zacheryasc/swactor/pulls/2
2026-01-25 13:38:34 +00:00