Skip to content

Commit

Permalink
fix: real workload、bp_balance、temp_scaler
Browse files Browse the repository at this point in the history
feat: loadleast、ensure_scaler&scheduler、
  • Loading branch information
YouMeiYouMaoTai authored and ActivePeter committed Jul 25, 2024
1 parent fff6bcd commit 6afbb1b
Show file tree
Hide file tree
Showing 23 changed files with 4,171 additions and 17,667 deletions.
62 changes: 38 additions & 24 deletions scripts/batch_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,69 @@ run_time: 4
params:
request_freq:
- low:
- middle:
- high:
dag_type:
- single:
# - single:
# - mix:
- dag:
no_mech_latency:
- true:
- false:
# - false:

mech_scale_sche:
scale_sche_joint:
scale_num:
- hpa:
- temp_scaler:
# - hpa:
# - temp_scaler:
- ensure_scaler:
scale_down_exec:
- default:
scale_up_exec:
- least_task:
sche:
- pos: greedy
- pos: random
# - bp_balance:
# - pos: greedy
- ensure_scheduler:
filter:
- []
# - []
- [{'careful_down':''}]

scale_sche_separated:
scale_num:
- temp_scaler:
- hpa:
- lass:
scale_down_exec:
- default:
scale_up_exec:
- least_task:
sche:
- greedy:
- random:
- rotate:
# - greedy:
# - hash:
# - random:
- load_least:
# - rotate:
- pass:
filter:
- []
# - []
- [{'careful_down':''}]
no_scale:
scale_num:
- 'no':
scale_down_exec:
- default:
scale_up_exec:
- 'no':
sche:
- greedy:
- random:
- rotate:
filter:
- []

# no_scale:
# scale_num:
# - 'no':
# scale_down_exec:
# - default:
# scale_up_exec:
# - 'no':
# sche:
# # - greedy:
# # - hash:
# # - random:
# # - rotate:
# # - faasflow:
# filter:
# - []

mech_other:
instance_cache_policy:
Expand Down
2 changes: 1 addition & 1 deletion scripts/fast_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import json


AVG_CNT=2
AVG_CNT=1


# #gen_tmp_yaml
Expand Down
83 changes: 13 additions & 70 deletions scripts/fast_draw.yml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions scripts/run_different_req_freq.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ def run(self):
# [['scale_sche_joint',''],["hpa",""],["default",""],["least_task",""],["bp_balance",""],[{'careful_down':''}],["no_evict",""]],
[['scale_sche_joint',''],["hpa",""],["default",""],["least_task",""],["pos","greedy"],[{'careful_down':''}],["no_evict",""]],

[['scale_sche_joint',''],["hpa",""],["default",""],["least_task",""],["pos","random"],[{'careful_down':''}],["no_evict",""]],
# [['scale_sche_joint',''],["hpa",""],["default",""],["least_task",""],["pos","random"],[{'careful_down':''}],["no_evict",""]],

[['scale_sche_joint',''],["temp_scaler",""],["default",""],["least_task",""],["pos","random"],[{'careful_down':''}],["no_evict",""]],
# [['scale_sche_joint',''],["temp_scaler",""],["default",""],["least_task",""],["pos","random"],[{'careful_down':''}],["no_evict",""]],

[['scale_sche_joint',''],["temp_scaler",""],["default",""],["least_task",""],["pos","greedy"],[{'careful_down':''}],["no_evict",""]],
# [['scale_sche_joint',''],["temp_scaler",""],["default",""],["least_task",""],["pos","greedy"],[{'careful_down':''}],["no_evict",""]],

