rocksdb/util/thread_status_impl.cc
Mark Callaghan 99ec2412e5 Make the benchmark scripts configurable and add tests
Summary:
This makes run_flash_bench.sh configurable. Previously it was hardwired for 1B keys and tests
ran for 12 hours each. That kept me from using it. This makes it configuable, adds more tests,
makes the duration per-test configurable and refactors the test scripts.

Adds the seekrandomwhilemerging test to db_bench which is the same as seekrandomwhilewriting except
the writer thread does Merge rather than Put.

Forces the stall-time column in compaction IO stats to use a fixed format (H:M:S) which makes
it easier to scrape and parse. Also adds an option to AppendHumanMicros to force a fixed format.
Sometimes automation and humans want different format.

Calls thread->stats.AddBytes(bytes); in db_bench for more tests to get the MB/sec summary
stats in the output at test end.

Adds the average ingest rate to compaction IO stats. Output now looks like:
https://gist.github.com/mdcallag/2bd64d18be1b93adc494

More information on the benchmark output is at https://gist.github.com/mdcallag/db43a58bd5ac624f01e1

For benchmark.sh changes default RocksDB configuration to reduce stalls:
* min_level_to_compress from 2 to 3
* hard_rate_limit from 2 to 3
* max_grandparent_overlap_factor and max_bytes_for_level_multiplier from 10 to 8
* L0 file count triggers from 4,8,12 to 4,12,20 for (start,stall,stop)

Task ID: #6596829

Blame Rev:

Test Plan:
run tools/run_flash_bench.sh

Revert Plan:

Database Impact:

Memcache Impact:

Other Notes:

EImportant:

- begin *PUBLIC* platform impact section -
Bugzilla: #
- end platform impact -

Reviewers: igor

Reviewed By: igor

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D36075
2015-03-30 11:28:25 -07:00

81 lines
2.2 KiB
C++

// Copyright (c) 2013, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
#include "rocksdb/env.h"
#include "rocksdb/thread_status.h"
#include "util/logging.h"
#include "util/thread_operation.h"
namespace rocksdb {
#if ROCKSDB_USING_THREAD_STATUS
const std::string& ThreadStatus::GetThreadTypeName(
ThreadStatus::ThreadType thread_type) {
static std::string thread_type_names[NUM_THREAD_TYPES + 1] = {
"High Pri", "Low Pri", "User", "Unknown"};
return thread_type_names[thread_type];
}
const std::string& ThreadStatus::GetOperationName(
ThreadStatus::OperationType op_type) {
return global_operation_table[op_type].name;
}
const std::string& ThreadStatus::GetOperationStageName(
ThreadStatus::OperationStage stage) {
return global_op_stage_table[stage].name;
}
const std::string& ThreadStatus::GetStateName(
ThreadStatus::StateType state_type) {
return global_state_table[state_type].name;
}
const std::string ThreadStatus::MicrosToString(uint64_t micros) {
if (micros == 0) {
return "";
}
const int kBufferLen = 100;
char buffer[kBufferLen];
AppendHumanMicros(micros, buffer, kBufferLen, false);
return std::string(buffer);
}
#else
const std::string& ThreadStatus::GetThreadTypeName(
ThreadStatus::ThreadType thread_type) {
static std::string dummy_str = "";
return dummy_str;
}
const std::string& ThreadStatus::GetOperationName(
ThreadStatus::OperationType op_type) {
static std::string dummy_str = "";
return dummy_str;
}
const std::string& ThreadStatus::GetOperationStageName(
ThreadStatus::OperationStage stage) {
static std::string dummy_str = "";
return dummy_str;
}
const std::string& ThreadStatus::GetStateName(
ThreadStatus::StateType state_type) {
static std::string dummy_str = "";
return dummy_str;
}
const std::string ThreadStatus::MicrosToString(
uint64_t op_elapsed_time) {
static std::string dummy_str = "";
return dummy_str;
}
#endif // ROCKSDB_USING_THREAD_STATUS
} // namespace rocksdb