2017-05-26 04:48:44 +08:00
|
|
|
/*
|
|
|
|
* Knobs.h
|
|
|
|
*
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
*
|
|
|
|
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FLOW_KNOBS_H
|
|
|
|
#define FLOW_KNOBS_H
|
|
|
|
#pragma once
|
|
|
|
|
2018-10-20 01:30:13 +08:00
|
|
|
#include "flow/Platform.h"
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
#include <map>
|
2020-04-02 04:59:06 +08:00
|
|
|
#include <set>
|
2017-05-26 04:48:44 +08:00
|
|
|
#include <string>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
class Knobs {
|
|
|
|
public:
|
|
|
|
bool setKnob( std::string const& name, std::string const& value ); // Returns true if the knob name is known, false if it is unknown
|
|
|
|
void trace();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void initKnob( double& knob, double value, std::string const& name );
|
|
|
|
void initKnob( int64_t& knob, int64_t value, std::string const& name );
|
|
|
|
void initKnob( int& knob, int value, std::string const& name );
|
2017-10-13 08:49:41 +08:00
|
|
|
void initKnob( std::string& knob, const std::string& value, const std::string& name );
|
2019-07-31 09:21:24 +08:00
|
|
|
void initKnob( bool& knob, bool value, std::string const& name );
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
std::map<std::string, double*> double_knobs;
|
|
|
|
std::map<std::string, int64_t*> int64_knobs;
|
|
|
|
std::map<std::string, int*> int_knobs;
|
2017-10-13 08:49:41 +08:00
|
|
|
std::map<std::string, std::string*> string_knobs;
|
2019-07-31 09:21:24 +08:00
|
|
|
std::map<std::string, bool*> bool_knobs;
|
2020-04-02 04:59:06 +08:00
|
|
|
std::set<std::string> explicitlySetKnobs;
|
2017-05-26 04:48:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class FlowKnobs : public Knobs {
|
|
|
|
public:
|
|
|
|
int AUTOMATIC_TRACE_DUMP;
|
|
|
|
double PREVENT_FAST_SPIN_DELAY;
|
|
|
|
double CACHE_REFRESH_INTERVAL_WHEN_ALL_ALTERNATIVES_FAILED;
|
|
|
|
|
|
|
|
double DELAY_JITTER_OFFSET;
|
|
|
|
double DELAY_JITTER_RANGE;
|
|
|
|
double BUSY_WAIT_THRESHOLD;
|
|
|
|
double CLIENT_REQUEST_INTERVAL;
|
2017-12-02 05:04:32 +08:00
|
|
|
double SERVER_REQUEST_INTERVAL;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
int DISABLE_ASSERTS;
|
|
|
|
double QUEUE_MODEL_SMOOTHING_AMOUNT;
|
|
|
|
|
|
|
|
int RANDOMSEED_RETRY_LIMIT;
|
2019-03-19 03:40:15 +08:00
|
|
|
double FAST_ALLOC_LOGGING_BYTES;
|
2019-03-21 02:20:47 +08:00
|
|
|
double HUGE_ARENA_LOGGING_BYTES;
|
2019-03-31 04:36:13 +08:00
|
|
|
double HUGE_ARENA_LOGGING_INTERVAL;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-09-05 08:37:34 +08:00
|
|
|
bool WRITE_TRACING_ENABLED;
|
2020-12-09 08:49:54 +08:00
|
|
|
int TRACING_UDP_LISTENER_PORT;
|
2020-09-05 08:37:34 +08:00
|
|
|
|
2020-01-29 04:09:37 +08:00
|
|
|
//run loop profiling
|
|
|
|
double RUN_LOOP_PROFILING_INTERVAL;
|
|
|
|
double SLOWTASK_PROFILING_LOG_INTERVAL;
|
2017-05-26 04:48:44 +08:00
|
|
|
double SLOWTASK_PROFILING_MAX_LOG_INTERVAL;
|
|
|
|
double SLOWTASK_PROFILING_LOG_BACKOFF;
|
2020-01-29 04:09:37 +08:00
|
|
|
double SATURATION_PROFILING_LOG_INTERVAL;
|
|
|
|
double SATURATION_PROFILING_MAX_LOG_INTERVAL;
|
|
|
|
double SATURATION_PROFILING_LOG_BACKOFF;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//connectionMonitor
|
|
|
|
double CONNECTION_MONITOR_LOOP_TIME;
|
|
|
|
double CONNECTION_MONITOR_TIMEOUT;
|
2019-06-28 15:39:51 +08:00
|
|
|
double CONNECTION_MONITOR_IDLE_TIMEOUT;
|
2019-06-29 04:43:22 +08:00
|
|
|
double CONNECTION_MONITOR_INCOMING_IDLE_MULTIPLIER;
|
2019-07-09 10:13:53 +08:00
|
|
|
double CONNECTION_MONITOR_UNREFERENCED_CLOSE_DELAY;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//FlowTransport
|
|
|
|
double CONNECTION_REJECTED_MESSAGE_DELAY;
|
|
|
|
double CONNECTION_ID_TIMEOUT;
|
|
|
|
double CONNECTION_CLEANUP_DELAY;
|
|
|
|
double INITIAL_RECONNECTION_TIME;
|
|
|
|
double MAX_RECONNECTION_TIME;
|
|
|
|
double RECONNECTION_TIME_GROWTH_RATE;
|
|
|
|
double RECONNECTION_RESET_TIME;
|
2020-08-31 09:49:49 +08:00
|
|
|
double ALWAYS_ACCEPT_DELAY;
|
2020-03-05 06:24:57 +08:00
|
|
|
int ACCEPT_BATCH_SIZE;
|
2020-04-11 08:02:11 +08:00
|
|
|
double INCOMPATIBLE_PEER_DELAY_BEFORE_LOGGING;
|
2020-10-07 04:58:05 +08:00
|
|
|
double PING_LOGGING_INTERVAL;
|
2020-10-07 08:38:09 +08:00
|
|
|
int PING_SAMPLE_AMOUNT;
|
2020-11-06 04:14:35 +08:00
|
|
|
int NETWORK_CONNECT_SAMPLE_AMOUNT;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2018-07-27 08:21:23 +08:00
|
|
|
int TLS_CERT_REFRESH_DELAY_SECONDS;
|
2020-01-11 08:19:41 +08:00
|
|
|
double TLS_SERVER_CONNECTION_THROTTLE_TIMEOUT;
|
2020-01-13 14:12:18 +08:00
|
|
|
double TLS_CLIENT_CONNECTION_THROTTLE_TIMEOUT;
|
2020-01-22 10:58:34 +08:00
|
|
|
int TLS_SERVER_CONNECTION_THROTTLE_ATTEMPTS;
|
|
|
|
int TLS_CLIENT_CONNECTION_THROTTLE_ATTEMPTS;
|
2020-06-29 08:29:13 +08:00
|
|
|
int TLS_CLIENT_HANDSHAKE_THREADS;
|
|
|
|
int TLS_SERVER_HANDSHAKE_THREADS;
|
2020-06-23 16:32:08 +08:00
|
|
|
int TLS_HANDSHAKE_THREAD_STACKSIZE;
|
2020-06-29 08:29:13 +08:00
|
|
|
int TLS_MALLOC_ARENA_MAX;
|
2020-07-16 17:31:17 +08:00
|
|
|
int TLS_HANDSHAKE_LIMIT;
|
2018-07-27 08:21:23 +08:00
|
|
|
|
2020-02-11 07:03:35 +08:00
|
|
|
int NETWORK_TEST_CLIENT_COUNT;
|
2019-08-22 09:37:50 +08:00
|
|
|
int NETWORK_TEST_REPLY_SIZE;
|
2020-02-11 07:03:35 +08:00
|
|
|
int NETWORK_TEST_REQUEST_COUNT;
|
|
|
|
int NETWORK_TEST_REQUEST_SIZE;
|
|
|
|
bool NETWORK_TEST_SCRIPT_MODE;
|
2018-07-27 08:21:23 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
//AsyncFileCached
|
|
|
|
int64_t PAGE_CACHE_4K;
|
|
|
|
int64_t PAGE_CACHE_64K;
|
|
|
|
int64_t SIM_PAGE_CACHE_4K;
|
|
|
|
int64_t SIM_PAGE_CACHE_64K;
|
|
|
|
int64_t BUGGIFY_SIM_PAGE_CACHE_4K;
|
|
|
|
int64_t BUGGIFY_SIM_PAGE_CACHE_64K;
|
2019-05-03 20:04:43 +08:00
|
|
|
std::string CACHE_EVICTION_POLICY; // for now, "random", "lru", are supported
|
2017-05-26 04:48:44 +08:00
|
|
|
int MAX_EVICT_ATTEMPTS;
|
2018-10-06 06:05:26 +08:00
|
|
|
double PAGE_CACHE_TRUNCATE_LOOKUP_FRACTION;
|
2019-04-05 05:11:12 +08:00
|
|
|
double TOO_MANY_CONNECTIONS_CLOSED_RESET_DELAY;
|
|
|
|
int TOO_MANY_CONNECTIONS_CLOSED_TIMEOUT;
|
2020-01-09 05:31:58 +08:00
|
|
|
int PEER_UNAVAILABLE_FOR_LONG_TIME_TIMEOUT;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-10-16 01:22:18 +08:00
|
|
|
//AsyncFileEIO
|
|
|
|
int EIO_MAX_PARALLELISM;
|
2019-10-25 02:39:55 +08:00
|
|
|
int EIO_USE_ODIRECT;
|
2019-10-16 01:22:18 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
//AsyncFileKAIO
|
|
|
|
int MAX_OUTSTANDING;
|
|
|
|
int MIN_SUBMIT;
|
2017-06-16 17:14:19 +08:00
|
|
|
|
|
|
|
int PAGE_WRITE_CHECKSUM_HISTORY;
|
2019-03-13 05:04:18 +08:00
|
|
|
int DISABLE_POSIX_KERNEL_AIO;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//AsyncFileNonDurable
|
|
|
|
double MAX_PRIOR_MODIFICATION_DELAY;
|
|
|
|
|
|
|
|
//GenericActors
|
|
|
|
double BUGGIFY_FLOW_LOCK_RELEASE_DELAY;
|
2020-02-20 08:48:30 +08:00
|
|
|
int LOW_PRIORITY_DELAY_COUNT;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//IAsyncFile
|
|
|
|
int64_t INCREMENTAL_DELETE_TRUNCATE_AMOUNT;
|
|
|
|
double INCREMENTAL_DELETE_INTERVAL;
|
|
|
|
|
|
|
|
//Net2
|
|
|
|
double MIN_COALESCE_DELAY;
|
|
|
|
double MAX_COALESCE_DELAY;
|
|
|
|
double SLOW_LOOP_CUTOFF;
|
|
|
|
double SLOW_LOOP_SAMPLING_RATE;
|
|
|
|
int64_t TSC_YIELD_TIME;
|
|
|
|
int64_t REACTOR_FLAGS;
|
2020-02-08 06:34:24 +08:00
|
|
|
double MIN_LOGGED_PRIORITY_BUSY_FRACTION;
|
2020-02-21 02:43:34 +08:00
|
|
|
int CERT_FILE_MAX_SIZE;
|
2021-01-20 09:13:27 +08:00
|
|
|
int READY_QUEUE_RESERVED_SIZE;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//Network
|
|
|
|
int64_t PACKET_LIMIT;
|
|
|
|
int64_t PACKET_WARNING; // 2MB packet warning quietly allows for 1MB system messages
|
|
|
|
double TIME_OFFSET_LOGGING_INTERVAL;
|
2019-06-12 08:52:25 +08:00
|
|
|
int MAX_PACKET_SEND_BYTES;
|
|
|
|
int MIN_PACKET_BUFFER_BYTES;
|
2019-06-26 00:52:05 +08:00
|
|
|
int MIN_PACKET_BUFFER_FREE_BYTES;
|
2019-08-24 02:07:46 +08:00
|
|
|
int FLOW_TCP_NODELAY;
|
|
|
|
int FLOW_TCP_QUICKACK;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//Sim2
|
|
|
|
//FIMXE: more parameters could be factored out
|
|
|
|
double MIN_OPEN_TIME;
|
|
|
|
double MAX_OPEN_TIME;
|
|
|
|
int64_t SIM_DISK_IOPS;
|
|
|
|
int64_t SIM_DISK_BANDWIDTH;
|
|
|
|
double MIN_NETWORK_LATENCY;
|
|
|
|
double FAST_NETWORK_LATENCY;
|
|
|
|
double SLOW_NETWORK_LATENCY;
|
|
|
|
double MAX_CLOGGING_LATENCY;
|
|
|
|
double MAX_BUGGIFIED_DELAY;
|
2019-11-22 08:24:18 +08:00
|
|
|
int SIM_CONNECT_ERROR_MODE;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//Tracefiles
|
|
|
|
int ZERO_LENGTH_FILE_PAD;
|
|
|
|
double TRACE_FLUSH_INTERVAL;
|
|
|
|
double TRACE_RETRY_OPEN_INTERVAL;
|
|
|
|
int MIN_TRACE_SEVERITY;
|
|
|
|
int MAX_TRACE_SUPPRESSIONS;
|
2020-10-22 08:57:27 +08:00
|
|
|
bool TRACE_DATETIME_ENABLED;
|
2018-06-01 04:27:35 +08:00
|
|
|
int TRACE_SYNC_ENABLED;
|
2017-10-03 09:43:11 +08:00
|
|
|
int TRACE_EVENT_METRIC_UNITS_PER_SAMPLE;
|
2018-06-27 05:37:21 +08:00
|
|
|
int TRACE_EVENT_THROTTLER_SAMPLE_EXPIRY;
|
2017-10-03 09:43:11 +08:00
|
|
|
int TRACE_EVENT_THROTTLER_MSG_LIMIT;
|
2019-07-13 07:12:35 +08:00
|
|
|
int MAX_TRACE_FIELD_LENGTH;
|
|
|
|
int MAX_TRACE_EVENT_LENGTH;
|
2020-03-17 04:59:31 +08:00
|
|
|
bool ALLOCATION_TRACING_ENABLED;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
//TDMetrics
|
|
|
|
int64_t MAX_METRIC_SIZE;
|
|
|
|
int64_t MAX_METRIC_LEVEL;
|
2017-10-13 08:49:41 +08:00
|
|
|
double METRIC_LEVEL_DIVISOR;
|
2017-05-26 04:48:44 +08:00
|
|
|
int METRIC_LIMIT_START_QUEUE_SIZE;
|
|
|
|
int METRIC_LIMIT_RESPONSE_FACTOR;
|
|
|
|
int MAX_METRICS;
|
|
|
|
|
|
|
|
//Load Balancing
|
2019-07-17 03:46:02 +08:00
|
|
|
int LOAD_BALANCE_ZONE_ID_LOCALITY_ENABLED;
|
|
|
|
int LOAD_BALANCE_DC_ID_LOCALITY_ENABLED;
|
2017-05-26 04:48:44 +08:00
|
|
|
double LOAD_BALANCE_MAX_BACKOFF;
|
|
|
|
double LOAD_BALANCE_START_BACKOFF;
|
|
|
|
double LOAD_BALANCE_BACKOFF_RATE;
|
|
|
|
int64_t MAX_LAGGING_REQUESTS_OUTSTANDING;
|
|
|
|
double INSTANT_SECOND_REQUEST_MULTIPLIER;
|
|
|
|
double BASE_SECOND_REQUEST_TIME;
|
|
|
|
double SECOND_REQUEST_MULTIPLIER_GROWTH;
|
|
|
|
double SECOND_REQUEST_MULTIPLIER_DECAY;
|
|
|
|
double SECOND_REQUEST_BUDGET_GROWTH;
|
|
|
|
double SECOND_REQUEST_MAX_BUDGET;
|
|
|
|
double ALTERNATIVES_FAILURE_RESET_TIME;
|
|
|
|
double ALTERNATIVES_FAILURE_MIN_DELAY;
|
|
|
|
double ALTERNATIVES_FAILURE_DELAY_RATIO;
|
2019-08-10 03:35:19 +08:00
|
|
|
double ALTERNATIVES_FAILURE_MAX_DELAY;
|
|
|
|
double ALTERNATIVES_FAILURE_SLOW_DELAY_RATIO;
|
|
|
|
double ALTERNATIVES_FAILURE_SLOW_MAX_DELAY;
|
2019-08-10 04:03:40 +08:00
|
|
|
double ALTERNATIVES_FAILURE_SKIP_DELAY;
|
2017-10-20 06:36:32 +08:00
|
|
|
double FUTURE_VERSION_INITIAL_BACKOFF;
|
|
|
|
double FUTURE_VERSION_MAX_BACKOFF;
|
|
|
|
double FUTURE_VERSION_BACKOFF_GROWTH;
|
2019-08-20 04:59:49 +08:00
|
|
|
int LOAD_BALANCE_MAX_BAD_OPTIONS;
|
|
|
|
bool LOAD_BALANCE_PENALTY_IS_BAD;
|
2020-01-08 17:59:01 +08:00
|
|
|
double BASIC_LOAD_BALANCE_UPDATE_RATE;
|
|
|
|
double BASIC_LOAD_BALANCE_MAX_CHANGE;
|
|
|
|
double BASIC_LOAD_BALANCE_MAX_PROB;
|
2020-10-05 07:20:24 +08:00
|
|
|
int BASIC_LOAD_BALANCE_BUCKETS;
|
|
|
|
int BASIC_LOAD_BALANCE_COMPUTE_PRECISION;
|
|
|
|
double BASIC_LOAD_BALANCE_MIN_REQUESTS;
|
|
|
|
double BASIC_LOAD_BALANCE_MIN_CPU;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-03-20 14:21:41 +08:00
|
|
|
// Health Monitor
|
2020-04-09 10:34:40 +08:00
|
|
|
int FAILURE_DETECTION_DELAY;
|
2020-03-27 13:50:39 +08:00
|
|
|
bool HEALTH_MONITOR_MARK_FAILED_UNSTABLE_CONNECTIONS;
|
2020-03-20 14:21:41 +08:00
|
|
|
int HEALTH_MONITOR_CLIENT_REQUEST_INTERVAL_SECS;
|
|
|
|
int HEALTH_MONITOR_CONNECTION_MAX_CLOSED;
|
|
|
|
|
2020-04-02 04:59:06 +08:00
|
|
|
FlowKnobs();
|
|
|
|
void initialize(bool randomize = false, bool isSimulated = false);
|
2017-05-26 04:48:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern FlowKnobs const* FLOW_KNOBS;
|
|
|
|
|
|
|
|
#endif
|