Re: Swappiness in Buster

2020-07-08 Thread Martin Reissner
For the sake of completeness, I seem to have solved it after some more
research and it turned out to be systemd, as following bug that was
reported for Centos7 seems to be applying to Debian Buster as well:

https://github.com/systemd/systemd/issues/9276

Luckily the workaround mentioned in:

https://github.com/systemd/systemd/issues/9276#issuecomment-442514543

applies here as well and by setting this to the desired swappiness value
and rebooting the system so far it seems to work as before and swapping
out is only done if it can't be avoided.

Martin



Re: Swappiness in Buster

2020-07-07 Thread Martin Reissner
On 06/07/2020 23:27, deloptes wrote:

> May be look deeper in documentation - I recall asking few years ago and was
> answered that now it would cache whatever it can and will free on demand.
> swap is done only if memory is really insufficient.
> 
> I don't recall when or where I asked read this
> 

I probably wouldn't understand much delving deeper into the
documentation or even code^^
Using up all the available RAM for disk cache and freeing cache when
memory is needed is what Linux did for as long as I can remember and
still does.
Swapping being only done when there is no memory available is exactly
what the "swappiness" parameter did when set to "1" in Stretch, but this
doesn't seem to work in Buster anymore as it swaps out the diskcache
even when there is memory available.



Re: Swappiness in Buster

2020-07-06 Thread Martin Reissner
On 06/07/2020 18:11, songbird wrote:
> Martin Reissner wrote:
> 
>> Hello,
>>
>> ever since upgrading machines to Buster the vm.swappiness sysctl
>> parameter doesn't seem to do anything anymore and regardless on how I
>> set it via sysctl or directly in /proc the system behaves as it would
>> have a pretty high swappiness and thus is swapping out quite a bit under
>> load, using the memory mostly for buff/cache.
>>
>> To make this clear, I'm seeing no performance degradation and there is
>> not much swapping in done, I'm merely wondering why this behaviour has
>> changed and if there's a way to make it work as before again. Also I'd
>> be happy to know if anybody else is experiencing this as Buster has been
>> out for a while now and I found some information on this ie. other users
>> reporting the same issue, but not really a lot.
>>
>> Now if you're asking why I would configure swap if I don't want it to be
>> used, the answer is monitoring and failsafe. I usually set the
>> swappiness to 1 so to only swap if the box runs out of memory and then
>> trigger an alarm to let us know something is up. This is much more
>> convenient than the oomkiller striking down a mysqld process just
>> because it was allowed to use a bit too much memory.
> 
>   i haven't noticed any issues with my desktop system set
> to 5, but i rarely if ever get much swapping going on 
> anyways.  i'm not using buster but using testing.
> 
>   if you are running a database oriented server i think
> the recommendation would be to set it to 0 or 1.
> 
> 
>   songbird
> 


Yeah, only talking about server and mostly database applications. I
usually set it to 1, but even tried 0 which disabled swap completely on
Stretch but on Buster it didn't make a difference at all, the setting
seems to be ignored while using default swappiness (60?) since Buster.

Following output is from a mariadb server that didn't swap at all
running Stretch.

root@server:~# cat /proc/sys/vm/swappiness
1
root@server:~# free -tm
  total used free   shared  buff/cache   available
Mem:  48284 9763  707   59   37814   38147
Swap: 11443 5020 6423
Total:5972814783 7131



Swappiness in Buster

2020-07-06 Thread Martin Reissner
Hello,

ever since upgrading machines to Buster the vm.swappiness sysctl
parameter doesn't seem to do anything anymore and regardless on how I
set it via sysctl or directly in /proc the system behaves as it would
have a pretty high swappiness and thus is swapping out quite a bit under
load, using the memory mostly for buff/cache.

To make this clear, I'm seeing no performance degradation and there is
not much swapping in done, I'm merely wondering why this behaviour has
changed and if there's a way to make it work as before again. Also I'd
be happy to know if anybody else is experiencing this as Buster has been
out for a while now and I found some information on this ie. other users
reporting the same issue, but not really a lot.

Now if you're asking why I would configure swap if I don't want it to be
used, the answer is monitoring and failsafe. I usually set the
swappiness to 1 so to only swap if the box runs out of memory and then
trigger an alarm to let us know something is up. This is much more
convenient than the oomkiller striking down a mysqld process just
because it was allowed to use a bit too much memory.

Cheers,

Martin