public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] 32GB RAM and Swap
@ 2020-05-01 19:50 Raphael MD
  2020-05-01 19:54 ` Alexandru N. Barloiu
                   ` (8 more replies)
  0 siblings, 9 replies; 23+ messages in thread
From: Raphael MD @ 2020-05-01 19:50 UTC (permalink / raw
  To: Gentoo User

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

Hello!

Could I turn my Linux swap off.
I have 32 GB of RAM memory, I suppose my system don’t need swap, because
I’vea lot of RAM, is this true?

Thanks
-- 
M.S. Raphael Mejias Dias
​Nuclear Engineer | Reactors

Secure e-mail: raphael.mejias.dias@protonmail.com
PGP Key for raphaxx@gmail.com:
https://pgp.mit.edu/pks/lookup?op=get&search=0x87BC5A746072F951

[-- Attachment #2: Type: text/html, Size: 1555 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
@ 2020-05-01 19:54 ` Alexandru N. Barloiu
  2020-05-01 20:04 ` Canek Peláez Valdés
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Alexandru N. Barloiu @ 2020-05-01 19:54 UTC (permalink / raw
  To: gentoo-user

> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap,
> because I’vea lot of RAM, is this true?


yes.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
  2020-05-01 19:54 ` Alexandru N. Barloiu
@ 2020-05-01 20:04 ` Canek Peláez Valdés
  2020-05-01 21:21   ` Neil Bothwick
  2020-05-01 20:04 ` Matt Connell (Gmail)
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Canek Peláez Valdés @ 2020-05-01 20:04 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 868 bytes --]

On Fri, May 1, 2020, 14:50 Raphael MD <raphaxx@gmail.com> wrote:

> Hello!
>
> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap, because
> I’vea lot of RAM, is this true?
>
> Thanks
>

I have 3 desktop machines with 32 GB of memory. In all 3 I still have swap
(32 GB, I stopped using the "twice the amount of RAM" rule years ago). I
don't think I have ever used one single byte from the swap; it always sits
with "0 bytes used" when I check top.

So I don't think you need the swap; I keep using it in case I need to ever
hibernate the machines, bit I never do. Also, it's always on the mechanical
disks, so it's dirty cheap.

Regards.
--
Dr. Canek Peláez Valdés
Profesor de Carrera Asociado C
Departamento de Matemáticas
Facultad de Ciencias
Universidad Nacional Autónoma de México

[-- Attachment #2: Type: text/html, Size: 1693 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
  2020-05-01 19:54 ` Alexandru N. Barloiu
  2020-05-01 20:04 ` Canek Peláez Valdés
@ 2020-05-01 20:04 ` Matt Connell (Gmail)
  2020-05-01 20:29 ` Dale
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Matt Connell (Gmail) @ 2020-05-01 20:04 UTC (permalink / raw
  To: gentoo-user

On 2020-05-01 14:50, Raphael MD wrote:
> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap, because
> I’vea lot of RAM, is this true?

As long as you're only running Linux on the machine, I would say yes, 
you're safe to do that.

If you're going to dual-boot or use Windows, you might want to reserve a 
small swap partition just in case.  Some Windows applications get crabby 
when there is no swap available, in my experience.


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
                   ` (2 preceding siblings ...)
  2020-05-01 20:04 ` Matt Connell (Gmail)
@ 2020-05-01 20:29 ` Dale
  2020-05-01 23:09   ` Wols Lists
  2020-05-01 21:49 ` J. Roeleveld
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Dale @ 2020-05-01 20:29 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]

Raphael MD wrote:
> Hello!
>
> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap,
> because I’vea lot of RAM, is this true?
>
> Thanks
> -- 
> M.S. Raphael Mejias Dias
> ​Nuclear Engineer | Reactors
>
> Secure e-mail: raphael.mejias.dias@protonmail.com
> <mailto:raphael.mejias.dias@protonmail.com>
> PGP Key for raphaxx@gmail.com <mailto:raphaxx@gmail.com>:
> https://pgp.mit.edu/pks/lookup?op=get&search=0x87BC5A746072F951


As some know, I've had occasions where some program would eat up a lot
of memory.  I've had a time or two where I had to shutdown or it crashed
itself.  The offender varies.  Once it was Firefox, huge problem there
but seems OK now.  Right now, sddm is going off the end.  For that
reason, I actually increased my swap space.  It gets really slow to
respond when it uses swap but it beats crashing.  Just set swapiness to
a low number.  I think mine is set to 10.

Given the cheapness of hard drives, I'm not sure why having several
gigabytes of swap space is of much concern.  I have the same amount of
ram as you and I have a 12GB swap space.  I use LVM so I can grow it if
needed or just add another swap space.  I might add, I've seen times
where it gets used.

If you have not had swap touched in a very long time, maybe it is safe
enough.  Just keep in mind that if some package consumes way more than
it should, it can end badly.  The kernel's OOM tool isn't that great in
my experience.  Sometimes it does OK, sometimes not.  A couple times, it
seemed to not do anything and I got a reboot.

Dale

:-)  :-) 

[-- Attachment #2: Type: text/html, Size: 4207 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 20:04 ` Canek Peláez Valdés
@ 2020-05-01 21:21   ` Neil Bothwick
  2020-05-01 21:26     ` tedheadster
  0 siblings, 1 reply; 23+ messages in thread
From: Neil Bothwick @ 2020-05-01 21:21 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1340 bytes --]

On Fri, 1 May 2020 15:04:12 -0500, Canek Peláez Valdés wrote:

> I have 3 desktop machines with 32 GB of memory. In all 3 I still have
> swap (32 GB, I stopped using the "twice the amount of RAM" rule years
> ago). I don't think I have ever used one single byte from the swap; it
> always sits with "0 bytes used" when I check top.

% free -h
              total        used        free      shared  buff/cache   available
Mem:           31Gi       3.2Gi         9Gi       5.3Gi        18Gi        22Gi
Swap:         8.0Gi       8.0Mi       8.0Gi

Something's using a little of it here.
 
> So I don't think you need the swap; I keep using it in case I need to
> ever hibernate the machines, bit I never do. Also, it's always on the
> mechanical disks, so it's dirty cheap.

As you say, it's cheap and you're hardly going to noting a few GB out of
a multi-TB disk.

The question was about *needing* swap, to which the answer is generally
no. But the more important question is whether you are better off with or
without it, which is a much more complex problem, although I see no good
reason to not have it and reasonable reasons to leave it there.


-- 
Neil Bothwick

WORM: (n.) acronym for Write Once, Read Mangled. Used to describe a
      normally-functioning computer disk of the very latest design.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 21:21   ` Neil Bothwick
@ 2020-05-01 21:26     ` tedheadster
  0 siblings, 0 replies; 23+ messages in thread
From: tedheadster @ 2020-05-01 21:26 UTC (permalink / raw
  To: gentoo-user

Here is an article suggesting to have a _tiny_ bit of swap. They say
as recently as 2019 that Linux under memory pressure acts poorly with
_zero_ swap.

https://rachelbythebay.com/w/2019/08/08/swap/

- Matthew


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
                   ` (3 preceding siblings ...)
  2020-05-01 20:29 ` Dale
@ 2020-05-01 21:49 ` J. Roeleveld
  2020-05-01 23:08   ` Raphael MD
  2020-05-02  2:06 ` tuxic
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: J. Roeleveld @ 2020-05-01 21:49 UTC (permalink / raw
  To: gentoo-user

On 1 May 2020 21:50:02 CEST, Raphael MD <raphaxx@gmail.com> wrote:
>Hello!
>
>Could I turn my Linux swap off.
>I have 32 GB of RAM memory, I suppose my system don’t need swap,
>because
>I’vea lot of RAM, is this true?
>
>Thanks

This question keeps getting asked every time people go past some imaginary large figure of RAM.

First time I encountered it was somewhere in the 1990s. A friend had a machine with 64MB ram, a massive amount at that time, and disabled all swap.
He was surprised his machine crashed because of memory issues, until I asked what he was running. The list included several memory intensive applications.
He never asked that again and adds it to all his machines.

My desktop has 32GB and also has some swap. I do regularly see it used and not because of memory leaks like Dale is mentioning, although those do appear on occasion. On my desktop it's mostly because I have a lot of stuff running the whole time.

So, yes, you still need swap and always will. Unless you put about 10 times the current magical figure in a desktop. In my view, that would be 320GB for now, and in another 5 years, that would be around 640GB.
When you have that level of overkill in a desktop, I will not consider OOM to be likely.


--
Joost

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 21:49 ` J. Roeleveld
@ 2020-05-01 23:08   ` Raphael MD
  2020-05-01 23:17     ` Michael
  0 siblings, 1 reply; 23+ messages in thread
From: Raphael MD @ 2020-05-01 23:08 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1930 bytes --]

On Fri, 1 May 2020 at 18:49 J. Roeleveld <joost@antarean.org> wrote:

> On 1 May 2020 21:50:02 CEST, Raphael MD <raphaxx@gmail.com> wrote:
> >Hello!
> >
> >Could I turn my Linux swap off.
> >I have 32 GB of RAM memory, I suppose my system don’t need swap,
> >because
> >I’vea lot of RAM, is this true?
> >
> >Thanks
>
> This question keeps getting asked every time people go past some imaginary
> large figure of RAM.
>
> First time I encountered it was somewhere in the 1990s. A friend had a
> machine with 64MB ram, a massive amount at that time, and disabled all swap.
> He was surprised his machine crashed because of memory issues, until I
> asked what he was running. The list included several memory intensive
> applications.
> He never asked that again and adds it to all his machines.
>
> My desktop has 32GB and also has some swap. I do regularly see it used and
> not because of memory leaks like Dale is mentioning, although those do
> appear on occasion. On my desktop it's mostly because I have a lot of stuff
> running the whole time.
>
> So, yes, you still need swap and always will. Unless you put about 10
> times the current magical figure in a desktop. In my view, that would be
> 320GB for now, and in another 5 years, that would be around 640GB.
> When you have that level of overkill in a desktop, I will not consider OOM
> to be likely.
>
>
> --
> Joost
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>

Well, it’s figuring that some sort of swap space is necessary, but
regarding pressure level on kernel, can I setup it to zero or I’m obligated
to put some number because I’ve a swap file?

Thanks

>
> --
M.S. Raphael Mejias Dias
​Nuclear Engineer | Reactors

Secure e-mail: raphael.mejias.dias@protonmail.com
PGP Key for raphaxx@gmail.com:
https://pgp.mit.edu/pks/lookup?op=get&search=0x87BC5A746072F951

[-- Attachment #2: Type: text/html, Size: 3810 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 20:29 ` Dale
@ 2020-05-01 23:09   ` Wols Lists
  2020-05-01 23:11     ` Michael
  2020-05-02  8:53     ` Dale
  0 siblings, 2 replies; 23+ messages in thread
From: Wols Lists @ 2020-05-01 23:09 UTC (permalink / raw
  To: gentoo-user

On 01/05/20 21:29, Dale wrote:
> It gets really slow to respond when it uses swap but it beats crashing. 
> Just set swapiness to a low number.  I think mine is set to 10.
> 
> Given the cheapness of hard drives, I'm not sure why having several
> gigabytes of swap space is of much concern.  I have the same amount of
> ram as you and I have a 12GB swap space.  I use LVM so I can grow it if
> needed or just add another swap space.  I might add, I've seen times
> where it gets used.

That first paragraph is why too much swap space is bad - if an app goes
rogue it can kill system response and make regaining control of the
system a nightmare.

Accidentally or on purpose, if a system runs out of ram and starts
thrashing, you're in big trouble if it's an app eating memory like no
tomorrow.

Cheers,
Wol


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 23:09   ` Wols Lists
@ 2020-05-01 23:11     ` Michael
  2020-05-02  8:53     ` Dale
  1 sibling, 0 replies; 23+ messages in thread
From: Michael @ 2020-05-01 23:11 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

On Saturday, 2 May 2020 00:09:47 BST Wols Lists wrote:
> On 01/05/20 21:29, Dale wrote:
> > It gets really slow to respond when it uses swap but it beats crashing.
> > Just set swapiness to a low number.  I think mine is set to 10.
> > 
> > Given the cheapness of hard drives, I'm not sure why having several
> > gigabytes of swap space is of much concern.  I have the same amount of
> > ram as you and I have a 12GB swap space.  I use LVM so I can grow it if
> > needed or just add another swap space.  I might add, I've seen times
> > where it gets used.
> 
> That first paragraph is why too much swap space is bad - if an app goes
> rogue it can kill system response and make regaining control of the
> system a nightmare.
> 
> Accidentally or on purpose, if a system runs out of ram and starts
> thrashing, you're in big trouble if it's an app eating memory like no
> tomorrow.
> 
> Cheers,
> Wol

This may help responsiveness when it happens:

echo bfq > /sys/block/sda/queue/scheduler

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 23:08   ` Raphael MD
@ 2020-05-01 23:17     ` Michael
  0 siblings, 0 replies; 23+ messages in thread
From: Michael @ 2020-05-01 23:17 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2366 bytes --]

On Saturday, 2 May 2020 00:08:24 BST Raphael MD wrote:
> On Fri, 1 May 2020 at 18:49 J. Roeleveld <joost@antarean.org> wrote:
> > On 1 May 2020 21:50:02 CEST, Raphael MD <raphaxx@gmail.com> wrote:
> > >Hello!
> > >
> > >Could I turn my Linux swap off.
> > >I have 32 GB of RAM memory, I suppose my system don’t need swap,
> > >because
> > >I’vea lot of RAM, is this true?
> > >
> > >Thanks
> > 
> > This question keeps getting asked every time people go past some imaginary
> > large figure of RAM.
> > 
> > First time I encountered it was somewhere in the 1990s. A friend had a
> > machine with 64MB ram, a massive amount at that time, and disabled all
> > swap. He was surprised his machine crashed because of memory issues,
> > until I asked what he was running. The list included several memory
> > intensive applications.
> > He never asked that again and adds it to all his machines.
> > 
> > My desktop has 32GB and also has some swap. I do regularly see it used and
> > not because of memory leaks like Dale is mentioning, although those do
> > appear on occasion. On my desktop it's mostly because I have a lot of
> > stuff
> > running the whole time.
> > 
> > So, yes, you still need swap and always will. Unless you put about 10
> > times the current magical figure in a desktop. In my view, that would be
> > 320GB for now, and in another 5 years, that would be around 640GB.
> > When you have that level of overkill in a desktop, I will not consider OOM
> > to be likely.
> > 
> > 
> > --
> > Joost
> > 
> > --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> 
> Well, it’s figuring that some sort of swap space is necessary, but
> regarding pressure level on kernel, can I setup it to zero or I’m obligated
> to put some number because I’ve a swap file?
> 
> Thanks

Only you know how you're using your PC and if the 32G of RAM can/will be used 
up at some point.  I can assure you if you decide to compile chromium with 
some silly --jobs number, you *will* run out of memory and wish you had set 
some swap at the time.  I don't think I have ever regretted having swap in 
place and still revisit old systems I should have retired years ago to add 
some more swap to make sure a memory hungry application or compilation can run 
and complete without OOM errors.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
                   ` (4 preceding siblings ...)
  2020-05-01 21:49 ` J. Roeleveld
@ 2020-05-02  2:06 ` tuxic
  2020-05-02  2:17   ` [gentoo-user] " Nikos Chantziaras
  2020-05-02  2:09 ` Nikos Chantziaras
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: tuxic @ 2020-05-02  2:06 UTC (permalink / raw
  To: gentoo-user

On 05/01 04:50, Raphael MD wrote:
> Hello!
> 
> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap, because
> I’vea lot of RAM, is this true?
> 
> Thanks
> -- 
> M.S. Raphael Mejias Dias
> ​Nuclear Engineer | Reactors
> 
> Secure e-mail: raphael.mejias.dias@protonmail.com
> PGP Key for raphaxx@gmail.com:
> https://pgp.mit.edu/pks/lookup?op=get&search=0x87BC5A746072F951

Hi Raphael,

as far as I know, the hibernation mechanism of the kernel uses swap
as storage place for an RAM image.

If you plan to use hibernation, I think you need swap space in the
size of your RAM.

Cheers!
Meino




^ permalink raw reply	[flat|nested] 23+ messages in thread

* [gentoo-user] Re: 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
                   ` (5 preceding siblings ...)
  2020-05-02  2:06 ` tuxic
@ 2020-05-02  2:09 ` Nikos Chantziaras
  2020-05-02 14:12 ` [gentoo-user] " William Kenworthy
  2020-05-03  0:11 ` Серега Филатов
  8 siblings, 0 replies; 23+ messages in thread
From: Nikos Chantziaras @ 2020-05-02  2:09 UTC (permalink / raw
  To: gentoo-user

On 01/05/2020 22:50, Raphael MD wrote:
> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap, because 
> I’vea lot of RAM, is this true?

I've been on 16GB RAM for about 10 years. I've been using a 4GB swap 
partition for about 8 years. Two years ago, I disabled swap. This fixed 
a long standing problem where running applications that I didn't touch 
for a while would take *ages* to start operating at normal speeds again. 
Setting the vm.swappiness=10 sysctl didn't help either. Only 
vm.swappiness=0 got rid of those issues (which basically means disable 
swap.)

I don't know how common this problem is in general, but for me it 
happened a lot because I use virtual machines to do work on Windows 10, 
Ubuntu and macOS running in Gentoo. This always resulted in applications 
that I didn't touch for a while getting swapped out even though there 
was plenty of RAM free. Since I disabled swap, everything stays nice and 
snappy all the time instead of becoming a sluggish nightmare after a while.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [gentoo-user] Re: 32GB RAM and Swap
  2020-05-02  2:06 ` tuxic
@ 2020-05-02  2:17   ` Nikos Chantziaras
  0 siblings, 0 replies; 23+ messages in thread
From: Nikos Chantziaras @ 2020-05-02  2:17 UTC (permalink / raw
  To: gentoo-user

On 02/05/2020 05:06, tuxic@posteo.de wrote:
> as far as I know, the hibernation mechanism of the kernel uses swap
> as storage place for an RAM image.
> 
> If you plan to use hibernation, I think you need swap space in the
> size of your RAM.

For this case you can set vm.swappiness=0 and still have a swap 
partition. This disables swap for normal use but still has a swap 
partition available for things like hibernation. Just create a .conf 
file in /etc/sysctl.d/ (I use "/etc/sysctl.d/local.conf") with this in it:

   vm.swappiness=0

This will apply the setting during boot. To set it for the currently 
running session as well without having to reboot, execute:

   sysctl vm.swappiness=0

as root.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 23:09   ` Wols Lists
  2020-05-01 23:11     ` Michael
@ 2020-05-02  8:53     ` Dale
  2020-05-02  9:31       ` Michael
  1 sibling, 1 reply; 23+ messages in thread
From: Dale @ 2020-05-02  8:53 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]

Wols Lists wrote:
> On 01/05/20 21:29, Dale wrote:
>> It gets really slow to respond when it uses swap but it beats crashing. 
>> Just set swapiness to a low number.  I think mine is set to 10.
>>
>> Given the cheapness of hard drives, I'm not sure why having several
>> gigabytes of swap space is of much concern.  I have the same amount of
>> ram as you and I have a 12GB swap space.  I use LVM so I can grow it if
>> needed or just add another swap space.  I might add, I've seen times
>> where it gets used.
> That first paragraph is why too much swap space is bad - if an app goes
> rogue it can kill system response and make regaining control of the
> system a nightmare.
>
> Accidentally or on purpose, if a system runs out of ram and starts
> thrashing, you're in big trouble if it's an app eating memory like no
> tomorrow.
>
> Cheers,
> Wol
>
> .
>


That's why I set swapiness to a low number.  I don't want it to use swap
unless it is to prevent a crash.  If I set it to a higher number, it
wants to use swap even when there is memory available.  Once it starts
using swap, it gets slow.  The more it uses, the worse it gets. 
However, it beats it rebooting without umounting partitions and such. 
If nothing else, it may give me time to use the alt-sys sequence. 

I'm maxed out on memory at the moment but wish I could get and afford
64GBs, in a way.  Still, I'd have a swap partition. 

Dale

:-)  :-)

[-- Attachment #2: Type: text/html, Size: 1912 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-02  8:53     ` Dale
@ 2020-05-02  9:31       ` Michael
  2020-05-02  9:54         ` Dale
  0 siblings, 1 reply; 23+ messages in thread
From: Michael @ 2020-05-02  9:31 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]

On Saturday, 2 May 2020 09:53:06 BST Dale wrote:
> Wols Lists wrote:
> > On 01/05/20 21:29, Dale wrote:
> >> It gets really slow to respond when it uses swap but it beats crashing.
> >> Just set swapiness to a low number.  I think mine is set to 10.
> >> 
> >> Given the cheapness of hard drives, I'm not sure why having several
> >> gigabytes of swap space is of much concern.  I have the same amount of
> >> ram as you and I have a 12GB swap space.  I use LVM so I can grow it if
> >> needed or just add another swap space.  I might add, I've seen times
> >> where it gets used.
> > 
> > That first paragraph is why too much swap space is bad - if an app goes
> > rogue it can kill system response and make regaining control of the
> > system a nightmare.
> > 
> > Accidentally or on purpose, if a system runs out of ram and starts
> > thrashing, you're in big trouble if it's an app eating memory like no
> > tomorrow.
> > 
> > Cheers,
> > Wol
> > 
> > .
> 
> That's why I set swapiness to a low number.  I don't want it to use swap
> unless it is to prevent a crash.  If I set it to a higher number, it
> wants to use swap even when there is memory available.  Once it starts
> using swap, it gets slow.  The more it uses, the worse it gets. 
> However, it beats it rebooting without umounting partitions and such. 
> If nothing else, it may give me time to use the alt-sys sequence. 
> 
> I'm maxed out on memory at the moment but wish I could get and afford
> 64GBs, in a way.  Still, I'd have a swap partition. 
> 
> Dale
> 
> :-)  :-)

