Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice mode #99

Open
the9000 opened this issue Nov 17, 2024 · 3 comments
Open

Advice mode #99

the9000 opened this issue Nov 17, 2024 · 3 comments

Comments

@the9000
Copy link

the9000 commented Nov 17, 2024

In this mode bpftune should analyze the activity as normal, and generate desired actions as normal.

But instead of applying the actions immediately, it should suggest the action in a human-readable way, explaining the reasoning behind it, and listing the OS commands necessary to implement them.

The action can then be reviewed and applied, as is, modified, or not at all, by the actual system operator.

The suggested actions should be sent to syslog under a separate topic, a log file, etc, using the normal logging mechanisms already present in bpftune.

Ideally every advice would have a unique identifier, so as to detect duplicate advice, ignore known advice which is not being implemented, etc. The identifier could be e.g. a hash of a canonical representation of the actions to take.

@DominoTree
Copy link

This could be incredibly useful to simply find tuneables even worth looking at on systems with existing workloads

@alan-maguire
Copy link
Member

see rollback mode, described in issue #19 and merged in #60 . You can basically just run bpftune on the commandline using the -R option, and changes made will be rolled back, but described prior to rollback. As a recap I'll try and describe the approach taken there.

Central to the design of bpftune is that we make changes, see the effects and potentially roll back on those changes or double down on them if they work. Under this model there's no way to not apply suggested changes since the application of changes is needed to assess the effectiveness of the change. As a result, the rollback mode was introduced which tries to find optimal settings and when the program exits it will describe changes made. The changes are rolled back so the admin can decide whether to apply them or not.

@westurner
Copy link

westurner commented Nov 18, 2024

From https://news.ycombinator.com/item?id=42163597#42164688 and https://news.ycombinator.com/item?id=42167417 :

usage, main()

  • bpftune/src/bpftune.c

    Lines 280 to 296 in 6a50f5f

    int main(int argc, char *argv[])
    {
    static const struct option options[] = {
    { "allow", required_argument, NULL, 'a' },
    { "cgroup", required_argument, NULL, 'c' },
    { "daemon", no_argument, NULL, 'D' },
    { "debug", no_argument, NULL, 'd' },
    { "legacy", no_argument, NULL, 'L' },
    { "help", no_argument, NULL, 'h' },
    { "libdir", required_argument, NULL, 'l' },
    { "learning_rate", required_argument, NULL, 'r' },
    { "rollback", no_argument, NULL, 'R' },
    { "stderr", no_argument, NULL, 's' },
    { "support", no_argument, NULL, 'S' },
    { "version", no_argument, NULL, 'V' },
    { 0 }
    };
  • bpftune/src/bpftune.c

    Lines 230 to 244 in 6a50f5f

    fprintf(stderr,
    "Usage: %s [OPTIONS]\n"
    " OPTIONS := { { -a|--allow tuner}\n"
    " { -d|--debug} {-D|--daemon}\n"
    " { -c|--cgroup_path cgroup_path}\n"
    " { -L|--legacy}\n"
    " { -h|--help}}\n"
    " { -l|--library_path library_path}\n"
    " { -r|--learning_rate learning_rate}\n"
    " { -R|--rollback}\n"
    " { -s|--stderr}\n"
    " { -S|--suppport}\n"
    " { -V|--version}}\n",
    bin_name);
    }

.

  • DOC: what -R/--rollback does
  • ENH: CLI opts: --pretend-allow or --log-only-allow or [...]

Probably relevant function headers in libbpftune.c:

bpftune_sysctl_write(

bpftuner_tunable_sysctl_write(

bpftune_module_load(

static void bpftuner_scenario_log(struct bpftuner *tuner, unsigned int tunable,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants