Skip to content

Commit

Permalink
fix: add README.md to module TPCC & analyze table item (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould authored Nov 14, 2024
1 parent 6cfb28f commit 5f52b27
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 12 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<TpmC>
89.9205557572134 Tpmc
```
#### PG Wire Service
run `cargo run --features="net"` to start server
![start](./static/images/start.gif)
Expand Down
44 changes: 44 additions & 0 deletions tpcc/src/README.md
Original file line number Diff line number Diff line change
@@ -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.
<Constraint Check> (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)
<TpmC>
89.9205557572134 Tpmc
```

## Refer to
- https://github.com/AgilData/tpcc
8 changes: 5 additions & 3 deletions tpcc/src/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ impl<S: Storage> Load<S> {
pb.set_position(i_id as u64);
}
pb.finish_with_message("load completed!");
println!("[Analyze Table: item]");
let _ = db.run("analyze table item")?;
Ok(())
}

Expand Down Expand Up @@ -235,7 +237,7 @@ impl<S: Storage> Load<S> {
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(())
}
Expand Down Expand Up @@ -290,7 +292,7 @@ impl<S: Storage> Load<S> {
Self::load_customers(rng, db, d_id, w_id)?;
}
}
println!("analyze customer");
println!("[Analyze Table: customer]");
let _ = db.run("analyze table customer")?;

Ok(())
Expand Down Expand Up @@ -344,7 +346,7 @@ impl<S: Storage> Load<S> {
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")?;

Expand Down
20 changes: 11 additions & 9 deletions tpcc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct Args {
num_ware: usize,
}

// TODO: Support multi-threaded TPCC
fn main() -> Result<(), TpccError> {
let args = Args::parse();

Expand Down Expand Up @@ -125,6 +126,7 @@ fn main() -> Result<(), TpccError> {
} else {
late[i] += 1;
}
tx.commit()?;
break;
}
if j < args.max_retry {
Expand Down Expand Up @@ -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 {
Expand All @@ -206,7 +208,7 @@ fn main() -> Result<(), TpccError> {
println!();
rt_hist.hist_report();
println!("<TpmC>");
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(())
Expand Down

0 comments on commit 5f52b27

Please sign in to comment.