[['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["greedy",""],[{'careful_down':''}],["no_evict",""]],
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["greedy",""],[{'careful_down':''}],["no_evict",""]],
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["greedy",""],[{'careful_down':''}],["lru","10"]],
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["random",""],[{'careful_down':''}],["no_evict",""]],
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["random",""],[{'careful_down':''}],["lru","10"]],
Expand Down
3 changes: 2 additions & 1 deletion serverless_sim/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Cargo.lock
records*
log
module_conf_es.json
cache
cache
azure-trace
23 changes: 13 additions & 10 deletions serverless_sim/module_conf_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"scale_sche_joint": null
},
"scale_num": {
"rela": null,
"hpa": null,
"full_placement": null,
"ensure_scaler": null,
"no": null,
"lass": null,
"rela": null,
"hpa": null,
"temp_scaler": null
},
"scale_down_exec": {
Expand All @@ -21,22 +22,24 @@
},
"sche": {
"consistenthash": null,
"hash": null,
"bp_balance": null,
"random": null,
"greedy": null,
"ensure_scheduler": null,
"faasflow": null,
"load_least": null,
"rotate": null,
"pass": null,
"hash": null,
"pos": null,
"random": null,
"bp_balance": null,
"fnsche": null,
"pos": null
"greedy": null,
"pass": null
},
"filter": {
"careful_down": null
},
"instance_cache_policy": {
"no_evict": null,
"lru": null,
"fifo": null
"fifo": null,
"no_evict": null
}
}
17 changes: 12 additions & 5 deletions serverless_sim/src/fn_dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,13 @@ impl FnContainer {
&self.state
}

pub fn is_running(&self) -> bool {
match self.state {
FnContainerState::Running => true,
_ => false,
}
}

