Skip to content

Commit

Permalink
Version 6.5 - removed 'scheduler-mode' configuration, relaxed record …
Browse files Browse the repository at this point in the history
…size and range upper limits to 8M.
  • Loading branch information
gooding470 committed Mar 19, 2024
1 parent 531f692 commit 06f7167
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 119 deletions.
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/<device>/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.
2 changes: 0 additions & 2 deletions config/act_index.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@ write-reqs-per-sec: 1000
# disable-odsync: no

# max-lag-sec: 10

# scheduler-mode: noop
2 changes: 0 additions & 2 deletions config/act_storage.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,3 @@ write-reqs-per-sec: 1000
# tomb-raider-sleep-usec: 0

# max-lag-sec: 10

# scheduler-mode: noop
34 changes: 0 additions & 34 deletions src/common/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@
#include <string.h>


//==========================================================
// 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.
//
Expand Down Expand Up @@ -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()
{
Expand Down
1 change: 0 additions & 1 deletion src/common/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
31 changes: 0 additions & 31 deletions src/common/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/common/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@
//

uint32_t num_cpus();
void set_scheduler(const char* device_name, const char* mode);
2 changes: 1 addition & 1 deletion src/common/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION "6.4"
#define VERSION "6.5"
4 changes: 0 additions & 4 deletions src/index/act_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) ||
Expand Down
9 changes: 1 addition & 8 deletions src/index/cfg_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";


//==========================================================
Expand All @@ -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
};


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down
1 change: 0 additions & 1 deletion src/index/cfg_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/prep/act_prep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 0 additions & 4 deletions src/storage/act_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) ||
Expand Down
21 changes: 8 additions & 13 deletions src/storage/cfg_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)


//==========================================================
Expand All @@ -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
};


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down
1 change: 0 additions & 1 deletion src/storage/cfg_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 06f7167

Please sign in to comment.