skip to content
==> README.md <==
1# @ajax/mesh-jobs-rate
2
3A member's measured rate for a job program, as the leader keeps it: items per second as an EWMA over
4windows of at least 400 ms. A window restarts after the member sat idle longer than `IDLE_MS`, and a
5first rate comes from a lease's turnaround. The lease target grows by slow start: a full-size lease
6done in under half `LEASE_MS` doubles it (up to `LEASE_MAX`), and one over three times `LEASE_MS`
7halves it. `mj_lease_time` is how long a lease should take at a rate.
8
9## Ported from
10
11[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT):
12`crates/mesh-host/src/jobs.rs`: `IDLE_MS`, `LEASE_MS`, `LEASE_MAX`, `Rate` (`count`, `busy`,
13`lease_done`), `lease_time`.
14
15## Tests
16
17`tests/rate.c`: windows and the EWMA, the first rate, slow start both ways and at its cap, idle
18restarts, lease times. Every value is as jobs.rs computes it. The full dispatch is checked against
19the Rust in `@ajax/mesh-jobs-node`'s traces.
20
21## Licence
22
23MIT. See the repository's LICENSE.