I'd be interested to know as a comparison if Nikos' and Dale's I/O 
unresponsiveness in swapping sees an improvement with the I/O scheduler for 
spinning drives set to bfq; e.g.:

echo bfq > /sys/block/sda/queue/scheduler

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-02  9:31       ` Michael
@ 2020-05-02  9:54         ` Dale
  2020-05-02 10:30           ` Michael
  0 siblings, 1 reply; 23+ messages in thread
From: Dale @ 2020-05-02  9:54 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]

Michael wrote:
> On Saturday, 2 May 2020 09:53:06 BST Dale wrote:
>> Wols Lists wrote:
>>> On 01/05/20 21:29, Dale wrote:
>>>> It gets really slow to respond when it uses swap but it beats crashing.
>>>> Just set swapiness to a low number.  I think mine is set to 10.
>>>>
>>>> Given the cheapness of hard drives, I'm not sure why having several
>>>> gigabytes of swap space is of much concern.  I have the same amount of
>>>> ram as you and I have a 12GB swap space.  I use LVM so I can grow it if
>>>> needed or just add another swap space.  I might add, I've seen times
>>>> where it gets used.
>>> That first paragraph is why too much swap space is bad - if an app goes
>>> rogue it can kill system response and make regaining control of the
>>> system a nightmare.
>>>
>>> Accidentally or on purpose, if a system runs out of ram and starts
>>> thrashing, you're in big trouble if it's an app eating memory like no
>>> tomorrow.
>>>
>>> Cheers,
>>> Wol
>>>
>>> .
>> That's why I set swapiness to a low number.  I don't want it to use swap
>> unless it is to prevent a crash.  If I set it to a higher number, it
>> wants to use swap even when there is memory available.  Once it starts
>> using swap, it gets slow.  The more it uses, the worse it gets. 
>> However, it beats it rebooting without umounting partitions and such. 
>> If nothing else, it may give me time to use the alt-sys sequence. 
>>
>> I'm maxed out on memory at the moment but wish I could get and afford
>> 64GBs, in a way.  Still, I'd have a swap partition. 
>>
>> Dale
>>
>> :-)  :-)
> I'd be interested to know as a comparison if Nikos' and Dale's I/O 
> unresponsiveness in swapping sees an improvement with the I/O scheduler for 
> spinning drives set to bfq; e.g.:
>
> echo bfq > /sys/block/sda/queue/scheduler

This is its setting at the moment. 


root@fireball / # cat /sys/block/sda/queue/scheduler
noop deadline [cfq]
root@fireball / #


I know I can echo it in but where do I set that to that when booting? 
Same as swappiness??  I'm willing to set it and see what it does next
time swap pops into gear.  Given it is me, it may not be to long.  LOL 
I have to say, while sddm-helper is still absorbing to much memory, it
is holding steady at around 1GB or 3.3%.  It's nowhere near enough to
test this theory, yet.  :/

Dale

:-)  :-) 

[-- Attachment #2: Type: text/html, Size: 3007 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-02  9:54         ` Dale
@ 2020-05-02 10:30           ` Michael
  2020-05-02 14:19             ` Dale
  0 siblings, 1 reply; 23+ messages in thread
