Skip to content

Commit

Permalink
live autotune of slab automove window
Browse files Browse the repository at this point in the history
  • Loading branch information
dormando committed Nov 22, 2024
1 parent 269d2b2 commit 051ade8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static void settings_init(void) {
settings.slab_automove = 1;
settings.slab_automove_version = 0;
settings.slab_automove_ratio = 0.8;
settings.slab_automove_window = 30;
settings.slab_automove_window = 10;
settings.shutdown_command = false;
settings.tail_repair_time = TAIL_REPAIR_TIME_DEFAULT;
settings.flush_enabled = true;
Expand Down
12 changes: 10 additions & 2 deletions proto_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,15 +2317,23 @@ static void process_slabs_automove_command(conn *c, token_t *tokens, const size_
return;
}
// TODO: settings needs an overhaul... no locks/etc.
settings.slab_automove_version++;
settings.slab_automove_ratio = ratio;
settings.slab_automove_version++;
} else if (strcmp(tokens[2].value, "freeratio") == 0) {
if (ntokens < 5 || !safe_strtod(tokens[3].value, &ratio)) {
out_string(c, "ERROR");
return;
}
settings.slab_automove_version++;
settings.slab_automove_freeratio = ratio;
settings.slab_automove_version++;
} else if (strcmp(tokens[2].value, "window") == 0) {
if (ntokens < 5 || !safe_strtoul(tokens[3].value, (uint32_t*)&level)) {
out_string(c, "CLIENT_ERROR bad command line format");
return;
}

settings.slab_automove_window = level;
settings.slab_automove_version++;
} else {
if (!safe_strtoul(tokens[2].value, (uint32_t*)&level)) {
out_string(c, "CLIENT_ERROR bad command line format");
Expand Down

0 comments on commit 051ade8

Please sign in to comment.