Re: To Swap, or not to Swap

From: pier paolo Bruno <pbrunoster_at_gmail.com>
Date: Fri, 31 Mar 2023 13:52:55 +0200
Message-ID: <CA+dM1yM_ve7COo99RxjmwBTeUtTdpyuutM-Y1OtoYZxQ5bnWNg_at_mail.gmail.com>


It is not a simple question . I see the matter from 2 different points of view . if you want to avoid swap because a swap partition "costs", it is physical disk and disk is money, it can be a thing for aws that has many thousands of machine, but i don't know if it is the same thing for you. if you have 100 vm , with 8gb swap, it costs to you less that 1 tb, not that great cost saving i think so i don't see the need for eliminating swap ( for a cloud operator it can be completely different because we talk of numbers completely different ) . I think a different reason for avoiding swap could be to force your system to maintain the pages all in memory. In this case I would not deactivate swap, because swap can be usefull if you have a peak of load and to reach the same goal from another path .
If your system use a lot of swap, it will not work or it will not work well because access to memory is too slow , so the use of swap should be for emergency only and i believe more than 8 or 16 gb is not reasonable ( the system usually , with 8gb of pages in swap, even with a portion of them active, becomes very slow and you have to reboot or kill processes in any case ) .
What i would do is to tune vm.swappiness. this parameter has default to 60 and is in range 0..100. The higher this parameter is , the sooner your pages will be moved in swap ( more aggressive swap policy ) .
The set of 60 of that value is useful for desktop client and so on.  The default can be a bit aggressive and if you see that you have memory free and pages in the swap, i would lower swappines . On some system ( not oracle ) we put swappines to 1 directly, but in this case i would do periodically some tuning ( it is an hot parameter ) .
The aggressive swapping can be very good for desktop users, in general, because in that way , if you open a big file or a new program the system has not to move the current pages to swap, it has already done the job and so it is much more reactive. But for a server point of view i am not sure that this behaviour is the best, for the reason that accessing to swap is much slower . So my suggestion is to leave swap, check how many pages of swap you are using ( vmstat, sar and so on ) from time to time, and in case you think you are swapping to much , with free memory, you can lower vm.swappines value .

Il giorno gio 30 mar 2023 alle ore 18:26 Jared Still <jkstill_at_gmail.com> ha scritto:
>
> That is the question.
>
> I am curious about current thoughts on having or not having a swap partition on Linux based Oracle servers.
>
> Let's assume typical production standard servers with a reasonable amount of RAM, sway 256G or more.
>
> I have some thoughts on this myself, but would like to see others' thoughts on this.
>
>
> Jared Still
> Certifiable Oracle DBA and Part Time Perl Evangelist
> Principal Consultant at Pythian
> Oracle ACE Alumni
> Pythian Blog http://www.pythian.com/blog/author/still/
> Github: https://github.com/jkstill
> Personality: http://www.personalitypage.com/INTJ.html
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 31 2023 - 13:52:55 CEST

Original text of this message