From: Michael @ 2020-05-02 10:30 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

On Saturday, 2 May 2020 10:54:02 BST Dale wrote:
> Michael wrote:

> > I'd be interested to know as a comparison if Nikos' and Dale's I/O
> > unresponsiveness in swapping sees an improvement with the I/O scheduler
> > for
> > spinning drives set to bfq; e.g.:
> > 
> > echo bfq > /sys/block/sda/queue/scheduler
> 
> This is its setting at the moment. 
> 
> 
> root@fireball / # cat /sys/block/sda/queue/scheduler
> noop deadline [cfq]
> root@fireball / #

Ahh, you must be on an older kernel?

I'm on 5.4.28 here and these are the new kernel scheduler options:

#
# IO Schedulers
#
CONFIG_MQ_IOSCHED_DEADLINE=y
CONFIG_MQ_IOSCHED_KYBER=y
CONFIG_IOSCHED_BFQ=y
CONFIG_BFQ_GROUP_IOSCHED=y
# CONFIG_BFQ_CGROUP_DEBUG is not set
# end of IO Schedulers

The BFQ scheduler has a number of tunable parameters via sysctl, like weight, 
latency and what not, but unless you're into running endless benchmark tests 
to tune your particular devices, I'd leave it to do its thing with default 
settings.


