mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Save rocksdb statistics to file every minute (#932)
* Save rocksdb statistics to file every minute * Add flag to disable collecting rocksdb statistics
This commit is contained in:
parent
bf9848c60f
commit
7a6bfa7e7a
12 changed files with 85 additions and 11 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "rootdb.hpp"
|
||||
|
||||
#include "td/db/RocksDb.h"
|
||||
#include "td/utils/filesystem.h"
|
||||
|
||||
#include "ton/ton-tl.hpp"
|
||||
#include "ton/ton-io.hpp"
|
||||
|
@ -83,7 +84,12 @@ void CellDbIn::start_up() {
|
|||
};
|
||||
|
||||
CellDbBase::start_up();
|
||||
cell_db_ = std::make_shared<td::RocksDb>(td::RocksDb::open(path_).move_as_ok());
|
||||
if (!opts_->get_disable_rocksdb_stats()) {
|
||||
statistics_ = td::RocksDb::create_statistics();
|
||||
statistics_flush_at_ = td::Timestamp::in(60.0);
|
||||
}
|
||||
cell_db_ = std::make_shared<td::RocksDb>(td::RocksDb::open(path_, statistics_).move_as_ok());
|
||||
|
||||
|
||||
boc_ = vm::DynamicBagOfCellsDb::create();
|
||||
boc_->set_celldb_compress_depth(opts_->get_celldb_compress_depth());
|
||||
|
@ -156,6 +162,13 @@ void CellDbIn::get_cell_db_reader(td::Promise<std::shared_ptr<vm::CellDbReader>>
|
|||
}
|
||||
|
||||
void CellDbIn::alarm() {
|
||||
if (statistics_flush_at_ && statistics_flush_at_.is_in_past()) {
|
||||
statistics_flush_at_ = td::Timestamp::in(60.0);
|
||||
auto stats = td::RocksDb::statistics_to_string(statistics_);
|
||||
td::atomic_write_file(path_ + "/db_stats.txt", stats);
|
||||
td::RocksDb::reset_statistics(statistics_);
|
||||
}
|
||||
|
||||
if (migrate_after_ && migrate_after_.is_in_past()) {
|
||||
migrate_cells();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue