From 5f52b27319bd49f98ef381c257c224d24c553dbb Mon Sep 17 00:00:00 2001 From: Kould <2435992353@qq.com> Date: Fri, 15 Nov 2024 01:33:27 +0800 Subject: [PATCH] fix: add `README.md` to module `TPCC` & analyze table item (#246) --- README.md | 14 ++++++++++++++ tpcc/src/README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ tpcc/src/load.rs | 8 +++++--- tpcc/src/main.rs | 20 +++++++++++--------- 4 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 tpcc/src/README.md diff --git a/README.md b/README.md index 4f7577fe..4aea7e7b 100755 --- a/README.md +++ b/README.md @@ -57,6 +57,20 @@ let tuples = fnck_sql.run("select * from t1")?; ### TPCC run `cargo run -p tpcc --release` to run tpcc +- i9-13900HX +- 32.0 GB +- YMTC PC411-1024GB-B +- Tips: TPCC currently only supports single thread +```shell +<90th Percentile RT (MaxRT)> + New-Order : 0.005 (0.007) + Payment : 0.084 (0.141) +Order-Status : 0.492 (0.575) + Delivery : 6.109 (6.473) + Stock-Level : 0.001 (0.001) + +89.9205557572134 Tpmc +``` #### PG Wire Service run `cargo run --features="net"` to start server ![start](./static/images/start.gif) diff --git a/tpcc/src/README.md b/tpcc/src/README.md new file mode 100644 index 00000000..f0afa6f3 --- /dev/null +++ b/tpcc/src/README.md @@ -0,0 +1,44 @@ +# TPCC on FnckSQL +run `cargo run -p tpcc --release` to run tpcc + +- i9-13900HX +- 32.0 GB +- YMTC PC411-1024GB-B +- Tips: TPCC currently only supports single thread +```shell +|New-Order| sc: 1084 lt: 0 fl: 11 +|Payment| sc: 1062 lt: 0 fl: 0 +|Order-Status| sc: 102 lt: 4 fl: 36 +|Delivery| sc: 107 lt: 0 fl: 0 +|Stock-Level| sc: 106 lt: 0 fl: 0 +in 723 sec. + (all must be [OK]) +[transaction percentage] + Payment: 43.0% (>=43.0%) [Ok] + Order-Status: 4.0% (>=4.0%) [Ok] + Delivery: 4.0% (>=4.0%) [Ok] + Stock-Level: 4.0% (>=4.0%) [Ok] +[response time (at least 90%% passed)] + New-Order: 100.0 [OK] + Payment: 100.0 [OK] + Order-Status: 96.2 [OK] + Delivery: 100.0 [OK] + Stock-Level: 100.0 [OK] + New-Order Total: 1084 + Payment Total: 1062 + Order-Status Total: 106 + Delivery Total: 107 + Stock-Level Total: 106 + +<90th Percentile RT (MaxRT)> + New-Order : 0.005 (0.007) + Payment : 0.084 (0.141) +Order-Status : 0.492 (0.575) + Delivery : 6.109 (6.473) + Stock-Level : 0.001 (0.001) + +89.9205557572134 Tpmc +``` + +## Refer to +- https://github.com/AgilData/tpcc \ No newline at end of file diff --git a/tpcc/src/load.rs b/tpcc/src/load.rs index 0e1a6d54..b1aee932 100644 --- a/tpcc/src/load.rs +++ b/tpcc/src/load.rs @@ -130,6 +130,8 @@ impl Load { pb.set_position(i_id as u64); } pb.finish_with_message("load completed!"); + println!("[Analyze Table: item]"); + let _ = db.run("analyze table item")?; Ok(()) } @@ -235,7 +237,7 @@ impl Load { pb.set_position(w_id as u64); } pb.finish_with_message("load completed!"); - println!("analyze stock"); + println!("[Analyze Table: stock]"); let _ = db.run("analyze table stock")?; Ok(()) } @@ -290,7 +292,7 @@ impl Load { Self::load_customers(rng, db, d_id, w_id)?; } } - println!("analyze customer"); + println!("[Analyze Table: customer]"); let _ = db.run("analyze table customer")?; Ok(()) @@ -344,7 +346,7 @@ impl Load { Self::load_orders(rng, db, d_id, w_id)?; } } - println!("analyze orders & order_line"); + println!("[Analyze Table: orders & order_line]"); let _ = db.run("analyze table orders")?; let _ = db.run("analyze table order_line")?; diff --git a/tpcc/src/main.rs b/tpcc/src/main.rs index 2d9091e1..637131d5 100644 --- a/tpcc/src/main.rs +++ b/tpcc/src/main.rs @@ -69,6 +69,7 @@ struct Args { num_ware: usize, } +// TODO: Support multi-threaded TPCC fn main() -> Result<(), TpccError> { let args = Args::parse(); @@ -125,6 +126,7 @@ fn main() -> Result<(), TpccError> { } else { late[i] += 1; } + tx.commit()?; break; } if j < args.max_retry { @@ -159,32 +161,32 @@ fn main() -> Result<(), TpccError> { j += (success[i] + late[i]) as f64; } // Payment - let f = ((success[1] + late[1]) as f64 / j) * 100.0; - print!(" Payment: {:.1}% (>=43.0%)", f); + let f = (((success[1] + late[1]) as f64 / j) * 100.0).round(); + print!(" Payment: {:.1}% (>=43.0%)", f); if f >= 43.0 { println!(" [Ok]"); } else { println!(" [NG]"); } // Order-Status - let f = ((success[2] + late[2]) as f64 / j) * 100.0; - print!(" Order-Status: {:.1}% (>=4.0%)", f); + let f = (((success[2] + late[2]) as f64 / j) * 100.0).round(); + print!(" Order-Status: {:.1}% (>=4.0%)", f); if f >= 4.0 { println!(" [Ok]"); } else { println!(" [NG]"); } // Delivery - let f = ((success[3] + late[3]) as f64 / j) * 100.0; - print!(" Order-Status: {:.1}% (>=4.0%)", f); + let f = (((success[3] + late[3]) as f64 / j) * 100.0).round(); + print!(" Delivery: {:.1}% (>=4.0%)", f); if f >= 4.0 { println!(" [Ok]"); } else { println!(" [NG]"); } // Stock-Level - let f = ((success[4] + late[4]) as f64 / j) * 100.0; - print!(" Order-Status: {:.1}% (>=4.0%)", f); + let f = (((success[4] + late[4]) as f64 / j) * 100.0).round(); + print!(" Stock-Level: {:.1}% (>=4.0%)", f); if f >= 4.0 { println!(" [Ok]"); } else { @@ -206,7 +208,7 @@ fn main() -> Result<(), TpccError> { println!(); rt_hist.hist_report(); println!(""); - let tpmc = (success[0] + late[0]) as f64 / (actual_tpcc_time.as_secs_f64() / 60.0); + let tpmc = ((success[0] + late[0]) as f64 / (actual_tpcc_time.as_secs_f64() / 60.0)).round(); println!("{} Tpmc", tpmc); Ok(())