← Back to team overview

maria-discuss team mailing list archive

Re: mariadb runs at lowest priority (nice -n 19)



>>>>> "Panayot" == Panayot Belchev <panayot@xxxxxxxxxxx> writes:

Panayot> Hi,
Panayot> I just noticed that all our MariaDB 5.2 servers show the same:

Panayot> $ ps -eo ni,comm |grep mysql

Panayot>   9 mysqld_safe
Panayot>  19 mysql_isam_spac <defunct>
Panayot>  19 mysqld

Panayot> While servers with Oracle MySQL are at nice -n 0

Panayot> I tried setting

Panayot> niceness=-10

Panayot> in /usr/bin/mysqld_safe but with no effect. Is there a reason to run
Panayot> MariaDB at the lowest possible priority and is there a way to change
Panayot> that?

The code for MariaDB when it comes to priority should be identical to MySQL.

I did a quick test of just starting 'mysqld' in MySQL and MariaDB and
noticed the above too.

After some debugging I found the following in the pbxt code:


       if (pth_min_priority == pth_max_priority) {
                 /* Under Linux the priority of normal (non-runtime)
                  * threads are set using the standard methods
                  * for setting process priority.
                 /* We could set who == 0 because it should have the same affect
                  * as using the PID.
                 /* -20 = highest, 20 = lowest */
                 if (setpriority(PRIO_PROCESS, getpid(), 20) == -1)
                         return errno;
                 return 0;

This causes the mysqld process to be set to -19, which is clearly
wrong as pbxt should not affect the priority of it's caller.

For Paul: pth_min_priority and pth_max_priority are both 0 here.

I will for now ifdef away the above call to setpriority() in 5.1 and
above until we have a better solution.

A workaround until that is to disable pbxt with --skip-pbxt.
Please add the above to your my.cnf file and the above problems


Follow ups