Skip to content

Commit 6afbb1b

Browse files
YouMeiYouMaoTaiActivePeter
authored andcommitted
fix: real workload、bp_balance、temp_scaler
feat: loadleast、ensure_scaler&scheduler、
1 parent fff6bcd commit 6afbb1b

23 files changed

+4171
-17667
lines changed

scripts/batch_run.yml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,69 @@ run_time: 4
33
params:
44
request_freq:
55
- low:
6+
- middle:
67
- high:
78
dag_type:
8-
- single:
9+
# - single:
10+
# - mix:
11+
- dag:
912
no_mech_latency:
1013
- true:
11-
- false:
14+
# - false:
1215

1316
mech_scale_sche:
1417
scale_sche_joint:
1518
scale_num:
16-
- hpa:
17-
- temp_scaler:
19+
# - hpa:
20+
# - temp_scaler:
21+
- ensure_scaler:
1822
scale_down_exec:
1923
- default:
2024
scale_up_exec:
2125
- least_task:
2226
sche:
23-
- pos: greedy
24-
- pos: random
27+
# - bp_balance:
28+
# - pos: greedy
29+
- ensure_scheduler:
2530
filter:
26-
- []
31+
# - []
2732
- [{'careful_down':''}]
33+
2834
scale_sche_separated:
2935
scale_num:
36+
- temp_scaler:
3037
- hpa:
38+
- lass:
3139
scale_down_exec:
3240
- default:
3341
scale_up_exec:
3442
- least_task:
3543
sche:
36-
- greedy:
37-
- random:
38-
- rotate:
44+
# - greedy:
45+
# - hash:
46+
# - random:
47+
- load_least:
48+
# - rotate:
49+
- pass:
3950
filter:
40-
- []
51+
# - []
4152
- [{'careful_down':''}]
42-
no_scale:
43-
scale_num:
44-
- 'no':
45-
scale_down_exec:
46-
- default:
47-
scale_up_exec:
48-
- 'no':
49-
sche:
50-
- greedy:
51-
- random:
52-
- rotate:
53-
filter:
54-
- []
53+
54+
# no_scale:
55+
# scale_num:
56+
# - 'no':
57+
# scale_down_exec:
58+
# - default:
59+
# scale_up_exec:
60+
# - 'no':
61+
# sche:
62+
# # - greedy:
63+
# # - hash:
64+
# # - random:
65+
# # - rotate:
66+
# # - faasflow:
67+
# filter:
68+
# - []
5569

5670
mech_other:
5771
instance_cache_policy:

scripts/fast_draw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import json
99

1010

11-
AVG_CNT=2
11+
AVG_CNT=1
1212

1313

1414
# #gen_tmp_yaml

scripts/fast_draw.yml

Lines changed: 13 additions & 70 deletions
Large diffs are not rendered by default.

scripts/run_different_req_freq.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ def run(self):
6666
# [['scale_sche_joint',''],["hpa",""],["default",""],["least_task",""],["bp_balance",""],[{'careful_down':''}],["no_evict",""]],
6767
[['scale_sche_joint',''],["hpa",""],["default",""],["least_task",""],["pos","greedy"],[{'careful_down':''}],["no_evict",""]],
6868

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

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

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

75-
[['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["greedy",""],[{'careful_down':''}],["no_evict",""]],
75+
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["greedy",""],[{'careful_down':''}],["no_evict",""]],
7676
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["greedy",""],[{'careful_down':''}],["lru","10"]],
7777
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["random",""],[{'careful_down':''}],["no_evict",""]],
7878
# [['scale_sche_separated',''],["hpa",""],["default",""],["least_task",""],["random",""],[{'careful_down':''}],["lru","10"]],

serverless_sim/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Cargo.lock
33
records*
44
log
55
module_conf_es.json
6-
cache
6+
cache
7+
azure-trace

serverless_sim/module_conf_es.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
"scale_sche_joint": null
66
},
77
"scale_num": {
8+
"rela": null,
9+
"hpa": null,
810
"full_placement": null,
11+
"ensure_scaler": null,
912
"no": null,
1013
"lass": null,
11-
"rela": null,
12-
"hpa": null,
1314
"temp_scaler": null
1415
},
1516
"scale_down_exec": {
@@ -21,22 +22,24 @@
2122
},
2223
"sche": {
2324
"consistenthash": null,
24-
"hash": null,
25-
"bp_balance": null,
26-
"random": null,
27-
"greedy": null,
25+
"ensure_scheduler": null,
2826
"faasflow": null,
27+
"load_least": null,
2928
"rotate": null,
30-
"pass": null,
29+
"hash": null,
30+
"pos": null,
31+
"random": null,
32+
"bp_balance": null,
3133
"fnsche": null,
32-
"pos": null
34+
"greedy": null,
35+
"pass": null
3336
},
3437
"filter": {
3538
"careful_down": null
3639
},
3740
"instance_cache_policy": {
38-
"no_evict": null,
3941
"lru": null,
40-
"fifo": null
42+
"fifo": null,
43+
"no_evict": null
4144
}
4245
}

serverless_sim/src/fn_dag.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,13 @@ impl FnContainer {
342342
&self.state
343343
}
344344