pub fn is_idle(&self) -> bool {
match self.state {
FnContainerState::Running => self.req_fn_state.len() == 0,
Expand Down Expand Up @@ -448,15 +455,15 @@ impl SimEnv {

// 检查配置中的dag_type
if self.help.config().dag_type_dag() {
// 如果dag_type为dag,则创建6个具有多个子节点的复杂DAG实例
for _ in 0..6 {
// 如果dag_type为dag,则创建 33 个具有多个子节点的复杂DAG实例
for _ in 0..33 {
// 随机确定每个图中节点的数量
let mapcnt = env.env_rand_i(2, 5); //2-4
let dag_i = env.core.dags().len();

// 创建一个复杂DAG实例
let dag = FnDAG::instance_map_reduce(dag_i, env, mapcnt);
log::info!("dag {} {:?}", dag.dag_i, dag.dag_inner);
// log::info!("dag {} {:?}", dag.dag_i, dag.dag_inner);

env.core.dags_mut().push(dag);
}
Expand All @@ -475,8 +482,8 @@ impl SimEnv {
// 跑指标2的实验用
self.help.config().dag_type_mix()
{
for i in 0..10 {
if i >= 5 {
for i in 0..50 {
if i >= 20 {
// 随机确定每个图中节点的数量
let mapcnt = env.env_rand_i(2, 5); //2-4
let dag_i = env.core.dags().len();
Expand Down
4 changes: 2 additions & 2 deletions serverless_sim/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ extern crate lazy_static;

#[tokio::main]
async fn main() {
let keyword: Vec<&'static str> = //vec![];
vec!["::sche", "::mechanism ", "::scale"]; // no algo log
let keyword: Vec<&'static str> = vec![];
// vec!["::sche", "::mechanism ", "::scale"]; // no algo log
Builder::new()
.filter(None, LevelFilter::Info)
.format(move |buf, record| {
Expand Down
26 changes: 15 additions & 11 deletions serverless_sim/src/mechanism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<S: SameTarget> CheckDup for Vec<S> {
}
}

pub const SCHE_NAMES: [&'static str; 10] = [
pub const SCHE_NAMES: [&'static str; 12] = [
"rotate",
"hash",
"bp_balance",
Expand All @@ -89,16 +89,19 @@ pub const SCHE_NAMES: [&'static str; 10] = [
"random",
"greedy",
"consistenthash", // "gofs",
"ensure_scheduler",
"load_least",
// "load_least",
// "random",
];
pub const SCALE_NUM_NAMES: [&'static str; 6] = [
pub const SCALE_NUM_NAMES: [&'static str; 7] = [
"no",
"hpa",
"lass",
"temp_scaler",
"full_placement",
"rela",
"ensure_scaler",
];
pub const SCALE_DOWN_EXEC_NAMES: [&'static str; 1] = ["default"];
pub const SCALE_UP_EXEC_NAMES: [&'static str; 2] = ["least_task", "no"];
Expand Down Expand Up @@ -181,7 +184,8 @@ impl ConfigNewMec for Config {
"greedy",
"consistenthash",
"hash",
"rotate"
"rotate",
"load_least",
];
let allow_scale_num = vec!["no"];
let allow_scale_down_exec = vec!["default"];
Expand All @@ -200,7 +204,7 @@ impl ConfigNewMec for Config {
}
}
"scale_sche_separated" => {
let allow_sche = vec!["random", "greedy", "hash", "rotate"];
let allow_sche = vec!["random", "greedy", "hash", "rotate","load_least","pass"];
let allow_scale_num = vec!["hpa", "lass", "temp_scaler", "full_placement", "rela"];
let allow_scale_down_exec = vec!["default"];
let allow_scale_up_exec = vec!["least_task"];
Expand All @@ -218,8 +222,8 @@ impl ConfigNewMec for Config {
}
}
"scale_sche_joint" => {
let allow_sche = vec!["pos", "bp_balance", "hash", "rotate"];
let allow_scale_num = vec!["hpa", "lass", "temp_scaler", "full_placement", "rela"];
let allow_sche = vec!["pos", "bp_balance", "ensure_scheduler"];
let allow_scale_num = vec!["hpa", "lass", "temp_scaler", "full_placement", "rela", "ensure_scaler"];
let allow_scale_down_exec = vec!["default"];
let allow_scale_up_exec = vec!["least_task"];
if
Expand Down Expand Up @@ -437,11 +441,11 @@ impl MechanismImpl {
// let cur = env.fn_container_cnt(func.fn_id);
// let tar = self.scale_num(func.fn_id);

log::info!(
"scale fn{} cost {}",
func.fn_id,
util::now_ms() - *self.step_begin.borrow()
);
// log::info!(
// "scale fn{} cost {}",
// func.fn_id,
// util::now_ms() - *self.step_begin.borrow()
// );
// log::info!("scale fn {} from {} to {}", func.fn_id, cur, tar);
// 不进行扩缩容,在调度时候一起进行
// log::info!("scale fn {} from {} to {}", func.fn_id, cur, tar);
Expand Down
1 change: 1 addition & 0 deletions serverless_sim/src/mechanism_thread.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::mpsc;

use enum_as_inner::EnumAsInner;
#[cfg(target_os = "windows")]
use thread_priority::{set_current_thread_priority, ThreadPriority, WinAPIThreadPriority};
#[cfg(target_os = "windows")]
Expand Down
6 changes: 3 additions & 3 deletions serverless_sim/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl Node {

pub fn try_load_container(&self, fnid: FnId, env: &SimEnv) {
if self.container(fnid).is_some() {
log::info!("已经添加了{}", fnid);
// log::info!("已经添加了{}", fnid);
return;
}

Expand All @@ -263,9 +263,9 @@ impl Node {
fnid,
Box::new(move |to_replace| {
let node = node.as_ref();
log::info!("节点{}要移除的容器{}", node.node_id, to_replace);
// log::info!("节点{}要移除的容器{}", node.node_id, to_replace);
for (_k, v) in node.fn_containers.borrow().iter() {
log::info!("{}", v.fn_id);
// log::info!("{}", v.fn_id);
}
node.container(*to_replace).unwrap().is_idle()
}),
Expand Down
Loading

0 comments on commit 6afbb1b

Please sign in to comment.