Fixes to TPS calculation and reporting (#3836)

Fixes to TPS calculations and reporting
This commit is contained in:
Pankaj Garg 2019-04-17 15:37:01 -07:00 committed by GitHub
parent beb8c7914e
commit a2c8e3952f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 14 deletions

View File

@ -52,14 +52,14 @@ launchTestnet() {
declare q_mean_tps=' declare q_mean_tps='
SELECT round(mean("sum_count")) AS "mean_tps" FROM ( SELECT round(mean("sum_count")) AS "mean_tps" FROM (
SELECT sum("count") AS "sum_count" SELECT sum("count") AS "sum_count"
FROM "testnet-automation"."autogen"."counter-bank-process_transactions-txs" FROM "testnet-automation"."autogen"."counter-banking_stage-process_transactions"
WHERE time > now() - 300s GROUP BY time(1s) WHERE time > now() - 300s GROUP BY time(1s)
)' )'
declare q_max_tps=' declare q_max_tps='
SELECT round(max("sum_count")) AS "max_tps" FROM ( SELECT round(max("sum_count")) AS "max_tps" FROM (
SELECT sum("count") AS "sum_count" SELECT sum("count") AS "sum_count"
FROM "testnet-automation"."autogen"."counter-bank-process_transactions-txs" FROM "testnet-automation"."autogen"."counter-banking_stage-process_transactions"
WHERE time > now() - 300s GROUP BY time(1s) WHERE time > now() - 300s GROUP BY time(1s)
)' )'

View File

@ -115,6 +115,7 @@ impl BankingStage {
.iter() .iter()
.flat_map(|(p, start_index)| &p.packets[**start_index..]) .flat_map(|(p, start_index)| &p.packets[**start_index..])
.collect(); .collect();
inc_new_counter_info!("banking_stage-forwarded_packets", packets.len());
let blobs = packet::packets_to_blobs(&packets); let blobs = packet::packets_to_blobs(&packets);
for blob in blobs { for blob in blobs {
@ -132,12 +133,14 @@ impl BankingStage {
let mut bank_shutdown = false; let mut bank_shutdown = false;
for (msgs, offset, vers) in buffered_packets { for (msgs, offset, vers) in buffered_packets {
if bank_shutdown { if bank_shutdown {
inc_new_counter_info!("banking_stage-rebuffered_packets", vers.len() - *offset);
unprocessed_packets.push((msgs.to_owned(), *offset, vers.to_owned())); unprocessed_packets.push((msgs.to_owned(), *offset, vers.to_owned()));
continue; continue;
} }
let bank = poh_recorder.lock().unwrap().bank(); let bank = poh_recorder.lock().unwrap().bank();
if bank.is_none() { if bank.is_none() {
inc_new_counter_info!("banking_stage-rebuffered_packets", vers.len() - *offset);
unprocessed_packets.push((msgs.to_owned(), *offset, vers.to_owned())); unprocessed_packets.push((msgs.to_owned(), *offset, vers.to_owned()));
continue; continue;
} }
@ -145,7 +148,12 @@ impl BankingStage {
let (processed, verified_txs, verified_indexes) = let (processed, verified_txs, verified_indexes) =
Self::process_received_packets(&bank, &poh_recorder, &msgs, &vers, *offset)?; Self::process_received_packets(&bank, &poh_recorder, &msgs, &vers, *offset)?;
inc_new_counter_info!("banking_stage-consumed_buffered_packets", processed);
inc_new_counter_info!("banking_stage-process_transactions", processed);
inc_new_counter_info!(
"banking_stage-rebuffered_packets",
verified_txs.len() - processed
);
if processed < verified_txs.len() { if processed < verified_txs.len() {
bank_shutdown = true; bank_shutdown = true;
// Collect any unprocessed transactions in this batch for forwarding // Collect any unprocessed transactions in this batch for forwarding
@ -221,14 +229,14 @@ impl BankingStage {
// Buffer the packets if I am the next leader // Buffer the packets if I am the next leader
// or, if it was getting sent to me // or, if it was getting sent to me
// or, the next leader is unknown
let leader_id = match poh_recorder.lock().unwrap().bank() { let leader_id = match poh_recorder.lock().unwrap().bank() {
Some(bank) => { Some(bank) => {
leader_schedule_utils::slot_leader_at(bank.slot() + 1, &bank).unwrap_or_default() leader_schedule_utils::slot_leader_at(bank.slot() + 1, &bank).unwrap_or_default()
} }
None => rcluster_info None => rcluster_info
.leader_data() .leader_data()
.map(|x| x.id) .map_or(rcluster_info.id(), |x| x.id),
.unwrap_or_default(),
}; };
leader_id == rcluster_info.id() leader_id == rcluster_info.id()
@ -269,6 +277,13 @@ impl BankingStage {
Err(Error::RecvTimeoutError(RecvTimeoutError::Timeout)) => (), Err(Error::RecvTimeoutError(RecvTimeoutError::Timeout)) => (),
Ok(unprocessed_packets) => { Ok(unprocessed_packets) => {
if Self::should_buffer_packets(poh_recorder, cluster_info) { if Self::should_buffer_packets(poh_recorder, cluster_info) {
let num = unprocessed_packets
.iter()
.map(|(x, start, _)| {
x.read().unwrap().packets.len().saturating_sub(*start)
})
.sum();
inc_new_counter_info!("banking_stage-buffered_packets", num);
buffered_packets.extend_from_slice(&unprocessed_packets); buffered_packets.extend_from_slice(&unprocessed_packets);
continue; continue;
} }
@ -426,6 +441,7 @@ impl BankingStage {
poh, poh,
); );
trace!("process_transcations: {:?}", result); trace!("process_transcations: {:?}", result);
chunk_start = chunk_end;
if let Err(Error::PohRecorderError(PohRecorderError::MaxHeightReached)) = result { if let Err(Error::PohRecorderError(PohRecorderError::MaxHeightReached)) = result {
info!( info!(
"process transactions: max height reached slot: {} height: {}", "process transactions: max height reached slot: {} height: {}",
@ -435,7 +451,6 @@ impl BankingStage {
break; break;
} }
result?; result?;
chunk_start = chunk_end;
} }
Ok(chunk_start) Ok(chunk_start)
} }

View File

@ -16,7 +16,7 @@
"gnetId": null, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"id": 399, "id": 399,
"iteration": 1554844431880, "iteration": 1554844431890,
"links": [ "links": [
{ {
"asDropdown": true, "asDropdown": true,
@ -124,7 +124,7 @@
"hide": false, "hide": false,
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT ROUND(MEAN(\"sum\")) FROM ( SELECT sum(\"count\") FROM \"$testnet\".\"autogen\".\"counter-bank-process_transactions-txs\" WHERE $timeFilter GROUP BY time(1s) )\n\n", "query": "SELECT ROUND(MEAN(\"sum\")) FROM ( SELECT sum(\"count\") FROM \"$testnet\".\"autogen\".\"counter-banking_stage-process_transactions\" WHERE $timeFilter GROUP BY time(1s) )\n\n",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -236,7 +236,7 @@
"hide": false, "hide": false,
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT MAX(\"sum\") FROM ( SELECT sum(\"count\") FROM \"$testnet\".\"autogen\".\"counter-bank-process_transactions-txs\" WHERE $timeFilter GROUP BY time(1s) )\n\n", "query": "SELECT MAX(\"sum\") FROM ( SELECT sum(\"count\") FROM \"$testnet\".\"autogen\".\"counter-banking_stage-process_transactions\" WHERE $timeFilter GROUP BY time(1s) )\n\n",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -348,7 +348,7 @@
"hide": false, "hide": false,
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT sum(\"count\") AS \"transactions\" FROM \"$testnet\".\"autogen\".\"counter-bank-process_transactions-txs\" WHERE $timeFilter \n\n", "query": "SELECT sum(\"count\") AS \"transactions\" FROM \"$testnet\".\"autogen\".\"counter-banking_stage-process_transactions\" WHERE $timeFilter \n\n",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -1479,7 +1479,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT sum(\"count\") AS \"transactions\" FROM \"$testnet\".\"autogen\".\"counter-bank-process_transactions-txs\" WHERE $timeFilter GROUP BY time(1s) FILL(0)\n", "query": "SELECT sum(\"count\") AS \"transactions\" FROM \"$testnet\".\"autogen\".\"counter-banking_stage-process_transactions\" WHERE $timeFilter GROUP BY time(1s) FILL(0)\n",
"rawQuery": true, "rawQuery": true,
"refId": "B", "refId": "B",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -4238,7 +4238,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT sum(\"count\") AS \"count\" FROM \"$testnet\".\"autogen\".\"fetch-stage\" WHERE $timeFilter GROUP BY time($__interval) FILL(0)\n", "query": "SELECT sum(\"count\") AS \"count\" FROM \"$testnet\".\"autogen\".\"counter-packets-recv_count\" WHERE $timeFilter GROUP BY time($__interval) FILL(0)\n",
"rawQuery": true, "rawQuery": true,
"refId": "G", "refId": "G",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -6428,5 +6428,5 @@
"timezone": "", "timezone": "",
"title": "Testnet Monitor (edge)", "title": "Testnet Monitor (edge)",
"uid": "testnet-edge", "uid": "testnet-edge",
"version": 118 "version": 119
} }