Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 70c4ed7

Browse files
Andronik Ordiandvdplm
andauthored
informant: display I/O stats (#11523)
* informant: collect I/O stats for state_db * informat: debug i/o log * informat: remove unused cache hit ratio * Cargo.lock: cargo update -p librocksdb-sys * [deps]: upgrade kvdb-rocksdb to 0.6 * Update ethcore/types/src/client_types.rs Co-Authored-By: David <dvdplm@gmail.com> Co-authored-by: David <dvdplm@gmail.com>
1 parent 3231454 commit 70c4ed7

File tree

16 files changed

+144
-36
lines changed

16 files changed

+144
-36
lines changed

Cargo.lock

Lines changed: 74 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ journaldb = { path = "util/journaldb" }
4141
jsonrpc-core = "14.0.3"
4242
keccak-hash = "0.4.0"
4343
kvdb = "0.4.0"
44-
kvdb-rocksdb = "0.5.0"
44+
kvdb-rocksdb = "0.6.0"
4545
log = "0.4"
4646
migration-rocksdb = { path = "util/migration-rocksdb" }
4747
node-filter = { path = "ethcore/node-filter" }

ethcore/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ journaldb = { path = "../util/journaldb" }
3333
keccak-hash = "0.4.0"
3434
kvdb = "0.4.0"
3535
kvdb-memorydb = { version = "0.4.0", optional = true }
36-
kvdb-rocksdb = { version = "0.5.0", optional = true }
36+
kvdb-rocksdb = { version = "0.6.0", optional = true }
3737
lazy_static = { version = "1.3", optional = true }
3838
log = "0.4"
3939
machine = { path = "./machine" }
@@ -78,7 +78,7 @@ ethjson = { path = "../json", features = ["test-helpers"] }
7878
parity-crypto = { version = "0.5.0", features = ["publickey"] }
7979
fetch = { path = "../util/fetch" }
8080
kvdb-memorydb = "0.4.0"
81-
kvdb-rocksdb = "0.5.0"
81+
kvdb-rocksdb = "0.6.0"
8282
lazy_static = "1.3"
8383
machine = { path = "./machine", features = ["test-helpers"] }
8484
parity-runtime = "0.1.1"

ethcore/service/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ trace-time = "0.1"
2323
[dev-dependencies]
2424
ethcore = { path = "..", features = ["test-helpers"] }
2525
ethcore-db = { path = "../db" }
26-
kvdb-rocksdb = "0.5.0"
26+
kvdb-rocksdb = "0.6.0"
2727
tempdir = "0.3"

ethcore/snapshot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ethabi-contract = "9.0.0"
5353
ethabi-derive = "9.0.1"
5454
ethcore = { path = "..", features = ["test-helpers"] }
5555
ethkey = { path = "../../accounts/ethkey" }
56-
kvdb-rocksdb = "0.5.0"
56+
kvdb-rocksdb = "0.6.0"
5757
lazy_static = { version = "1.3" }
5858
spec = { path = "../spec" }
5959
tempdir = "0.3"

ethcore/snapshot/snapshot-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ journaldb = { path = "../../../util/journaldb" }
2424
keccak-hash = "0.4.0"
2525
keccak-hasher = { path = "../../../util/keccak-hasher" }
2626
kvdb = "0.4.0"
27-
kvdb-rocksdb = "0.5.0"
27+
kvdb-rocksdb = "0.6.0"
2828
log = "0.4.8"
2929
parking_lot = "0.10.0"
3030
parity-crypto = { version = "0.5.0", features = ["publickey"] }

ethcore/src/client/client.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ use types::{
109109
BlockNumber,
110110
call_analytics::CallAnalytics,
111111
chain_notify::{ChainMessageType, ChainRoute, NewBlocks},
112-
client_types::{ClientReport, Mode, StateResult},
112+
client_types::{ClientReport, IoStats, Mode, StateResult},
113113
encoded,
114114
engines::{
115115
epoch::{PendingTransition, Transition as EpochTransition},
@@ -1096,7 +1096,19 @@ impl Client {
10961096
/// Get the report.
10971097
pub fn report(&self) -> ClientReport {
10981098
let mut report = self.report.read().clone();
1099-
report.state_db_mem = self.state_db.read().mem_used();
1099+
let state_db = self.state_db.read();
1100+
report.state_db_mem = state_db.mem_used();
1101+
let io_stats = state_db.journal_db().io_stats();
1102+
report.io_stats = IoStats {
1103+
transactions: io_stats.transactions,
1104+
reads: io_stats.reads,
1105+
cache_reads: io_stats.cache_reads,
1106+
writes: io_stats.writes,
1107+
bytes_read: io_stats.bytes_read,
1108+
cache_read_bytes: io_stats.cache_read_bytes,
1109+
bytes_written: io_stats.bytes_written,
1110+
};
1111+
11001112
report
11011113
}
11021114

ethcore/types/src/client_types.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,27 @@ pub struct ClientReport {
6262
pub gas_processed: U256,
6363
/// Memory used by state DB
6464
pub state_db_mem: usize,
65+
/// I/O statistics for the state DB.
66+
pub io_stats: IoStats,
67+
}
68+
69+
/// I/O statistics.
70+
#[derive(Default, Debug, Clone, Eq, PartialEq)]
71+
pub struct IoStats {
72+
/// Number of transaction.
73+
pub transactions: u64,
74+
/// Number of read operations.
75+
pub reads: u64,
76+
/// Number of reads resulted in a read from cache.
77+
pub cache_reads: u64,
78+
/// Number of write operations.
79+
pub writes: u64,
80+
/// Number of bytes read.
81+
pub bytes_read: u64,
82+
/// Number of bytes read from cache.
83+
pub cache_read_bytes: u64,
84+
/// Number of bytes write.
85+
pub bytes_written: u64,
6586
}
6687

6788
impl ClientReport {

ethcore/verification/src/queue/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<K: Kind, C> VerificationQueue<K, C> {
234234
let number_of_threads = if scale_verifiers {
235235
max_verifiers
236236
} else {
237-
cmp::min(default_amount, max_verifiers)
237+
default_amount
238238
};
239239

240240
let state = Arc::new((Mutex::new(State::Work(default_amount)), Condvar::new()));

parity/informant.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ impl<T: InformantData> Informant<T> {
257257
(diffed, full_report)
258258
};
259259

260+
debug!(
261+
target: "io_stats",
262+
"{} reads, {} writes, {} transactions",
263+
client_report.io_stats.reads,
264+
client_report.io_stats.writes,
265+
client_report.io_stats.transactions,
266+
);
267+
260268
let Report {
261269
importing,
262270
chain_info,

0 commit comments

Comments
 (0)