> I know I can echo it in but where do I set that to that when booting? 

You can set a local script to switch from other schedulers - the default is 
mq-deadline - or you can disable the others in the kernel.  I don't know if 
you can pass an option to the kernel line at boot time.

I understand this is more effective with slow(er) spinning drives and perhaps 
old SSDs.  NVMe drives won't benefit from it and are better run with the 
default mq-deadline scheduler.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
                   ` (6 preceding siblings ...)
  2020-05-02  2:09 ` Nikos Chantziaras
@ 2020-05-02 14:12 ` William Kenworthy
  2020-05-03 18:10   ` François-Xavier Carton
  2020-05-03  0:11 ` Серега Филатов
  8 siblings, 1 reply; 23+ messages in thread
From: William Kenworthy @ 2020-05-02 14:12 UTC (permalink / raw
  To: gentoo-user


[-- Attachment #1.1: Type: text/plain, Size: 2247 bytes --]

I am afraid this is an ".. it depends" question.

If you work with large images or data sets, swap can be really handy. 
If you are doing a little programming, web browsing, reading email you
will *probably* be ok, but why risk it?

I have a 32gb ram in a master server for an mfs filesystem - it normally
sits at about 5GB of ram - however it can go well over 32Gb into swap at
times - the first machine I tried it with only had 4gb ram and crashed
when it filled the ram, and 8g swap taking the test file system with it
- its now production so I am not going to risk it by underprovisioning
swap.  My 32Gb desktop is not using any swap at the moment ... but it
has used it at times. 

So, yes its quite likely you wont use swap - but if you do something
that needs it, it can help avoid a very messy crash.

Swap is slow, but if you actually need it - its probably critical that
you have it!  Unless you are really short of disk space, treat it as
insurance :)

Look into using swapfiles instead of partitions for flexibility, and the
sysctl values of "vm.swappiness" and "vm.vfs_cache_pressure" to manage
swap usage (you can set to not use swap until it really has to - some
have seen the kernel being too eager to swap out causing slowdowns,
though you can make it go in the other direction and "thrash" when it
actually needs to use swap if you go to far.  The default kernel swap
mechanism isn't really that bad!

So yes, most of my machines don't need swap *right now* and swap looks
like its not being used so it could be removed, but I cant guarantee
that they never will, and having years of experience using swap I
recommend that its better to be cautious and survive :)

BillK


On 2/5/20 3:50 am, Raphael MD wrote:
> Hello!
>
> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap,
> because I’vea lot of RAM, is this true?
>
> Thanks
> -- 
> M.S. Raphael Mejias Dias
> ​Nuclear Engineer | Reactors
>
> Secure e-mail: raphael.mejias.dias@protonmail.com
> <mailto:raphael.mejias.dias@protonmail.com>
> PGP Key for raphaxx@gmail.com <mailto:raphaxx@gmail.com>:
> https://pgp.mit.edu/pks/lookup?op=get&search=0x87BC5A746072F951

[-- Attachment #1.2: Type: text/html, Size: 4916 bytes --]

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 2225 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-02 10:30           ` Michael
@ 2020-05-02 14:19             ` Dale
  0 siblings, 0 replies; 23+ messages in thread
From: Dale @ 2020-05-02 14:19 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2730 bytes --]

Michael wrote:
> On Saturday, 2 May 2020 10:54:02 BST Dale wrote:
>> Michael wrote:
>>> I'd be interested to know as a comparison if Nikos' and Dale's I/O
>>> unresponsiveness in swapping sees an improvement with the I/O scheduler
>>> for
>>> spinning drives set to bfq; e.g.:
>>>
>>> echo bfq > /sys/block/sda/queue/scheduler
>> This is its setting at the moment. 
>>
>>
>> root@fireball / # cat /sys/block/sda/queue/scheduler
>> noop deadline [cfq]
>> root@fireball / #
> Ahh, you must be on an older kernel?
>
> I'm on 5.4.28 here and these are the new kernel scheduler options:
>
> #
> # IO Schedulers
> #
> CONFIG_MQ_IOSCHED_DEADLINE=y
> CONFIG_MQ_IOSCHED_KYBER=y
> CONFIG_IOSCHED_BFQ=y
> CONFIG_BFQ_GROUP_IOSCHED=y
> # CONFIG_BFQ_CGROUP_DEBUG is not set
> # end of IO Schedulers
>
> The BFQ scheduler has a number of tunable parameters via sysctl, like weight, 
> latency and what not, but unless you're into running endless benchmark tests 
> to tune your particular devices, I'd leave it to do its thing with default 
> settings.
>


Yea, I got new UPS batteries coming which means a complete power down. 
I may upgrade my kernel before doing that.  It slipped my mind so glad
this came up.  I'm on 4.19.40-gentoo but I need to see what is the
latest version nvidia-drivers supports first.  I guess I'll google that
or something. 


>> I know I can echo it in but where do I set that to that when booting? 
> You can set a local script to switch from other schedulers - the default is 
> mq-deadline - or you can disable the others in the kernel.  I don't know if 
> you can pass an option to the kernel line at boot time.
>
> I understand this is more effective with slow(er) spinning drives and perhaps 
> old SSDs.  NVMe drives won't benefit from it and are better run with the 
> default mq-deadline scheduler.


I googled it, it seems it gets added to the kernel line options via
grub2's conf file.  I have another option there too, IOMMU or something
like that. 

Right now, it's off to the tractor and discing up my garden.  So much
rain lately, I'm just now able to get a tractor in it.  New disc is
awesome tho. 

Oh, for future reference:


# cat /etc/sysconfig/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet elevator=cfq"
GRUB_DISABLE_RECOVERY="true"



It's the 2nd line from the bottom.  It may be configurable in menuconfig too. I dunno know yet.  I'll try to look.  Must make note to upgrade kernel.  Batteries will be here Monday.  

Thanks much.  It's on my todo list.

Dale

:-)  :-)  


[-- Attachment #2: Type: text/html, Size: 3668 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
                   ` (7 preceding siblings ...)
  2020-05-02 14:12 ` [gentoo-user] " William Kenworthy
@ 2020-05-03  0:11 ` Серега Филатов
  8 siblings, 0 replies; 23+ messages in thread
