Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
add benchmark into gh action workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
J-HowHuang committed Apr 26, 2024
1 parent 27a7976 commit 4b2d703
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark_group_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- run-server
runs-on: ${{ needs.start-runner.outputs.benchmark-label }} # run the job on the newly created runner
env:
SERVER_IP: ${{ needs.start-runner.outputs.private-ip }}
SERVER_URL: http://${{ needs.start-runner.outputs.private-ip }}:26379
steps:
- name: Clone Server
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ async-trait = "0.1"
rocket = { version = "0.5.0", features = ["json"] }
reqwest = { version = "0.11", features = ["stream", "json"] }
csv = "1.3.0"
istziio-client = "0.1.0"
istziio-client = "0.1.1"
4 changes: 3 additions & 1 deletion src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ pub async fn run_trace(mut trace: VecDeque<TraceEntry>, client_builder: &dyn Fn(
let req = next_entry.request;

let res = client.request_data_sync(req.clone()).await;
assert!(res.is_ok());
if let Err(e) = res {
println!("Error: {}", e);
}
let client_duration = client_start.elapsed();
tx.send(client_duration).await.unwrap();
});
Expand Down
8 changes: 6 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ use std::fs;
use std::path::Path;

pub fn setup_client_1() -> Box<dyn StorageClient> {
let server_url = std::env::var("SERVER_URL").unwrap_or(String::from("http://127.0.0.1:26379"));
println!("server url: {}", &server_url);
let bench_files_path = "./bench_files".to_string();
let map = create_table_file_map(&bench_files_path).unwrap();
Box::new(StorageClientImpl::new_for_test(1, map.clone()))
Box::new(StorageClientImpl::new_for_test(1, map.clone(), &server_url))
}

pub fn setup_client_2() -> Box<dyn StorageClient> {
let server_url = std::env::var("SERVER_URL").unwrap_or(String::from("http://127.0.0.1:26379"));
println!("server url: {}", &server_url);
let bench_files_path = "./bench_files".to_string();
let map = create_table_file_map(&bench_files_path).unwrap();
Box::new(StorageClientImpl::new_for_test(1, map.clone()))
Box::new(StorageClientImpl::new_for_test(1, map.clone(), &server_url))
}

pub fn create_table_file_map(directory: &str) -> Result<HashMap<TableId, String>, std::io::Error> {
Expand Down
3 changes: 0 additions & 3 deletions traces/trace1.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ timestamp,file
300,0
1000,1
1000,1
1000,1
1000,1
1000,1
3000,2
9000,3

0 comments on commit 4b2d703

Please sign in to comment.