mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 16:30:56 +00:00
3dff28cf9b
Summary: For performance purposes, the lower level routines were changed to use a SystemClock* instead of a std::shared_ptr<SystemClock>. The shared ptr has some performance degradation on certain hardware classes. For most of the system, there is no risk of the pointer being deleted/invalid because the shared_ptr will be stored elsewhere. For example, the ImmutableDBOptions stores the Env which has a std::shared_ptr<SystemClock> in it. The SystemClock* within the ImmutableDBOptions is essentially a "short cut" to gain access to this constant resource. There were a few classes (PeriodicWorkScheduler?) where the "short cut" property did not hold. In those cases, the shared pointer was preserved. Using db_bench readrandom perf_level=3 on my EC2 box, this change performed as well or better than 6.17: 6.17: readrandom : 28.046 micros/op 854902 ops/sec; 61.3 MB/s (355999 of 355999 found) 6.18: readrandom : 32.615 micros/op 735306 ops/sec; 52.7 MB/s (290999 of 290999 found) PR: readrandom : 27.500 micros/op 871909 ops/sec; 62.5 MB/s (367999 of 367999 found) (Note that the times for 6.18 are prior to revert of the SystemClock). Pull Request resolved: https://github.com/facebook/rocksdb/pull/8033 Reviewed By: pdillinger Differential Revision: D27014563 Pulled By: mrambacher fbshipit-source-id: ad0459eba03182e454391b5926bf5cdd45657b67
130 lines
3.9 KiB
C++
130 lines
3.9 KiB
C++
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "rocksdb/options.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
class SystemClock;
|
|
|
|
struct ImmutableDBOptions {
|
|
static const char* kName() { return "ImmutableDBOptions"; }
|
|
ImmutableDBOptions();
|
|
explicit ImmutableDBOptions(const DBOptions& options);
|
|
|
|
void Dump(Logger* log) const;
|
|
|
|
bool create_if_missing;
|
|
bool create_missing_column_families;
|
|
bool error_if_exists;
|
|
bool paranoid_checks;
|
|
bool track_and_verify_wals_in_manifest;
|
|
Env* env;
|
|
std::shared_ptr<FileSystem> fs;
|
|
SystemClock* clock;
|
|
std::shared_ptr<RateLimiter> rate_limiter;
|
|
std::shared_ptr<SstFileManager> sst_file_manager;
|
|
std::shared_ptr<Logger> info_log;
|
|
InfoLogLevel info_log_level;
|
|
int max_file_opening_threads;
|
|
std::shared_ptr<Statistics> statistics;
|
|
bool use_fsync;
|
|
std::vector<DbPath> db_paths;
|
|
std::string db_log_dir;
|
|
std::string wal_dir;
|
|
size_t max_log_file_size;
|
|
size_t log_file_time_to_roll;
|
|
size_t keep_log_file_num;
|
|
size_t recycle_log_file_num;
|
|
uint64_t max_manifest_file_size;
|
|
int table_cache_numshardbits;
|
|
uint64_t wal_ttl_seconds;
|
|
uint64_t wal_size_limit_mb;
|
|
uint64_t max_write_batch_group_size_bytes;
|
|
size_t manifest_preallocation_size;
|
|
bool allow_mmap_reads;
|
|
bool allow_mmap_writes;
|
|
bool use_direct_reads;
|
|
bool use_direct_io_for_flush_and_compaction;
|
|
bool allow_fallocate;
|
|
bool is_fd_close_on_exec;
|
|
bool advise_random_on_open;
|
|
size_t db_write_buffer_size;
|
|
std::shared_ptr<WriteBufferManager> write_buffer_manager;
|
|
DBOptions::AccessHint access_hint_on_compaction_start;
|
|
bool new_table_reader_for_compaction_inputs;
|
|
size_t random_access_max_buffer_size;
|
|
bool use_adaptive_mutex;
|
|
std::vector<std::shared_ptr<EventListener>> listeners;
|
|
bool enable_thread_tracking;
|
|
bool enable_pipelined_write;
|
|
bool unordered_write;
|
|
bool allow_concurrent_memtable_write;
|
|
bool enable_write_thread_adaptive_yield;
|
|
uint64_t write_thread_max_yield_usec;
|
|
uint64_t write_thread_slow_yield_usec;
|
|
bool skip_stats_update_on_db_open;
|
|
bool skip_checking_sst_file_sizes_on_db_open;
|
|
WALRecoveryMode wal_recovery_mode;
|
|
bool allow_2pc;
|
|
std::shared_ptr<Cache> row_cache;
|
|
#ifndef ROCKSDB_LITE
|
|
WalFilter* wal_filter;
|
|
#endif // ROCKSDB_LITE
|
|
bool fail_if_options_file_error;
|
|
bool dump_malloc_stats;
|
|
bool avoid_flush_during_recovery;
|
|
bool allow_ingest_behind;
|
|
bool preserve_deletes;
|
|
bool two_write_queues;
|
|
bool manual_wal_flush;
|
|
bool atomic_flush;
|
|
bool avoid_unnecessary_blocking_io;
|
|
bool persist_stats_to_disk;
|
|
bool write_dbid_to_manifest;
|
|
size_t log_readahead_size;
|
|
std::shared_ptr<FileChecksumGenFactory> file_checksum_gen_factory;
|
|
bool best_efforts_recovery;
|
|
int max_bgerror_resume_count;
|
|
uint64_t bgerror_resume_retry_interval;
|
|
bool allow_data_in_errors;
|
|
std::string db_host_id;
|
|
FileTypeSet checksum_handoff_file_types;
|
|
};
|
|
|
|
struct MutableDBOptions {
|
|
static const char* kName() { return "MutableDBOptions"; }
|
|
MutableDBOptions();
|
|
explicit MutableDBOptions(const MutableDBOptions& options) = default;
|
|
explicit MutableDBOptions(const DBOptions& options);
|
|
|
|
void Dump(Logger* log) const;
|
|
|
|
int max_background_jobs;
|
|
int base_background_compactions;
|
|
int max_background_compactions;
|
|
uint32_t max_subcompactions;
|
|
bool avoid_flush_during_shutdown;
|
|
size_t writable_file_max_buffer_size;
|
|
uint64_t delayed_write_rate;
|
|
uint64_t max_total_wal_size;
|
|
uint64_t delete_obsolete_files_period_micros;
|
|
unsigned int stats_dump_period_sec;
|
|
unsigned int stats_persist_period_sec;
|
|
size_t stats_history_buffer_size;
|
|
int max_open_files;
|
|
uint64_t bytes_per_sync;
|
|
uint64_t wal_bytes_per_sync;
|
|
bool strict_bytes_per_sync;
|
|
size_t compaction_readahead_size;
|
|
int max_background_flushes;
|
|
};
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|