enhancement(core): Erlang/OTP-style supervisor system#629
Conversation
dc6c05f to
343860d
Compare
343860d to
9840350
Compare
ed00477 to
74574e9
Compare
e2c007a to
feb74bb
Compare
feb74bb to
125372c
Compare
125372c to
4a63c4e
Compare
4a63c4e to
0de68dc
Compare
581b0f6 to
bf3527b
Compare
Regression Detector (Agent Data Plane)Regression Detector ResultsRun ID: 0546c77b-62eb-48c2-825b-d04173cd8996 Baseline: 0957bb3 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | quality_gates_rss_dsd_medium | memory utilization | +0.30 | [+0.12, +0.47] | 1 | |
| ➖ | quality_gates_rss_dsd_heavy | memory utilization | +0.29 | [+0.19, +0.38] | 1 | |
| ➖ | quality_gates_rss_idle | memory utilization | +0.17 | [+0.15, +0.19] | 1 | |
| ➖ | dsd_uds_10mb_3k_contexts_throughput | ingress throughput | +0.03 | [-0.02, +0.08] | 1 | |
| ➖ | dsd_uds_512kb_3k_contexts_throughput | ingress throughput | +0.00 | [-0.01, +0.02] | 1 | |
| ➖ | quality_gates_rss_dsd_ultraheavy | ingress throughput | +0.00 | [-0.04, +0.04] | 1 | |
| ➖ | dsd_uds_1mb_3k_contexts_throughput | ingress throughput | -0.00 | [-0.02, +0.01] | 1 | |
| ➖ | dsd_uds_100mb_3k_contexts_throughput | ingress throughput | -0.01 | [-0.08, +0.06] | 1 | |
| ➖ | quality_gates_rss_dsd_low | memory utilization | -0.07 | [-0.22, +0.07] | 1 | |
| ➖ | dsd_uds_500mb_3k_contexts_throughput | ingress throughput | -3.41 | [-3.54, -3.27] | 1 |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | links |
|---|---|---|---|---|
| ✅ | quality_gates_rss_dsd_heavy | memory_usage | 10/10 | |
| ✅ | quality_gates_rss_dsd_low | memory_usage | 10/10 | |
| ✅ | quality_gates_rss_dsd_medium | memory_usage | 10/10 | |
| ✅ | quality_gates_rss_dsd_ultraheavy | memory_usage | 10/10 | |
| ✅ | quality_gates_rss_idle | memory_usage | 10/10 |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Regression Detector (Agent Data Plane w/ Checks)Regression Detector ResultsRun ID: 9136ff2d-887d-4d14-b93e-b9227939eed7 Baseline: 0957bb3 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | quality_gates_rss_idle | memory utilization | +0.02 | [+0.01, +0.04] | 1 | |
| ➖ | quality_gates_rss_basic | memory utilization | -0.14 | [-0.16, -0.13] | 1 |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | links |
|---|---|---|---|---|
| ✅ | quality_gates_rss_basic | memory_usage | 10/10 | |
| ✅ | quality_gates_rss_idle | memory_usage | 10/10 |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Regression Detector LinksADP Experiment Result Links
ADP && Checks Experiment Result Links
|
lib/saluki-core/src/runtime/mod.rs
Outdated
| //! Processes have a few key attributes and invariants: | ||
| //! | ||
| //! - every process is a future that runs as an independent asynchronous task on a Tokio runtime | ||
| //! - every process has a unique numerical identifier and a semi-unique name | ||
| //! | ||
| //! Processes cannot run by themselves, however. They must be _supervised_. |
There was a problem hiding this comment.
Confirming, unlike Erlang processes saluki-core processes do not have a mailbox / input queue associated for message passing?
There was a problem hiding this comment.
Confirmed later, no mailbox. Probably worth adding this to the documentation in case someone -- like myself -- comes along with an Erlang mental model inappropriately.
| /// Process names will be sanitized if they contain invalid characters, such as hyphens or spaces. Invalid characters | ||
| /// will be replaced with underscores. |
There was a problem hiding this comment.
I'm not opposed, just curious why we don't reject invalid names outright? Haven't confirmed yet, it's possible the intention here is for process names to arrive via user config, in which case this does make some sense.
There was a problem hiding this comment.
Yeah, more or less. Process names will come, in part, from user-defined identifiers that might be provided at a layer above (or higher) the point where processes themselves are constructed, so we want to be more liberal in what we accept so that code doesn't have to bubble up that sort of constraint.
| // TODO: Erlang/OTP defaults to always trying to restart a process, even if it doesn't terminate due to a | ||
| // legitimate failure. It does allow configuring this behavior on a per-process basis, however. We don't | ||
| // support dynamically adding child processes, which is the only real use case I can think of for having | ||
| // non-long-lived child processes... so I think for now, we're OK just always try to restart. |
| @@ -0,0 +1,175 @@ | |||
| use std::time::Duration; | |||
There was a problem hiding this comment.
I like how the API works. Probably worth developing a lint or something to confirm that processes actually check their shutdown signal properly. Shame we don't have the ability to preempt.
Binary Size Analysis (Agent Data Plane)Target: aec6cab (baseline) vs 9b198f6 (comparison) diff
|
| Module | File Size | Symbols |
|---|---|---|
| [Unmapped] | +1.58 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.10085 | +1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.10093 | -1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.8471 | +1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.8776 | +1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.9046 | +1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.8479 | -1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.8784 | -1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.9054 | -1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.10802 | +1.10 KiB | 1 |
| _ZN4http6header4name14StandardHeader6as_str17hb45bedc01a2a74c0E.10810 | -1.10 KiB | 1 |
| _ZN17crossbeam_channel5waker9SyncWaker6notify17h0ddc00b08af3a086E.13817 | +1.08 KiB | 1 |
| _ZN17crossbeam_channel5waker9SyncWaker6notify17h0ddc00b08af3a086E.13814 | -1.08 KiB | 1 |
| _ZN17crossbeam_channel5waker9SyncWaker6notify17h0ddc00b08af3a086E.8764 | +1.00 KiB | 1 |
| _ZN17crossbeam_channel5waker9SyncWaker6notify17h0ddc00b08af3a086E.8772 | -1.00 KiB | 1 |
| _ZN17crossbeam_channel5waker9SyncWaker10disconnect17h5a7a3d8762979030E.8759 | +952 B | 1 |
| _ZN17crossbeam_channel5waker9SyncWaker10disconnect17h5a7a3d8762979030E.8767 | -952 B | 1 |
| _ZN12regex_syntax3hir3Hir5class17hebf341d170d5a49fE.9955 | +896 B | 1 |
| _ZN12regex_syntax3hir3Hir5class17hebf341d170d5a49fE.9963 | -896 B | 1 |
| _ZN5seize3raw9collector9Collector10try_retire17h5d92677642bd7678E.11141 | +880 B | 1 |
Detailed Symbol Changes
FILE SIZE VM SIZE
-------------- --------------
[NEW] +6.13Ki [NEW] +6.00Ki _ZN76_<hickory_proto::rr::record_data::RData as core::clone::Clone>5clone17h61f3fe4fffa4b03dE.8768
[NEW] +5.52Ki [NEW] +5.39Ki _ZN76_<hickory_proto::rr::record_data::RData as core::clone::Clone>5clone17h61f3fe4fffa4b03dE.11902
[NEW] +5.35Ki [NEW] +5.23Ki _ZN59_<rustls::error::Error as core::clone::Clone>5clone17hd14a1219ce5dde1cE.10806
[NEW] +5.21Ki [NEW] +5.09Ki _ZN59_<rustls::error::Error as core::clone::Clone>5clone17hd14a1219ce5dde1cE.11865
[NEW] +4.75Ki [NEW] +4.62Ki _ZN76_<saluki_core::data_model::event::Event as core::clone::Clone>5clone17h7f500b934c4a671bE.10781
[NEW] +4.25Ki [NEW] +4.13Ki _ZN59_<rustls::error::Error as core::clone::Clone>5clone17hd14a1219ce5dde1cE.10104
[NEW] +3.83Ki [NEW] +3.71Ki _ZN57_<webpki::error::Error as core::fmt::Debug>3fmt17h9036eab966a4f655E.12022
[NEW] +3.67Ki [NEW] +3.56Ki _ZN57_<rustls::error::Error as core::fmt::Debug>3fmt17hc5ecb86b7cbe8c88E.10257
[NEW] +3.58Ki [NEW] +3.46Ki _ZN57_<rustls::error::Error as core::fmt::Debug>3fmt17hc5ecb86b7cbe8c88E.11790
[NEW] +3.57Ki [NEW] +3.45Ki _ZN57_<rustls::error::Error as core::fmt::Debug>3fmt17hc5ecb86b7cbe8c88E.10009
-0.1% -952 -0.2% -1.58Ki [471 Others]
[DEL] -3.57Ki [DEL] -3.45Ki _ZN57_<rustls::error::Error as core::fmt::Debug>3fmt17hc5ecb86b7cbe8c88E.10017
[DEL] -3.58Ki [DEL] -3.46Ki _ZN57_<rustls::error::Error as core::fmt::Debug>3fmt17hc5ecb86b7cbe8c88E.11791
[DEL] -3.67Ki [DEL] -3.56Ki _ZN57_<rustls::error::Error as core::fmt::Debug>3fmt17hc5ecb86b7cbe8c88E.10265
[DEL] -3.83Ki [DEL] -3.71Ki _ZN57_<webpki::error::Error as core::fmt::Debug>3fmt17h9036eab966a4f655E.12023
[DEL] -4.25Ki [DEL] -4.13Ki _ZN59_<rustls::error::Error as core::clone::Clone>5clone17hd14a1219ce5dde1cE.10112
[DEL] -4.75Ki [DEL] -4.62Ki _ZN76_<saluki_core::data_model::event::Event as core::clone::Clone>5clone17h7f500b934c4a671bE.10789
[DEL] -5.21Ki [DEL] -5.09Ki _ZN59_<rustls::error::Error as core::clone::Clone>5clone17hd14a1219ce5dde1cE.11866
[DEL] -5.35Ki [DEL] -5.23Ki _ZN59_<rustls::error::Error as core::clone::Clone>5clone17hd14a1219ce5dde1cE.10814
[DEL] -5.52Ki [DEL] -5.39Ki _ZN76_<hickory_proto::rr::record_data::RData as core::clone::Clone>5clone17h61f3fe4fffa4b03dE.11903
[DEL] -6.13Ki [DEL] -6.00Ki _ZN76_<hickory_proto::rr::record_data::RData as core::clone::Clone>5clone17h61f3fe4fffa4b03dE.8776
-0.0% -952 -0.0% -1.58Ki TOTAL
Summary
This PR introduces a new runtime system in
saluki-coremodeled after Erlang/OTP's supervision trees, a powerful design pattern for building fault-tolerant systems composed of many interdependent "processes" in a way that they can recover from failure.Supervision trees are explained succinctly by the Erlang/OTP documentation, but generally: we have a collection of processes (asynchronous tasks) that have some level of fallibility, and we want to -- where possible -- maximize their resilience by allowing them to be restarted if they fail. Supervision trees approach this from the perspective of declaring a "specification" that describes how to create the process (in our case, building the
Futurethat is spawned) and then adding those specifications to a supervisor, which is responsible for managing those processes, restarting them when die, giving up if certain restart limits are hit, and so on.While we lack a lot of the power of Erlang itself, in terms of what Erlang/OTP's supervisors can build on top of, even having the basics provides us a lot of leeway for building things in a more fault-tolerant way:
We're intentionally only implementing many of the basics here -- worker specification, restart strategy, nested supervisors, orderly shutdown, etc -- but will add enhanced capabilities in future iterations, such as runtime telemetry/introspection, dynamic workers, and more.
Change Type
How did you test this PR?
N/A
References
AGTMETRICS-233