Skip to content

Commit

Permalink
feat(MR): [MR-649] Roll out best-effort calls to the first few subnets
Browse files Browse the repository at this point in the history
List a few subnets in the BestEffortResponsesFeature::SpecificSubnets under the FeatureFlags default. This will have the ic0_call_with_best_effort_response() API call on these subnets actually set a deadline on the calls being constructed. And allow best-effort requests to be routed between these subnets only.

Also reduce the default subnet_message_memory_capacity on all subnets from 25 GB to 15 GB, to make place for a potential 5 GB of best-effort messages plus a potential 1 M callbacks. Apart from brief spikes, usually associated with heartbeat / global timer storms, subnet message memory usage is virtually always in the low single digit GBs, so the reduction of the limit will make no practical difference.
  • Loading branch information
alin-at-dfinity committed Feb 6, 2025
1 parent a5c5a4c commit 2e80716
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
48 changes: 41 additions & 7 deletions rs/config/src/embedders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,13 @@ pub struct FeatureFlags {

impl Default for FeatureFlags {
fn default() -> Self {
// TODO(MR-649): Comment out for stage 1b -- rollout to specific subnets.
// use ic_types::PrincipalId;
// use std::str::FromStr;
// let subnet_id = |id_str: &str| SubnetId::new(PrincipalId::from_str(id_str).unwrap());
use ic_types::PrincipalId;
use std::str::FromStr;
let subnet_id = |id_str: &str| SubnetId::new(PrincipalId::from_str(id_str).unwrap());
let enabled_subnets = vec![
// subnet_id("eq6en-6jqla-fbu5s-daskr-h6hx2-376n5-iqabl-qgrng-gfqmv-n3yjr-mqe"),
// subnet_id("2fq7c-slacv-26cgz-vzbx2-2jrcs-5edph-i5s2j-tck77-c3rlz-iobzx-mqe"),
// subnet_id("4zbus-z2bmt-ilreg-xakz4-6tyre-hsqj4-slb4g-zjwqo-snjcc-iqphi-3qe"),
subnet_id("eq6en-6jqla-fbu5s-daskr-h6hx2-376n5-iqabl-qgrng-gfqmv-n3yjr-mqe"),
subnet_id("2fq7c-slacv-26cgz-vzbx2-2jrcs-5edph-i5s2j-tck77-c3rlz-iobzx-mqe"),
subnet_id("4zbus-z2bmt-ilreg-xakz4-6tyre-hsqj4-slb4g-zjwqo-snjcc-iqphi-3qe"),
];

Self {
Expand Down Expand Up @@ -346,3 +345,38 @@ impl Default for Config {
Self::new()
}
}

#[cfg(test)]
mod tests {
use super::*;
use ic_types::PrincipalId;

const SUBNET_1: SubnetId = SubnetId::new(PrincipalId::new(1, [1; 29]));
const SUBNET_2: SubnetId = SubnetId::new(PrincipalId::new(1, [2; 29]));

#[test]
fn test_best_effort_responses_feature_specific_subnets() {
let best_effort_responses = BestEffortResponsesFeature::SpecificSubnets(vec![SUBNET_1]);

assert!(best_effort_responses.is_enabled_on(&SUBNET_1, SubnetType::Application));
assert!(best_effort_responses.is_enabled_on(&SUBNET_1, SubnetType::System));
assert!(!best_effort_responses.is_enabled_on(&SUBNET_2, SubnetType::Application));
assert!(!best_effort_responses.is_enabled_on(&SUBNET_2, SubnetType::System));
}

#[test]
fn test_best_effort_responses_feature_application_subnets_only() {
let best_effort_responses = BestEffortResponsesFeature::ApplicationSubnetsOnly;

assert!(best_effort_responses.is_enabled_on(&SUBNET_1, SubnetType::Application));
assert!(!best_effort_responses.is_enabled_on(&SUBNET_1, SubnetType::System));
}

#[test]
fn test_best_effort_responses_feature_enabled() {
let best_effort_responses = BestEffortResponsesFeature::Enabled;

assert!(best_effort_responses.is_enabled_on(&SUBNET_1, SubnetType::Application));
assert!(best_effort_responses.is_enabled_on(&SUBNET_1, SubnetType::System));
}
}
2 changes: 1 addition & 1 deletion rs/config/src/execution_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SUBNET_MEMORY_CAPACITY: NumBytes = NumBytes::new(TIB);
/// Guaranteed response message memory usage is calculated as the total size of
/// enqueued guaranteed responses; plus the maximum allowed response size per
/// reserved guaranteed response slot.
const SUBNET_GUARANTEED_RESPONSE_MESSAGE_MEMORY_CAPACITY: NumBytes = NumBytes::new(25 * GIB);
const SUBNET_GUARANTEED_RESPONSE_MESSAGE_MEMORY_CAPACITY: NumBytes = NumBytes::new(15 * GIB);

/// The limit on how much memory may be used by all guaranteed response messages
/// on a given subnet at the end of a round.
Expand Down

0 comments on commit 2e80716

Please sign in to comment.