From: Серега Филатов @ 2020-05-03  0:11 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2053 bytes --]

I want to say that it really depends on this:

- What do you do on your system (what applications do you use, what DE, how
is your production ram-hungry, maybe it is some large application that
you're contributing on)
- How do you do things on your system (shutting down machine every day or
suspending it with 1-2 months+ uptime, using only apps you need or leaving
plenty of them running in the background, cleaning out tabs in your browser
or leaving them always opened in case you need them)
- You're using hibernation (if so, you definitely need swap large enough to
contain the whole contents of your ram)
- Your expectations of the need in swap in the next couple of years (and
you really SHOULD expect this. Personally I considered recently that 4 GB
is enough for all my needs and now I don't know how to even browse the
modern internet with it). You can have a swap in this case for the future.
Or if your system will live for couple of years without reinstallation
you'll consider that you need swap, so you'll repartition your drive, maybe
it'll get full of data to this time and you need to clean it up first,
maybe you'll need to backup your data before repartitioning, and so on...
It might take a long time in the future.

The first time I heard the "oh, you don't really need swap now, it's plenty
of ram in modern machines" was mid-2000s. Back then I had a 512MB RAM
machine (you'll not get modern fancy browser on it!).
And then every 2-3 years I hear that. But I still end up creating a swap
partition on every new machine I have.


On Fri, May 1, 2020, 23:50 Raphael MD <raphaxx@gmail.com> wrote:

> Hello!
>
> Could I turn my Linux swap off.
> I have 32 GB of RAM memory, I suppose my system don’t need swap, because
> I’vea lot of RAM, is this true?
>
> Thanks
> --
> M.S. Raphael Mejias Dias
> ​Nuclear Engineer | Reactors
>
> Secure e-mail: raphael.mejias.dias@protonmail.com
> PGP Key for raphaxx@gmail.com:
> https://pgp.mit.edu/pks/lookup?op=get&search=0x87BC5A746072F951
>

[-- Attachment #2: Type: text/html, Size: 3733 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [gentoo-user] 32GB RAM and Swap
  2020-05-02 14:12 ` [gentoo-user] " William Kenworthy
@ 2020-05-03 18:10   ` François-Xavier Carton
  0 siblings, 0 replies; 23+ messages in thread
From: François-Xavier Carton @ 2020-05-03 18:10 UTC (permalink / raw
  To: gentoo-user

On Sat, May 02, 2020 at 10:12:08PM +0800, William Kenworthy wrote:
> I am afraid this is an ".. it depends" question.
> 

Yes, I agree.

> If you work with large images or data sets, swap can be really handy. 
> If you are doing a little programming, web browsing, reading email you
> will *probably* be ok, but why risk it?
> 

Risk what? Having the OOM killer kill the problematic process? Depending
on your usage, this might be the best. Personally I prefer that to a
system that is stuck. I never had to force reboot on a system without
swap, whereas with swap I had to reboot most of the times swap was used.
Also it's super annoying when your system freezes because of a
background process swapping (eg. an emerge world update) while your
doing something else.

I've been running a 8GB system for a year, before that a 4GB system.
Both without swap. It's been fine so far. I did have processes killed
(eg. firefox compiling), but at least I can continue to use my system
without being interrupted by a freeze. It's a lot less frustrating to
have to resume a killed compilation than to deal with a frozen system.

> I have a 32gb ram in a master server for an mfs filesystem - it normally
> sits at about 5GB of ram - however it can go well over 32Gb into swap at
> times - the first machine I tried it with only had 4gb ram and crashed
> when it filled the ram, and 8g swap taking the test file system with it
> - its now production so I am not going to risk it by underprovisioning
> swap.  My 32Gb desktop is not using any swap at the moment ... but it
> has used it at times. 
> 
> So, yes its quite likely you wont use swap - but if you do something
> that needs it, it can help avoid a very messy crash.
> 
> Swap is slow, but if you actually need it - its probably critical that
> you have it!  Unless you are really short of disk space, treat it as
> insurance :)
> 
> Look into using swapfiles instead of partitions for flexibility, and the
> sysctl values of "vm.swappiness" and "vm.vfs_cache_pressure" to manage
> swap usage (you can set to not use swap until it really has to - some
> have seen the kernel being too eager to swap out causing slowdowns,
> though you can make it go in the other direction and "thrash" when it
> actually needs to use swap if you go to far.  The default kernel swap
> mechanism isn't really that bad!
> 

Swapfiles are great, because you can only add them when you need and
remove them when you're done. I sometimes use them when emerging large
stuff when I have other big processes in memory.

> So yes, most of my machines don't need swap *right now* and swap looks
> like its not being used so it could be removed, but I cant guarantee
> that they never will, and having years of experience using swap I
> recommend that its better to be cautious and survive :)

My systems usually survive (are not forcibly rebooted) better when there
is no swap. But I agree that in the end, it depends on the usage.


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-05-03 18:10 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-01 19:50 [gentoo-user] 32GB RAM and Swap Raphael MD
2020-05-01 19:54 ` Alexandru N. Barloiu
2020-05-01 20:04 ` Canek Peláez Valdés
2020-05-01 21:21   ` Neil Bothwick
2020-05-01 21:26     ` tedheadster
2020-05-01 20:04 ` Matt Connell (Gmail)
2020-05-01 20:29 ` Dale
2020-05-01 23:09   ` Wols Lists
2020-05-01 23:11     ` Michael
2020-05-02  8:53     ` Dale
2020-05-02  9:31       ` Michael
2020-05-02  9:54         ` Dale
2020-05-02 10:30           ` Michael
2020-05-02 14:19             ` Dale
2020-05-01 21:49 ` J. Roeleveld
2020-05-01 23:08   ` Raphael MD
2020-05-01 23:17     ` Michael
2020-05-02  2:06 ` tuxic
2020-05-02  2:17   ` [gentoo-user] " Nikos Chantziaras
2020-05-02  2:09 ` Nikos Chantziaras
2020-05-02 14:12 ` [gentoo-user] " William Kenworthy
2020-05-03 18:10   ` François-Xavier Carton
2020-05-03  0:11 ` Серега Филатов

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox