mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
celldb in-memory mode (--celldb-in-memory option)
This commit is contained in:
parent
420029b056
commit
1723562748
48 changed files with 1966 additions and 201 deletions
|
@ -1432,7 +1432,11 @@ td::Status ValidatorEngine::load_global_config() {
|
|||
if (!session_logs_file_.empty()) {
|
||||
validator_options_.write().set_session_logs_file(session_logs_file_);
|
||||
}
|
||||
if (celldb_in_memory_) {
|
||||
celldb_compress_depth_ = 0;
|
||||
}
|
||||
validator_options_.write().set_celldb_compress_depth(celldb_compress_depth_);
|
||||
validator_options_.write().set_celldb_in_memory(celldb_in_memory_);
|
||||
validator_options_.write().set_max_open_archive_files(max_open_archive_files_);
|
||||
validator_options_.write().set_archive_preload_period(archive_preload_period_);
|
||||
validator_options_.write().set_disable_rocksdb_stats(disable_rocksdb_stats_);
|
||||
|
@ -1471,11 +1475,11 @@ td::Status ValidatorEngine::load_global_config() {
|
|||
}
|
||||
validator_options_.write().set_hardforks(std::move(h));
|
||||
|
||||
auto r_total_ram = td::get_total_ram();
|
||||
if (r_total_ram.is_error()) {
|
||||
LOG(ERROR) << "Failed to get total RAM size: " << r_total_ram.move_as_error();
|
||||
auto r_total_mem_stat = td::get_total_mem_stat();
|
||||
if (r_total_mem_stat.is_error()) {
|
||||
LOG(ERROR) << "Failed to get total RAM size: " << r_total_mem_stat.move_as_error();
|
||||
} else {
|
||||
td::uint64 total_ram = r_total_ram.move_as_ok();
|
||||
td::uint64 total_ram = r_total_mem_stat.ok().total_ram;
|
||||
LOG(WARNING) << "Total RAM = " << td::format::as_size(total_ram);
|
||||
if (total_ram >= (90ULL << 30)) {
|
||||
fast_state_serializer_enabled_ = true;
|
||||
|
@ -3778,9 +3782,8 @@ void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_addCustom
|
|||
});
|
||||
}
|
||||
|
||||
void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_delCustomOverlay &query,
|
||||
td::BufferSlice data, ton::PublicKeyHash src, td::uint32 perm,
|
||||
td::Promise<td::BufferSlice> promise) {
|
||||
void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_delCustomOverlay &query, td::BufferSlice data,
|
||||
ton::PublicKeyHash src, td::uint32 perm, td::Promise<td::BufferSlice> promise) {
|
||||
if (!(perm & ValidatorEnginePermissions::vep_modify)) {
|
||||
promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized")));
|
||||
return;
|
||||
|
@ -3820,8 +3823,8 @@ void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_showCusto
|
|||
return;
|
||||
}
|
||||
|
||||
promise.set_value(ton::serialize_tl_object<ton::ton_api::engine_validator_customOverlaysConfig>(
|
||||
custom_overlays_config_, true));
|
||||
promise.set_value(
|
||||
ton::serialize_tl_object<ton::ton_api::engine_validator_customOverlaysConfig>(custom_overlays_config_, true));
|
||||
}
|
||||
|
||||
void ValidatorEngine::run_control_query(ton::ton_api::engine_validator_setStateSerializerEnabled &query,
|
||||
|
@ -4248,7 +4251,8 @@ int main(int argc, char *argv[]) {
|
|||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option(
|
||||
'\0', "max-archive-fd", "limit for a number of open file descriptirs in archive manager. 0 is unlimited (default)",
|
||||
'\0', "max-archive-fd",
|
||||
"limit for a number of open file descriptirs in archive manager. 0 is unlimited (default)",
|
||||
[&](td::Slice s) -> td::Status {
|
||||
TRY_RESULT(v, td::to_integer_safe<size_t>(s));
|
||||
acts.push_back([&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_max_open_archive_files, v); });
|
||||
|
@ -4283,13 +4287,23 @@ int main(int argc, char *argv[]) {
|
|||
acts.push_back([&x, v]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_cache_size, v); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('\0', "celldb-direct-io",
|
||||
"enable direct I/O mode for RocksDb in CellDb (doesn't apply when celldb cache is < 30G)", [&]() {
|
||||
acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_direct_io, true); });
|
||||
});
|
||||
p.add_option('\0', "celldb-preload-all",
|
||||
"preload all cells from CellDb on startup (recommended to use with big enough celldb-cache-size and "
|
||||
"celldb-direct-io)",
|
||||
[&]() {
|
||||
acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_preload_all, true); });
|
||||
});
|
||||
|
||||
p.add_option(
|
||||
'\0', "celldb-direct-io", "enable direct I/O mode for RocksDb in CellDb (doesn't apply when celldb cache is < 30G)",
|
||||
[&]() { acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_direct_io, true); }); });
|
||||
p.add_option(
|
||||
'\0', "celldb-preload-all",
|
||||
"preload all cells from CellDb on startup (recommended to use with big enough celldb-cache-size and celldb-direct-io)",
|
||||
[&]() { acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_preload_all, true); }); });
|
||||
'\0', "celldb-in-memory",
|
||||
"store all cells in-memory, much faster but requires a lot of RAM. RocksDb is still used as persistent storage",
|
||||
[&]() {
|
||||
acts.push_back([&x]() { td::actor::send_closure(x, &ValidatorEngine::set_celldb_in_memory, true); });
|
||||
});
|
||||
p.add_checked_option(
|
||||
'\0', "catchain-max-block-delay", "delay before creating a new catchain block, in seconds (default: 0.4)",
|
||||
[&](td::Slice s) -> td::Status {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue