1# @ajax/mesh-jobs-rate
23A 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.
89## Ported from
1011[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`.
1415## Tests
1617`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.
2021## Licence
2223MIT. See the repository's LICENSE.