345+
pub fn is_running(&self) -> bool {
346+
match self.state {
347+
FnContainerState::Running => true,
348+
_ => false,
349+
}
350+
}
351+
345352
pub fn is_idle(&self) -> bool {
346353
match self.state {
347354
FnContainerState::Running => self.req_fn_state.len() == 0,
@@ -448,15 +455,15 @@ impl SimEnv {
448455

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

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

461468
env.core.dags_mut().push(dag);
462469
}
@@ -475,8 +482,8 @@ impl SimEnv {
475482
// 跑指标2的实验用
476483
self.help.config().dag_type_mix()
477484
{
478-
for i in 0..10 {
479-
if i >= 5 {
485+
for i in 0..50 {
486+
if i >= 20 {
480487
// 随机确定每个图中节点的数量
481488
let mapcnt = env.env_rand_i(2, 5); //2-4
482489
let dag_i = env.core.dags().len();

serverless_sim/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ extern crate lazy_static;
3737

3838
#[tokio::main]
3939
async fn main() {
40-
let keyword: Vec<&'static str> = //vec![];
41-
vec!["::sche", "::mechanism ", "::scale"]; // no algo log
40+
let keyword: Vec<&'static str> = vec![];
41+
// vec!["::sche", "::mechanism ", "::scale"]; // no algo log
4242
Builder::new()
4343
.filter(None, LevelFilter::Info)
4444
.format(move |buf, record| {

serverless_sim/src/mechanism.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<S: SameTarget> CheckDup for Vec<S> {
7878
}
7979
}
8080

81-
pub const SCHE_NAMES: [&'static str; 10] = [
81+
pub const SCHE_NAMES: [&'static str; 12] = [
8282
"rotate",
8383
"hash",
8484
"bp_balance",
@@ -89,16 +89,19 @@ pub const SCHE_NAMES: [&'static str; 10] = [
8989
"random",
9090
"greedy",
9191
"consistenthash", // "gofs",
92+
"ensure_scheduler",
93+
"load_least",
9294
// "load_least",
9395
// "random",
9496
];
95-
pub const SCALE_NUM_NAMES: [&'static str; 6] = [
97+
pub const SCALE_NUM_NAMES: [&'static str; 7] = [
9698
"no",
9799
"hpa",
98100
"lass",
99101
"temp_scaler",
100102
"full_placement",
101103
"rela",
104+
"ensure_scaler",
102105
];
103106
pub const SCALE_DOWN_EXEC_NAMES: [&'static str; 1] = ["default"];
104107
pub const SCALE_UP_EXEC_NAMES: [&'static str; 2] = ["least_task", "no"];
@@ -181,7 +184,8 @@ impl ConfigNewMec for Config {
181184
"greedy",
182185
"consistenthash",
183186
"hash",
184-
"rotate"
187+
"rotate",
188+
"load_least",
185189
];
186190
let allow_scale_num = vec!["no"];
187191
let allow_scale_down_exec = vec!["default"];
@@ -200,7 +204,7 @@ impl ConfigNewMec for Config {
200204
}
201205
}
202206
"scale_sche_separated" => {
203-
let allow_sche = vec!["random", "greedy", "hash", "rotate"];
207+
let allow_sche = vec!["random", "greedy", "hash", "rotate","load_least","pass"];
204208
let allow_scale_num = vec!["hpa", "lass", "temp_scaler", "full_placement", "rela"];
205209
let allow_scale_down_exec = vec!["default"];
206210
let allow_scale_up_exec = vec!["least_task"];
@@ -218,8 +222,8 @@ impl ConfigNewMec for Config {
218222
}
219223
}
220224
"scale_sche_joint" => {
221-
let allow_sche = vec!["pos", "bp_balance", "hash", "rotate"];
222-
let allow_scale_num = vec!["hpa", "lass", "temp_scaler", "full_placement", "rela"];
225+
let allow_sche = vec!["pos", "bp_balance", "ensure_scheduler"];
226+
let allow_scale_num = vec!["hpa", "lass", "temp_scaler", "full_placement", "rela", "ensure_scaler"];
223227
let allow_scale_down_exec = vec!["default"];
224228
let allow_scale_up_exec = vec!["least_task"];
225229
if
@@ -437,11 +441,11 @@ impl MechanismImpl {
437441
// let cur = env.fn_container_cnt(func.fn_id);
438442
// let tar = self.scale_num(func.fn_id);
439443

440-
log::info!(
441-
"scale fn{} cost {}",
442-
func.fn_id,
443-
util::now_ms() - *self.step_begin.borrow()
444-
);
444+
// log::info!(
445+
// "scale fn{} cost {}",
446+
// func.fn_id,
447+
// util::now_ms() - *self.step_begin.borrow()
448+
// );
445449
// log::info!("scale fn {} from {} to {}", func.fn_id, cur, tar);
446450
// 不进行扩缩容,在调度时候一起进行
447451
// log::info!("scale fn {} from {} to {}", func.fn_id, cur, tar);

serverless_sim/src/mechanism_thread.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::sync::mpsc;
22

3+
use enum_as_inner::EnumAsInner;
34
#[cfg(target_os = "windows")]
45
use thread_priority::{set_current_thread_priority, ThreadPriority, WinAPIThreadPriority};
56
#[cfg(target_os = "windows")]

0 commit comments

Comments
 (0)