Re: Tuned service on Linux

  • From: Mladen Gogala <gogala.mladen@xxxxxxxxx>
  • To: Martin Berger <martin.a.berger@xxxxxxxxx>
  • Date: Sun, 11 Feb 2024 11:56:43 -0500

On Sun, 2024-02-11 at 16:26 +0100, Martin Berger wrote:

Hi Mladen, 

I checked file /usr/lib/tuned/oracle/tuned.conf On my system it contains 
#
# tuned configuration
#

[main]
summary=Optimize for Oracle RDBMS
include=throughput-performance

[sysctl]
vm.swappiness = 10
vm.dirty_background_ratio = 3
vm.dirty_ratio = 40
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65499
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
kernel.panic_on_oops = 1
kernel.numa_balancing = 0

[vm]
transparent_hugepages=never

For a full overview you also have to check the throughput-
performance configuration. 

I would not care so much about the dirty_* parameters - as long as my
Instances use direct-IO. 
Swappiness is a religious discussion: I prefer to have sufficient memory
so swap does never (significantly) occur, but I accept other messages of
salvation. 
shmmni can be a problem for very large systems - the alert.log will tell
you (assuming hugepages are used)  
numa_balancing  will not make any difference until you have huge server
with high variance in NUMA distances). Then it might depend how you use
this system (one single SGA, multiple independent instances, ...) and it
might require cgroups or other methods to do a specific NUMA
configuration.  

Personally I don't expect any harm but also no significant gain. vm.
settings will not gain a lot, kernel.memory settings are ok, if they are
not you will see at instance startup. 
 
hth, 
 Martin 

Thanks Martin, 
I have the same file. It looks like the "oracle" profile applies Red Hat
recommendation for writing out the modified ("dirty") pages. Basically, Red
Hat recommends dirty pages to be written out as soon as they're modified,
so that I/O is spread over time and that there aren't any spikes when the
database crunch time hits. However, if the SGA is sized correctly, there
shouldn't be much of paging activity anyway, so that recommendation doesn't
really matter.
Furthermore, I am not really sure what does the "tuned" service do? Does it
blindly change the values, based on the profile definition, or does it do
some intelligent analysis? Based on the /var/log/tuned/tuned.log, I would
say it simply overrides the values defined in /etc/sysctl.conf with the new
values. In plain English, that means that tuned undoes the careful tuning
of /etc/sysctl.conf with some magic values recommended by Red Hat. Here is
the snippet from tuned.log that made me conclude this:

2024-02-11 10:06:29,519 INFO     tuned.plugins.plugin_sysctl: reapplying system 
sysctl
2024-02-11 10:06:29,530 INFO     tuned.plugins.plugin_sysctl: Overriding sysctl 
parameter 'vm.dirty_background_ratio' from '10' to '5'
2024-02-11 10:06:29,530 INFO     tuned.plugins.plugin_sysctl: Overriding sysctl 
parameter 'vm.dirty_ratio' from '40' to '10'
2024-02-11 10:06:29,543 INFO     tuned.plugins.plugin_sysctl: Overriding sysctl 
parameter 'vm.dirty_background_ratio' from '10' to '5'
2024-02-11 10:06:29,543 INFO     tuned.plugins.plugin_sysctl: Overriding sysctl 
parameter 'vm.dirty_ratio' from '40' to '10'
2024-02-11 10:06:29,543 INFO     tuned.daemon.daemon: static tuning from profile
 'throughput-performance' applied
2024-02-11 10:06:39,548 INFO     tuned.plugins.plugin_cpu: setting new cpu laten
cy 100
2024-02-11 10:06:59,475 INFO     tuned.daemon.controller: terminating controller
2024-02-11 10:06:59,475 INFO     tuned.daemon.daemon: stopping tuning
2024-02-11 10:06:59,486 INFO     tuned.daemon.daemon: terminating TuneD, rolling
 back all changes

And I confirmed that the changed parameters are in effect:

gogala@umajor:/proc/sys/vm$ cat dirty_ratio 
10
mgogala@umajor:

So, it looks like this "tuned" thingy is just another mechanism for
altering the sysctl.conf parameters. In other words, "tuned" is probably
unnecessary.

-- 
Mladen Gogala
Database SME
https://dbwhisperer.wordpress.com

Other related posts: