Bug #85175 Changing security/limits.conf does not apply on systemd systems
Submitted: 24 Feb 2017 15:28 Modified: 4 Aug 2017 20:11
Reporter: Kenny Gryp Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.7 OS:CentOS
Assigned to: Terje Røsten CPU Architecture:Any

[24 Feb 2017 15:28] Kenny Gryp
Description:

https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_page_cleaners

The documentation states that you have to change `/etc/security/limits.conf` in order to enable thread priority scheduling.

However, systemd does not read those files, you have to do it in another way

How to repeat:

When starting mysql I get this 'note', which is also not really clear on that thread priority is disabled:

[Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

to have thread priorities work with centos7, I had to change:

----
[root@ip-192-168-0-142 vagrant]# cat /etc/systemd/system/mysql.service.d/limits.conf 
[Service]
LimitNICE=-20
----

note that you have to type 

# systemctl daemon-reload

when you want to apply this

Here's how to check the limit of a running daemon:
when not configured:

# cat /proc/`pidof mysqld`/limits | grep nice
Max nice priority         0                    0      

when configured:

# cat /proc/`pidof mysqld`/limits  | grep nice
Max nice priority         18446744073709551596 18446744073709551596 

Suggested fix:

- at least add the systemd solution to the documentation
- or even better: ship with the configuration included for the packages that are meant for systemd OSes
[24 Feb 2017 19:26] Terje Røsten
Hi!

Thanks for your report!

Can you please have a look at the following doc:

 https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html

and can post your comments and report any issue found, thanks!
[24 Feb 2017 22:03] Kenny Gryp
The link https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html seems to show various ways on how to deal with systemd, including on how you can create a config file to configure the limits in there.

However:
- it does not mention LimitNice at all, which is required to have thread priority scheduling (it does mention nice, but that's a default setting instead of a max setting)
- It does not mention you need to configure LimitNice to have support for setting page cleaners priority
[24 Feb 2017 22:03] Kenny Gryp
Oh and I mentioned the message during startup was not really helpful, that's already reported in https://bugs.mysql.com/bug.php?id=80115, but still marked 'Open' :(
[26 Feb 2017 8:40] Terje Røsten
Thanks for very useful comments!
[4 Aug 2017 20:11] Daniel Price
Posted by developer:
 
The innodb_page_cleaners documentation has been revised:

https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_page_cleaners

Thank you for the bug report.