From eab250049aaa1b34d347f26cc31848fbaf9f8475 Mon Sep 17 00:00:00 2001 From: Le Xu Date: Fri, 28 Feb 2025 17:35:10 -0800 Subject: [PATCH] convert user specified patterns to synthetic patterns --- .../generator/config/completion-len-config.json | 8 -------- .../config/examples/completion-len-config.json | 7 +++++++ .../config/examples/prompt-len-config.json | 7 +++++++ .../generator/config/examples/traffic-config.json | 7 +++++++ .../completion-len-configs/HighFast.json | 7 +++++++ .../completion-len-configs/HighSlow.json | 7 +++++++ .../predefined/completion-len-configs/LowFast.json | 7 +++++++ .../predefined/completion-len-configs/LowSlow.json | 7 +++++++ .../predefined/prompt-len-configs/HighFast.json | 7 +++++++ .../predefined/prompt-len-configs/HighSlow.json | 7 +++++++ .../predefined/prompt-len-configs/LowFast.json | 7 +++++++ .../predefined/prompt-len-configs/LowSlow.json | 7 +++++++ .../predefined/traffic-configs/HighFast.json | 7 +++++++ .../predefined/traffic-configs/HighSlow.json | 7 +++++++ .../config/predefined/traffic-configs/LowFast.json | 7 +++++++ .../config/predefined/traffic-configs/LowSlow.json | 7 +++++++ benchmarks/generator/config/prompt-len-config.json | 8 -------- benchmarks/generator/config/traffic-config.json | 8 -------- benchmarks/generator/distribution.py | 14 +++++++++++++- benchmarks/generator/workload_generator.py | 11 +++++++---- 20 files changed, 125 insertions(+), 29 deletions(-) delete mode 100644 benchmarks/generator/config/completion-len-config.json create mode 100644 benchmarks/generator/config/examples/completion-len-config.json create mode 100644 benchmarks/generator/config/examples/prompt-len-config.json create mode 100644 benchmarks/generator/config/examples/traffic-config.json create mode 100644 benchmarks/generator/config/predefined/completion-len-configs/HighFast.json create mode 100644 benchmarks/generator/config/predefined/completion-len-configs/HighSlow.json create mode 100644 benchmarks/generator/config/predefined/completion-len-configs/LowFast.json create mode 100644 benchmarks/generator/config/predefined/completion-len-configs/LowSlow.json create mode 100644 benchmarks/generator/config/predefined/prompt-len-configs/HighFast.json create mode 100644 benchmarks/generator/config/predefined/prompt-len-configs/HighSlow.json create mode 100644 benchmarks/generator/config/predefined/prompt-len-configs/LowFast.json create mode 100644 benchmarks/generator/config/predefined/prompt-len-configs/LowSlow.json create mode 100644 benchmarks/generator/config/predefined/traffic-configs/HighFast.json create mode 100644 benchmarks/generator/config/predefined/traffic-configs/HighSlow.json create mode 100644 benchmarks/generator/config/predefined/traffic-configs/LowFast.json create mode 100644 benchmarks/generator/config/predefined/traffic-configs/LowSlow.json delete mode 100644 benchmarks/generator/config/prompt-len-config.json delete mode 100644 benchmarks/generator/config/traffic-config.json diff --git a/benchmarks/generator/config/completion-len-config.json b/benchmarks/generator/config/completion-len-config.json deleted file mode 100644 index b8607f4f..00000000 --- a/benchmarks/generator/config/completion-len-config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "A": 8, - "B": 169, - "sigma": 0.1, - "period": 0.005, - "omega": null, - "only_rise": false -} \ No newline at end of file diff --git a/benchmarks/generator/config/examples/completion-len-config.json b/benchmarks/generator/config/examples/completion-len-config.json new file mode 100644 index 00000000..b630960d --- /dev/null +++ b/benchmarks/generator/config/examples/completion-len-config.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 8, + "mean": 169, + "noise": 0.1, + "period_len_ms": 300000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/examples/prompt-len-config.json b/benchmarks/generator/config/examples/prompt-len-config.json new file mode 100644 index 00000000..c6d5740a --- /dev/null +++ b/benchmarks/generator/config/examples/prompt-len-config.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 15, + "mean": 309, + "noise": 0.1, + "period_len_ms": 300000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/examples/traffic-config.json b/benchmarks/generator/config/examples/traffic-config.json new file mode 100644 index 00000000..d703d2fe --- /dev/null +++ b/benchmarks/generator/config/examples/traffic-config.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 2, + "mean": 6, + "noise": 0.1, + "period_len_ms": 300000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/completion-len-configs/HighFast.json b/benchmarks/generator/config/predefined/completion-len-configs/HighFast.json new file mode 100644 index 00000000..3438327a --- /dev/null +++ b/benchmarks/generator/config/predefined/completion-len-configs/HighFast.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 86, + "mean": 43, + "noise": 0.1, + "period_len_ms": 120000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/completion-len-configs/HighSlow.json b/benchmarks/generator/config/predefined/completion-len-configs/HighSlow.json new file mode 100644 index 00000000..8398157d --- /dev/null +++ b/benchmarks/generator/config/predefined/completion-len-configs/HighSlow.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 86, + "mean": 43, + "noise": 0.1, + "period_len_ms": 4230000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/completion-len-configs/LowFast.json b/benchmarks/generator/config/predefined/completion-len-configs/LowFast.json new file mode 100644 index 00000000..6c706a0a --- /dev/null +++ b/benchmarks/generator/config/predefined/completion-len-configs/LowFast.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 7.1, + "mean": 43, + "noise": 0.1, + "period_len_ms": 120000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/completion-len-configs/LowSlow.json b/benchmarks/generator/config/predefined/completion-len-configs/LowSlow.json new file mode 100644 index 00000000..9bf653fb --- /dev/null +++ b/benchmarks/generator/config/predefined/completion-len-configs/LowSlow.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 7.1, + "mean": 43, + "noise": 0.1, + "period_len_ms": 4230000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/prompt-len-configs/HighFast.json b/benchmarks/generator/config/predefined/prompt-len-configs/HighFast.json new file mode 100644 index 00000000..bf7f175c --- /dev/null +++ b/benchmarks/generator/config/predefined/prompt-len-configs/HighFast.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 2048, + "mean": 1024, + "noise": 0.1, + "period_len_ms": 90000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/prompt-len-configs/HighSlow.json b/benchmarks/generator/config/predefined/prompt-len-configs/HighSlow.json new file mode 100644 index 00000000..2c886394 --- /dev/null +++ b/benchmarks/generator/config/predefined/prompt-len-configs/HighSlow.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 2048, + "mean": 1024, + "noise": 0.1, + "period_len_ms": 210000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/prompt-len-configs/LowFast.json b/benchmarks/generator/config/predefined/prompt-len-configs/LowFast.json new file mode 100644 index 00000000..ebe10b99 --- /dev/null +++ b/benchmarks/generator/config/predefined/prompt-len-configs/LowFast.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 174, + "mean": 1024, + "noise": 0.1, + "period_len_ms": 90000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/prompt-len-configs/LowSlow.json b/benchmarks/generator/config/predefined/prompt-len-configs/LowSlow.json new file mode 100644 index 00000000..309b5dd7 --- /dev/null +++ b/benchmarks/generator/config/predefined/prompt-len-configs/LowSlow.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 174, + "mean": 1024, + "noise": 0.1, + "period_len_ms": 210000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/traffic-configs/HighFast.json b/benchmarks/generator/config/predefined/traffic-configs/HighFast.json new file mode 100644 index 00000000..efd10b84 --- /dev/null +++ b/benchmarks/generator/config/predefined/traffic-configs/HighFast.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 3.6, + "mean": 6, + "noise": 0.1, + "period_len_ms": 120000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/traffic-configs/HighSlow.json b/benchmarks/generator/config/predefined/traffic-configs/HighSlow.json new file mode 100644 index 00000000..feb7cab4 --- /dev/null +++ b/benchmarks/generator/config/predefined/traffic-configs/HighSlow.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 3.6, + "mean": 6, + "noise": 0.1, + "period_len_ms": 1200000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/traffic-configs/LowFast.json b/benchmarks/generator/config/predefined/traffic-configs/LowFast.json new file mode 100644 index 00000000..039213d6 --- /dev/null +++ b/benchmarks/generator/config/predefined/traffic-configs/LowFast.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 0.6, + "mean": 6, + "noise": 0.1, + "period_len_ms": 120000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/predefined/traffic-configs/LowSlow.json b/benchmarks/generator/config/predefined/traffic-configs/LowSlow.json new file mode 100644 index 00000000..3a7870d3 --- /dev/null +++ b/benchmarks/generator/config/predefined/traffic-configs/LowSlow.json @@ -0,0 +1,7 @@ +{ + "fluctuate": 0.6, + "mean": 6, + "noise": 0.1, + "period_len_ms": 1200000, + "only_rise": false +} \ No newline at end of file diff --git a/benchmarks/generator/config/prompt-len-config.json b/benchmarks/generator/config/prompt-len-config.json deleted file mode 100644 index cd430e06..00000000 --- a/benchmarks/generator/config/prompt-len-config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "A": 15, - "B": 309, - "sigma": 0.1, - "period": 0.005, - "omega": null, - "only_rise": false -} \ No newline at end of file diff --git a/benchmarks/generator/config/traffic-config.json b/benchmarks/generator/config/traffic-config.json deleted file mode 100644 index c05e78fc..00000000 --- a/benchmarks/generator/config/traffic-config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "A": 2, - "B": 6, - "sigma": 0.1, - "period": 1, - "omega": null, - "only_rise": false -} \ No newline at end of file diff --git a/benchmarks/generator/distribution.py b/benchmarks/generator/distribution.py index a86d7a6e..0ec77e1d 100644 --- a/benchmarks/generator/distribution.py +++ b/benchmarks/generator/distribution.py @@ -84,4 +84,16 @@ def to_fluctuate_pattern_config(config_type: str, 'omega': None, 'only_rise': False} else: - raise ValueError(f"Unknown config type: {config_type}") \ No newline at end of file + raise ValueError(f"Unknown config type: {config_type}") + + +def user_to_synthetic_config(user_config: Dict, + duration_ms: int,): + return { + 'A': float(user_config['fluctuate']), + 'B': float(user_config['mean']), + 'sigma': float(user_config['noise']), + 'period': duration_ms/float(user_config['period_len_ms']), + 'omega': None, + 'only_rise': user_config['only_rise'], + } \ No newline at end of file diff --git a/benchmarks/generator/workload_generator.py b/benchmarks/generator/workload_generator.py index a98f4de1..8fb9f3f9 100644 --- a/benchmarks/generator/workload_generator.py +++ b/benchmarks/generator/workload_generator.py @@ -17,6 +17,7 @@ from distribution import (generate_poisson_dist, generate_token_len_from_percentiles, to_fluctuate_pattern_config, + user_to_synthetic_config, ) from utils import (convert_to_stat_df, @@ -240,8 +241,10 @@ def math_function(t, pattern_config, length, prev_value): sharegpt_df = load_requests(dataset_path=prompt_file_path, tokenizer=tokenizer) while t < length: current_concurrency, previous_concurrency = math_function(t, qps_pattern_config, length, previous_concurrency) - current_input_len, previous_input_len = math_function(t, input_pattern_config, length, previous_input_len) + current_input_len, previous_input_len = math_function(t, input_pattern_config, length, previous_input_len) current_output_len, previous_output_len = math_function(t, output_pattern_config, length, previous_output_len) + current_input_len = current_input_len if current_input_len > 0 else 1 + current_output_len = current_output_len if current_output_len > 0 else 1 current_concurrency_pois = generate_poisson_dist(target = current_concurrency, sample_size = 1) current_input_len_pois = generate_poisson_dist(target = current_input_len, sample_size = 1) current_output_len_pois = generate_poisson_dist(target = current_output_len, sample_size = 1) @@ -426,9 +429,9 @@ def pair_requests_with_prompts_round_robin(workload: List[List[Any]], elif args.traffic_pattern_config and args.prompt_len_pattern_config and args.completion_len_pattern_config: logging.info(f"Generating synthetic workload with traffic pattern config: {args.traffic_pattern_config}, prompt length pattern config: {args.prompt_len_pattern_config}, completion length pattern config: {args.completion_len_pattern_config}") comp_pattern_type = f"synthetic_manual_config" - qps_pattern_config = load_config(args.traffic_pattern_config) - input_pattern_config = load_config(args.prompt_len_pattern_config) - output_pattern_config = load_config(args.completion_len_pattern_config) + qps_pattern_config = user_to_synthetic_config(user_config = load_config(args.traffic_pattern_config), duration_ms = args.duration_ms) + input_pattern_config = user_to_synthetic_config(user_config = load_config(args.prompt_len_pattern_config), duration_ms = args.duration_ms) + output_pattern_config = user_to_synthetic_config(user_config = load_config(args.completion_len_pattern_config), duration_ms = args.duration_ms) logging.debug(f"qps_pattern_config {qps_pattern_config}") logging.debug(f"input_pattern_config {input_pattern_config}") logging.debug(f"output_pattern_config {output_pattern_config}")