mojira.dev

Flisk

Assigned

No issues.

Reported

No issues.

Comments

I tried the timerslack tweaking workaround suggested in the earlier comments. Sadly, I saw barely any improvement: ~17 % with default timerslack vs ~15 % with 200000–1000000 ns, all on an Intel(R) Celeron(R) CPU G1610T @ 2.30GHz.

As part of my tests I wrote a small C program that applies a custom timerslack value to programs started through it. This may be useful for anyone who is seeing notable improvements with a tweaked timerslack value. The program requires neither root privileges nor manual intervention on server restarts.

#include <sys/prctl.h>
#include <error.h>
#include <errno.h>
#include <unistd.h>

int main(int argc, char **argv) {
        if (argc < 2)
                error(1, 0, "usage: %s <command> [<args>]", argv[0]);

        if (prctl(PR_SET_TIMERSLACK, 1000000L, 0L, 0L, 0L) != 0)
                error(1, errno, "prctl");

        execvp(argv[1], argv + 1);
        error(1, errno, "execvp");
}

Usage instructions:

  1. Install GCC if it's not on your system already (e.g., on Debian: sudo apt install gcc)

  2. Put the code above in a file (e.g. copy, cat > slack.c, paste, Ctrl+D to finish writing)

  3. Optionally tweak the timerslack value in the prctl() call to whichever value works best for you

  4. Compile it (gcc slack.c -o slack)

  5. Run your server through it by prepending the program to the command that starts your server:

    ./slack java -Xmx1G -Xms1G -jar server.jar