From 06f7167944dc7edba88590ba8fd790bca3165fdd Mon Sep 17 00:00:00 2001 From: Andrew Gooding Date: Tue, 19 Mar 2024 15:44:37 -0700 Subject: [PATCH] Version 6.5 - removed 'scheduler-mode' configuration, relaxed record size and range upper limits to 8M. --- README.md | 20 ++++++-------------- config/act_index.conf | 2 -- config/act_storage.conf | 2 -- src/common/cfg.c | 34 ---------------------------------- src/common/cfg.h | 1 - src/common/hardware.c | 31 ------------------------------- src/common/hardware.h | 1 - src/common/version.h | 2 +- src/index/act_index.c | 4 ---- src/index/cfg_index.c | 9 +-------- src/index/cfg_index.h | 1 - src/prep/act_prep.c | 2 -- src/storage/act_storage.c | 4 ---- src/storage/cfg_storage.c | 21 ++++++++------------- src/storage/cfg_storage.h | 1 - 15 files changed, 16 insertions(+), 119 deletions(-) diff --git a/README.md b/README.md index 5ad26ab..eee1932 100644 --- a/README.md +++ b/README.md @@ -524,19 +524,18 @@ is 1000, and large-block-op-kbytes is 128, we write (1504 x 1000) bytes per second, or (1504 x 1000) / (128 x 1024) = 11.4746 large blocks per second. With defrag-lwm-pct 50, we double this to simulate defragmentation where blocks depleted to 50%-used are re-packed, yielding a large-block write (and read) rate -of 22.949 blocks per second. +of 22.949 blocks per second. May not be larger than 8Mbytes. **record-bytes-range-max (act_storage ONLY)** If set, simulate a range of record sizes from record-bytes up to -record-bytes-range-max. Therefore if set, it must be larger than record-bytes -and smaller than or equal to large-block-op-kbytes. The simulation models a -linear distribution of sizes within the range. The default -record-bytes-range-max is 0, meaning no range -- model all records with size -record-bytes. +record-bytes-range-max. Therefore if set, it must be larger than record-bytes. +The simulation models a linear distribution of sizes within the range. The +default record-bytes-range-max is 0, meaning no range -- model all records with +size record-bytes. May not be larger than 8Mbytes. **large-block-op-kbytes (act_storage ONLY)** Size written and read in each large-block write and large-block read operation -respectively, in Kbytes. +respectively, in Kbytes. May not be larger than 8192 (8Mbytes). **replication-factor** Simulate the device load you would see if this node was in a cluster with the @@ -614,10 +613,3 @@ that this doesn't necessarily mean the devices failed the test - it means the transaction rates specified are too high to achieve with the configured number of service threads. Note - max-lag-sec 0 is a special value for which the test will not be stopped due to lag. The default max-lag-sec is 10. - -**scheduler-mode** -Mode in /sys/block//queue/scheduler for all the devices in the test run. -noop means no special scheduling is done for device I/O operations, cfq means -operations may be reordered to optimize for physical constraints imposed by -rotating disc devices (which likely means it hurts performance for ssds). If -the field is left out, the default is noop. diff --git a/config/act_index.conf b/config/act_index.conf index da08abe..1273e97 100644 --- a/config/act_index.conf +++ b/config/act_index.conf @@ -40,5 +40,3 @@ write-reqs-per-sec: 1000 # disable-odsync: no # max-lag-sec: 10 - -# scheduler-mode: noop diff --git a/config/act_storage.conf b/config/act_storage.conf index 92d19c1..f14b44e 100644 --- a/config/act_storage.conf +++ b/config/act_storage.conf @@ -51,5 +51,3 @@ write-reqs-per-sec: 1000 # tomb-raider-sleep-usec: 0 # max-lag-sec: 10 - -# scheduler-mode: noop diff --git a/src/common/cfg.c b/src/common/cfg.c index 4b3d4a0..e464800 100644 --- a/src/common/cfg.c +++ b/src/common/cfg.c @@ -36,19 +36,6 @@ #include -//========================================================== -// Typedefs & constants. -// - -static const char* const SCHEDULER_MODES[] = { - "noop", // default - "cfq" -}; - -static const uint32_t N_SCHEDULER_MODES = - (uint32_t)(sizeof(SCHEDULER_MODES) / sizeof(const char*)); - - //========================================================== // Public API. // @@ -79,27 +66,6 @@ parse_device_names(size_t max_num_devices, char names[][MAX_DEVICE_NAME_SIZE], } } -const char* -parse_scheduler_mode() -{ - const char* val = strtok(NULL, WHITE_SPACE); - - if (val == NULL) { - printf("ERROR: missing scheduler mode - using 'noop'\n"); - return "noop"; - } - - for (uint32_t m = 0; m < N_SCHEDULER_MODES; m++) { - if (strcmp(val, SCHEDULER_MODES[m]) == 0) { - return SCHEDULER_MODES[m]; - } - } - - printf("ERROR: unknown scheduler mode '%s' - using 'noop'\n", val); - - return "noop"; -} - uint32_t parse_uint32() { diff --git a/src/common/cfg.h b/src/common/cfg.h index fc9c414..b7a7a86 100644 --- a/src/common/cfg.h +++ b/src/common/cfg.h @@ -48,7 +48,6 @@ void parse_device_names(size_t max_num_devices, char names[][MAX_DEVICE_NAME_SIZE], uint32_t* p_num_devices); -const char* parse_scheduler_mode(); uint32_t parse_uint32(); bool parse_yes_no(); diff --git a/src/common/hardware.c b/src/common/hardware.c index 7f6347c..c0b3c92 100644 --- a/src/common/hardware.c +++ b/src/common/hardware.c @@ -116,37 +116,6 @@ num_cpus() return n_cpus; } -void -set_scheduler(const char* device_name, const char* mode) -{ - // TODO - could be much more general, like the latest Aerospike server, but - // for now let's just keep it really simple. - - const char* last_slash = strrchr(device_name, '/'); - const char* device_tag = last_slash ? last_slash + 1 : device_name; - - char scheduler_file_name[128]; - - strcpy(scheduler_file_name, "/sys/block/"); - strcat(scheduler_file_name, device_tag); - strcat(scheduler_file_name, "/queue/scheduler"); - - FILE* scheduler_file = fopen(scheduler_file_name, "w"); - - if (scheduler_file == NULL) { - printf("ERROR: couldn't open %s errno %d '%s'\n", scheduler_file_name, - errno, act_strerror(errno)); - return; - } - - if (fwrite(mode, strlen(mode), 1, scheduler_file) != 1) { - printf("ERROR: writing %s to %s errno %d '%s'\n", mode, - scheduler_file_name, errno, act_strerror(errno)); - } - - fclose(scheduler_file); -} - //========================================================== // Local helpers. diff --git a/src/common/hardware.h b/src/common/hardware.h index e8f9536..6c36a5d 100644 --- a/src/common/hardware.h +++ b/src/common/hardware.h @@ -36,4 +36,3 @@ // uint32_t num_cpus(); -void set_scheduler(const char* device_name, const char* mode); diff --git a/src/common/version.h b/src/common/version.h index 748787e..ec11e60 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -1 +1 @@ -#define VERSION "6.4" +#define VERSION "6.5" diff --git a/src/index/act_index.c b/src/index/act_index.c index 2ec5bf5..efae05b 100644 --- a/src/index/act_index.c +++ b/src/index/act_index.c @@ -172,10 +172,6 @@ main(int argc, char* argv[]) dev->name = (const char*)g_icfg.device_names[d]; - if (g_icfg.file_size == 0) { // normally 0 - set_scheduler(dev->name, g_icfg.scheduler_mode); - } - if (! (dev->fd_q = queue_create(sizeof(int))) || ! discover_device(dev) || ! (dev->read_hist = histogram_create(scale)) || diff --git a/src/index/cfg_index.c b/src/index/cfg_index.c index 1dd8a63..db9edf2 100644 --- a/src/index/cfg_index.c +++ b/src/index/cfg_index.c @@ -58,7 +58,6 @@ static const char TAG_REPLICATION_FACTOR[] = "replication-factor"; static const char TAG_DEFRAG_LWM_PCT[] = "defrag-lwm-pct"; static const char TAG_DISABLE_ODSYNC[] = "disable-odsync"; static const char TAG_MAX_LAG_SEC[] = "max-lag-sec"; -static const char TAG_SCHEDULER_MODE[] = "scheduler-mode"; //========================================================== @@ -80,8 +79,7 @@ index_cfg g_icfg = { .report_interval_us = 1000000, .replication_factor = 1, .defrag_lwm_pct = 50, - .max_lag_usec = 1000000 * 10, - .scheduler_mode = "noop" + .max_lag_usec = 1000000 * 10 }; @@ -160,9 +158,6 @@ index_configure(int argc, char* argv[]) else if (strcmp(tag, TAG_MAX_LAG_SEC) == 0) { g_icfg.max_lag_usec = (uint64_t)parse_uint32() * 1000000; } - else if (strcmp(tag, TAG_SCHEDULER_MODE) == 0) { - g_icfg.scheduler_mode = parse_scheduler_mode(); - } else { printf("ERROR: ignoring unknown config item '%s'\n", tag); return false; @@ -309,8 +304,6 @@ echo_configuration() g_icfg.disable_odsync ? "yes" : "no"); printf("%s: %" PRIu64 "\n", TAG_MAX_LAG_SEC, g_icfg.max_lag_usec / 1000000); - printf("%s: %s\n", TAG_SCHEDULER_MODE, - g_icfg.scheduler_mode); printf("\nDERIVED CONFIGURATION\n"); diff --git a/src/index/cfg_index.h b/src/index/cfg_index.h index 7f21ddf..7cf93ab 100644 --- a/src/index/cfg_index.h +++ b/src/index/cfg_index.h @@ -55,7 +55,6 @@ typedef struct index_cfg_s { uint32_t defrag_lwm_pct; bool disable_odsync; uint64_t max_lag_usec; // converted from literal units in seconds - const char* scheduler_mode; // Derived from literal configuration: uint64_t service_thread_reads_per_sec; diff --git a/src/prep/act_prep.c b/src/prep/act_prep.c index 9b1fa84..41b30bc 100644 --- a/src/prep/act_prep.c +++ b/src/prep/act_prep.c @@ -114,8 +114,6 @@ main(int argc, char* argv[]) strcpy(device_name, argv[1]); g_device_name = device_name; - set_scheduler(g_device_name, "noop"); - if (! discover_num_blocks()) { exit(-1); } diff --git a/src/storage/act_storage.c b/src/storage/act_storage.c index b680c42..9605e46 100644 --- a/src/storage/act_storage.c +++ b/src/storage/act_storage.c @@ -233,10 +233,6 @@ main(int argc, char* argv[]) dev->name = (const char*)g_scfg.device_names[n]; - if (g_scfg.file_size == 0) { // normally 0 - set_scheduler(dev->name, g_scfg.scheduler_mode); - } - if (! (dev->fd_q = queue_create(sizeof(int))) || ! discover_device(dev) || ! (dev->read_hist = histogram_create(scale)) || diff --git a/src/storage/cfg_storage.c b/src/storage/cfg_storage.c index d6b558c..7957312 100644 --- a/src/storage/cfg_storage.c +++ b/src/storage/cfg_storage.c @@ -66,9 +66,10 @@ static const char TAG_COMMIT_TO_DEVICE[] = "commit-to-device"; static const char TAG_TOMB_RAIDER[] = "tomb-raider"; static const char TAG_TOMB_RAIDER_SLEEP_USEC[] = "tomb-raider-sleep-usec"; static const char TAG_MAX_LAG_SEC[] = "max-lag-sec"; -static const char TAG_SCHEDULER_MODE[] = "scheduler-mode"; -#define RBLOCK_SIZE 16 // must be power of 2 +// As in Aerospike server. +#define RBLOCK_SIZE 16 +#define WBLOCK_SIZE (8 * 1024 * 1024) //========================================================== @@ -92,8 +93,7 @@ storage_cfg g_scfg = { .replication_factor = 1, .defrag_lwm_pct = 50, .compress_pct = 100, - .max_lag_usec = 1000000 * 10, - .scheduler_mode = "noop" + .max_lag_usec = 1000000 * 10 }; @@ -213,9 +213,6 @@ storage_configure(int argc, char* argv[]) else if (strcmp(tag, TAG_MAX_LAG_SEC) == 0) { g_scfg.max_lag_usec = (uint64_t)parse_uint32() * 1000000; } - else if (strcmp(tag, TAG_SCHEDULER_MODE) == 0) { - g_scfg.scheduler_mode = parse_scheduler_mode(); - } else { printf("ERROR: ignoring unknown config item '%s'\n", tag); return false; @@ -262,19 +259,19 @@ check_configuration() return false; } - if (g_scfg.record_bytes == 0) { + if (g_scfg.record_bytes == 0 || g_scfg.record_bytes > WBLOCK_SIZE) { configuration_error(TAG_RECORD_BYTES); return false; } if (g_scfg.record_bytes_rmx != 0 && - g_scfg.record_bytes_rmx <= g_scfg.record_bytes) { + (g_scfg.record_bytes_rmx <= g_scfg.record_bytes || + g_scfg.record_bytes_rmx > WBLOCK_SIZE)) { configuration_error(TAG_RECORD_BYTES_RANGE_MAX); return false; } - if (g_scfg.large_block_ops_bytes < g_scfg.record_bytes || - g_scfg.large_block_ops_bytes < g_scfg.record_bytes_rmx || + if (g_scfg.large_block_ops_bytes > WBLOCK_SIZE || ! is_power_of_2(g_scfg.large_block_ops_bytes)) { configuration_error(TAG_LARGE_BLOCK_OP_KBYTES); return false; @@ -442,8 +439,6 @@ echo_configuration() g_scfg.tomb_raider_sleep_us); printf("%s: %" PRIu64 "\n", TAG_MAX_LAG_SEC, g_scfg.max_lag_usec / 1000000); - printf("%s: %s\n", TAG_SCHEDULER_MODE, - g_scfg.scheduler_mode); printf("\nDERIVED CONFIGURATION\n"); diff --git a/src/storage/cfg_storage.h b/src/storage/cfg_storage.h index c080b7e..b9dd3d5 100644 --- a/src/storage/cfg_storage.h +++ b/src/storage/cfg_storage.h @@ -63,7 +63,6 @@ typedef struct storage_cfg_s { bool tomb_raider; uint32_t tomb_raider_sleep_us; uint64_t max_lag_usec; // converted from literal units in seconds - const char* scheduler_mode; // Derived from literal configuration: uint32_t record_stored_bytes;