
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? Currently, my swap partition is 2 gigs. Can I increase that by creating a swap file in addition to the swap partition? /gary

On Wed, Feb 27, 2019 at 7:02 AM Gary via talk <talk@gtalug.org> wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? Currently, my swap partition is 2 gigs. Can I increase that by creating a swap file in addition to the swap partition?
/gary
Is swap size still as relevant as it was a decade ago? On a host with 20G RAM, I'd imagine the likelihood of hitting swap being much lower. Having a couple of G available just in case seems like a good idea, but I'm unsure if the old (Total RAM * 2)=swap equation still rings true.
*does some quick internet sleuthing* According to this article: https://www.cyberciti.biz/tips/linux-swap-space.html RedHat basically says that for CentOS server 7, a minimum of 4G is recommended. The caveat to this is that if your system needs to hibernate/suspend-to-disk, in which case you'll want 1.5-2x RAM as swap in order to write in-use memory to disk. -jason

Unless you use suspend to disk, swap is not really needed. I don't believe you would load so many programs it would use all your 20GB of RAM. I have 8GB RAM and 2GB swap, no issues so far. I don't even create a swap partition anymore, I create a small swap file ( https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/). This way, I can increase/decrease its size without having to mess with partitioning. Mauro http://mauro.limeiratem.com - registered Linux User: 294521 Scripture is both history, and a love letter from God. Em qua, 27 de fev de 2019 às 12:12, Jason Shaw via talk <talk@gtalug.org> escreveu:
On Wed, Feb 27, 2019 at 7:02 AM Gary via talk <talk@gtalug.org> wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? Currently, my swap partition is 2 gigs. Can I increase that by creating a swap file in addition to the swap partition?
/gary
Is swap size still as relevant as it was a decade ago? On a host with 20G RAM, I'd imagine the likelihood of hitting swap being much lower. Having a couple of G available just in case seems like a good idea, but I'm unsure if the old (Total RAM * 2)=swap equation still rings true.
*does some quick internet sleuthing*
According to this article: https://www.cyberciti.biz/tips/linux-swap-space.html RedHat basically says that for CentOS server 7, a minimum of 4G is recommended. The caveat to this is that if your system needs to hibernate/suspend-to-disk, in which case you'll want 1.5-2x RAM as swap in order to write in-use memory to disk.
-jason
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk

Excellent! thank you so much. /gary On 19-02-27 10:22 AM, Mauro Souza via talk wrote:
Unless you use suspend to disk, swap is not really needed. I don't believe you would load so many programs it would use all your 20GB of RAM. I have 8GB RAM and 2GB swap, no issues so far. I don't even create a swap partition anymore, I create a small swap file (https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/). This way, I can increase/decrease its size without having to mess with partitioning.
Mauro http://mauro.limeiratem.com - registered Linux User: 294521 Scripture is both history, and a love letter from God.
Em qua, 27 de fev de 2019 às 12:12, Jason Shaw via talk <talk@gtalug.org <mailto:talk@gtalug.org>> escreveu:
On Wed, Feb 27, 2019 at 7:02 AM Gary via talk <talk@gtalug.org <mailto:talk@gtalug.org>> wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? Currently, my swap partition is 2 gigs. Can I increase that by creating a swap file in addition to the swap partition?
/gary
Is swap size still as relevant as it was a decade ago? On a host with 20G RAM, I'd imagine the likelihood of hitting swap being much lower. Having a couple of G available just in case seems like a good idea, but I'm unsure if the old (Total RAM * 2)=swap equation still rings true.
*does some quick internet sleuthing*
According to this article: https://www.cyberciti.biz/tips/linux-swap-space.html RedHat basically says that for CentOS server 7, a minimum of 4G is recommended. The caveat to this is that if your system needs to hibernate/suspend-to-disk, in which case you'll want 1.5-2x RAM as swap in order to write in-use memory to disk.
-jason
--- Talk Mailing List talk@gtalug.org <mailto:talk@gtalug.org> https://gtalug.org/mailman/listinfo/talk
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk

So another 2 gigs of swap wouldn't hurt. Can I use a swap file IN ADDITION TO a swap partition? /gary On 19-02-27 10:12 AM, Jason Shaw via talk wrote:
On Wed, Feb 27, 2019 at 7:02 AM Gary via talk <talk@gtalug.org <mailto:talk@gtalug.org>> wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? Currently, my swap partition is 2 gigs. Can I increase that by creating a swap file in addition to the swap partition?
/gary
Is swap size still as relevant as it was a decade ago? On a host with 20G RAM, I'd imagine the likelihood of hitting swap being much lower. Having a couple of G available just in case seems like a good idea, but I'm unsure if the old (Total RAM * 2)=swap equation still rings true.
*does some quick internet sleuthing*
According to this article: https://www.cyberciti.biz/tips/linux-swap-space.html RedHat basically says that for CentOS server 7, a minimum of 4G is recommended. The caveat to this is that if your system needs to hibernate/suspend-to-disk, in which case you'll want 1.5-2x RAM as swap in order to write in-use memory to disk.
-jason
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk

I've done both as a hack yes. W. On Wed, Feb 27, 2019, 11:51 AM Gary via talk, <talk@gtalug.org> wrote:
So another 2 gigs of swap wouldn't hurt. Can I use a swap file IN ADDITION TO a swap partition? /gary
On 19-02-27 10:12 AM, Jason Shaw via talk wrote:
On Wed, Feb 27, 2019 at 7:02 AM Gary via talk <talk@gtalug.org> wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? Currently, my swap partition is 2 gigs. Can I increase that by creating a swap file in addition to the swap partition?
/gary
Is swap size still as relevant as it was a decade ago? On a host with 20G RAM, I'd imagine the likelihood of hitting swap being much lower. Having a couple of G available just in case seems like a good idea, but I'm unsure if the old (Total RAM * 2)=swap equation still rings true.
*does some quick internet sleuthing*
According to this article: https://www.cyberciti.biz/tips/linux-swap-space.html RedHat basically says that for CentOS server 7, a minimum of 4G is recommended. The caveat to this is that if your system needs to hibernate/suspend-to-disk, in which case you'll want 1.5-2x RAM as swap in order to write in-use memory to disk.
-jason
--- Talk Mailing Listtalk@gtalug.orghttps://gtalug.org/mailman/listinfo/talk
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk

This is good to know. /gary On 19-02-27 12:10 PM, William Porquet wrote:
I've done both as a hack yes.
W.
On Wed, Feb 27, 2019, 11:51 AM Gary via talk, <talk@gtalug.org <mailto:talk@gtalug.org>> wrote:
So another 2 gigs of swap wouldn't hurt. Can I use a swap file IN ADDITION TO a swap partition? /gary
On 19-02-27 10:12 AM, Jason Shaw via talk wrote:
On Wed, Feb 27, 2019 at 7:02 AM Gary via talk <talk@gtalug.org <mailto:talk@gtalug.org>> wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? Currently, my swap partition is 2 gigs. Can I increase that by creating a swap file in addition to the swap partition?
/gary
Is swap size still as relevant as it was a decade ago? On a host with 20G RAM, I'd imagine the likelihood of hitting swap being much lower. Having a couple of G available just in case seems like a good idea, but I'm unsure if the old (Total RAM * 2)=swap equation still rings true.
*does some quick internet sleuthing*
According to this article: https://www.cyberciti.biz/tips/linux-swap-space.html RedHat basically says that for CentOS server 7, a minimum of 4G is recommended. The caveat to this is that if your system needs to hibernate/suspend-to-disk, in which case you'll want 1.5-2x RAM as swap in order to write in-use memory to disk.
-jason
--- Talk Mailing List talk@gtalug.org <mailto:talk@gtalug.org> https://gtalug.org/mailman/listinfo/talk
--- Talk Mailing List talk@gtalug.org <mailto:talk@gtalug.org> https://gtalug.org/mailman/listinfo/talk

On 2019-02-27 10:02 a.m., Gary via talk wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have?
I asked a question about this at a GTALUG Q&A a few years back. Basically what I remember was: * are you frequently running out of memory? If not, don't change anything. * depending on what applications you're running, there are various kernel parameters that govern swap behaviour. They're tuned for "typical" performance. * The OOM killer (out-of-memory process killer) can sometimes kill a task that's taking up what it thinks is too much memory. I sometimes get that with very large (or very badly thought out) OpenSCAD renders, and it can be annoying to have to work round it. OOM killer exists to keep the system stable, and doesn't care if your work isn't happening. Swap is more of a thing on smaller machines such as a Raspberry Pi. These days, you've always got enough memory + swap until you find that one job for which you don't. For me, that was trying to build MySQL (for someone else, I promise!) on a Raspberry Pi. cheers, Stewart

Thank you. My intent (haven't done it yet) is to use mmap() in c++ for a very large file (2 gigs). I suspect that the virtual memory technology in x86 would simply page in/out file data to/from ram using the least recently used algorithm. Would the swap partition size be material here or am I worrying unnecessarily. /gary On 19-02-27 10:38 AM, Stewart C. Russell via talk wrote:
On 2019-02-27 10:02 a.m., Gary via talk wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? I asked a question about this at a GTALUG Q&A a few years back. Basically what I remember was:
* are you frequently running out of memory? If not, don't change anything.
* depending on what applications you're running, there are various kernel parameters that govern swap behaviour. They're tuned for "typical" performance.
* The OOM killer (out-of-memory process killer) can sometimes kill a task that's taking up what it thinks is too much memory. I sometimes get that with very large (or very badly thought out) OpenSCAD renders, and it can be annoying to have to work round it. OOM killer exists to keep the system stable, and doesn't care if your work isn't happening.
Swap is more of a thing on smaller machines such as a Raspberry Pi. These days, you've always got enough memory + swap until you find that one job for which you don't. For me, that was trying to build MySQL (for someone else, I promise!) on a Raspberry Pi.
cheers, Stewart
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk

Note that if you mmap() a file, it has no direct impact on swap usage. (Because the actual file is effectively the backing store.) This might be a helpful read: https://stackoverflow.com/questions/43541420/when-and-how-is-mmaped-memory-s... Hope that helps! John On Wed, 2019/02/27 11:47:59AM -0500, Gary via talk <talk@gtalug.org> wrote: | Thank you. My intent (haven't done it yet) is to use mmap() in c++ for a | very large file (2 gigs). I suspect that the virtual memory technology in | x86 would simply page in/out file data to/from ram using the least recently | used algorithm. Would the swap partition size be material here or am I | worrying unnecessarily. | /gary

Linux is somewhat unusual in that it dynamically kills large processes when it's running out of memory. You used to have to set limits to get that behavior. Because of it, I run a moderately large swap (~8 GB) and can watch large jobs drive swap usage up. Then I decide if I want them dead. --dave On 2019-02-27 10:38 a.m., Stewart C. Russell via talk wrote: On 2019-02-27 10:02 a.m., Gary via talk wrote: I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? I asked a question about this at a GTALUG Q&A a few years back. Basically what I remember was: * are you frequently running out of memory? If not, don't change anything. * depending on what applications you're running, there are various kernel parameters that govern swap behaviour. They're tuned for "typical" performance. * The OOM killer (out-of-memory process killer) can sometimes kill a task that's taking up what it thinks is too much memory. I sometimes get that with very large (or very badly thought out) OpenSCAD renders, and it can be annoying to have to work round it. OOM killer exists to keep the system stable, and doesn't care if your work isn't happening. Swap is more of a thing on smaller machines such as a Raspberry Pi. These days, you've always got enough memory + swap until you find that one job for which you don't. For me, that was trying to build MySQL (for someone else, I promise!) on a Raspberry Pi. cheers, Stewart --- Talk Mailing List talk@gtalug.org<mailto:talk@gtalug.org> https://gtalug.org/mailman/listinfo/talk -- David Collier-Brown, | Always do right. This will gratify System Programmer and Author | some people and astonish the rest dave.collier-brown@indexexchange.com<mailto:dave.collier-brown@indexexchange.com> | -- Mark Twain CONFIDENTIALITY NOTICE AND DISCLAIMER : This telecommunication, including any and all attachments, contains confidential information intended only for the person(s) to whom it is addressed. Any dissemination, distribution, copying or disclosure is strictly prohibited and is not a waiver of confidentiality. If you have received this telecommunication in error, please notify the sender immediately by return electronic mail and delete the message from your inbox and deleted items folders. This telecommunication does not constitute an express or implied agreement to conduct transactions by electronic means, nor does it constitute a contract offer, a contract amendment or an acceptance of a contract offer. Contract terms contained in this telecommunication are subject to legal review and the completion of formal documentation and are not binding until same is confirmed in writing and has been signed by an authorized signatory.

I suspect you use vmstat to determine the swap usage (?) /gary On 19-02-27 01:14 PM, Dave Collier-Brown via talk wrote:
Linux is somewhat unusual in that it dynamically kills large processes when it's running out of memory. You used to have to set limits to get that behavior. Because of it, I run a moderately large swap (~8 GB) and can watch large jobs drive swap usage up. Then /*I*/ decide if I want them dead.
--dave
On 2019-02-27 10:38 a.m., Stewart C. Russell via talk wrote:
On 2019-02-27 10:02 a.m., Gary via talk wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? I asked a question about this at a GTALUG Q&A a few years back. Basically what I remember was:
* are you frequently running out of memory? If not, don't change anything.
* depending on what applications you're running, there are various kernel parameters that govern swap behaviour. They're tuned for "typical" performance.
* The OOM killer (out-of-memory process killer) can sometimes kill a task that's taking up what it thinks is too much memory. I sometimes get that with very large (or very badly thought out) OpenSCAD renders, and it can be annoying to have to work round it. OOM killer exists to keep the system stable, and doesn't care if your work isn't happening.
Swap is more of a thing on smaller machines such as a Raspberry Pi. These days, you've always got enough memory + swap until you find that one job for which you don't. For me, that was trying to build MySQL (for someone else, I promise!) on a Raspberry Pi.
cheers, Stewart
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk -- David Collier-Brown, | Always do right. This will gratify System Programmer and Author | some people and astonish the rest dave.collier-brown@indexexchange.com | -- Mark Twain
*/CONFIDENTIALITY NOTICE AND DISCLAIMER/*/ : This telecommunication, including any and all attachments, contains confidential information intended only for the person(s) to whom it is addressed. Any dissemination, distribution, copying or disclosure is strictly prohibited and is not a waiver of confidentiality. If you have received this telecommunication in error, please notify the sender immediately by return electronic mail and delete the message from your inbox and deleted items folders. This telecommunication does not constitute an express or implied agreement to conduct transactions by electronic means, nor does it constitute a contract offer, a contract amendment or an acceptance of a contract offer. Contract terms contained in this telecommunication are subject to legal review and the completion of formal documentation and are not binding until same is confirmed in writing and has been signed by an authorized signatory./
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk

Well. sorta /proc, that underlies most Linux tools --dave On 2019-02-27 4:48 p.m., Gary via talk wrote:
I suspect you use vmstat to determine the swap usage (?) /gary
On 19-02-27 01:14 PM, Dave Collier-Brown via talk wrote:
Linux is somewhat unusual in that it dynamically kills large processes when it's running out of memory. You used to have to set limits to get that behavior. Because of it, I run a moderately large swap (~8 GB) and can watch large jobs drive swap usage up. Then /*I*/ decide if I want them dead.
--dave
On 2019-02-27 10:38 a.m., Stewart C. Russell via talk wrote:
On 2019-02-27 10:02 a.m., Gary via talk wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? I asked a question about this at a GTALUG Q&A a few years back. Basically what I remember was:
* are you frequently running out of memory? If not, don't change anything.
* depending on what applications you're running, there are various kernel parameters that govern swap behaviour. They're tuned for "typical" performance.
* The OOM killer (out-of-memory process killer) can sometimes kill a task that's taking up what it thinks is too much memory. I sometimes get that with very large (or very badly thought out) OpenSCAD renders, and it can be annoying to have to work round it. OOM killer exists to keep the system stable, and doesn't care if your work isn't happening.
Swap is more of a thing on smaller machines such as a Raspberry Pi. These days, you've always got enough memory + swap until you find that one job for which you don't. For me, that was trying to build MySQL (for someone else, I promise!) on a Raspberry Pi.
cheers, Stewart
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk -- David Collier-Brown, | Always do right. This will gratify System Programmer and Author | some people and astonish the rest dave.collier-brown@indexexchange.com | -- Mark Twain
*/CONFIDENTIALITY NOTICE AND DISCLAIMER/*/ : This telecommunication, including any and all attachments, contains confidential information intended only for the person(s) to whom it is addressed. Any dissemination, distribution, copying or disclosure is strictly prohibited and is not a waiver of confidentiality. If you have received this telecommunication in error, please notify the sender immediately by return electronic mail and delete the message from your inbox and deleted items folders. This telecommunication does not constitute an express or implied agreement to conduct transactions by electronic means, nor does it constitute a contract offer, a contract amendment or an acceptance of a contract offer. Contract terms contained in this telecommunication are subject to legal review and the completion of formal documentation and are not binding until same is confirmed in writing and has been signed by an authorized signatory./
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk
-- David Collier-Brown, | Always do right. This will gratify System Programmer and Author | some people and astonish the rest davecb@spamcop.net | -- Mark Twain

Linux is somewhat unusual in that it dynamically kills large processes when it's running out of memory. You used to have to set limits to get that behavior. Because of it, I run a moderately large swap (~8 GB) and can watch large jobs drive swap usage up. Then /*I*/ decide if I want them dead. --dave On 2019-02-27 10:38 a.m., Stewart C. Russell via talk wrote:
On 2019-02-27 10:02 a.m., Gary via talk wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? I asked a question about this at a GTALUG Q&A a few years back. Basically what I remember was:
* are you frequently running out of memory? If not, don't change anything.
* depending on what applications you're running, there are various kernel parameters that govern swap behaviour. They're tuned for "typical" performance.
* The OOM killer (out-of-memory process killer) can sometimes kill a task that's taking up what it thinks is too much memory. I sometimes get that with very large (or very badly thought out) OpenSCAD renders, and it can be annoying to have to work round it. OOM killer exists to keep the system stable, and doesn't care if your work isn't happening.
Swap is more of a thing on smaller machines such as a Raspberry Pi. These days, you've always got enough memory + swap until you find that one job for which you don't. For me, that was trying to build MySQL (for someone else, I promise!) on a Raspberry Pi.
cheers, Stewart
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk
-- David Collier-Brown, | Always do right. This will gratify System Programmer and Author | some people and astonish the rest davecb@spamcop.net | -- Mark Twain

As a side note. I have found that at times it is better to have no swap space or a small swap space. In the case of things like web servers, a sudden burst of activity can cause the web server to start to run into swap. Once this starts the response to requests starts to slow and quickly the server can be just about ground to a halt. If there is enough swap space the web server can go offline for a very long time. In this case it is better so have a few requests fail quickly than to have the system go effectively offline for an extended period.. On 2/27/19 1:20 PM, David Collier-Brown via talk wrote:
Linux is somewhat unusual in that it dynamically kills large processes when it's running out of memory. You used to have to set limits to get that behavior. Because of it, I run a moderately large swap (~8 GB) and can watch large jobs drive swap usage up. Then /*I*/ decide if I want them dead.
--dave
On 2019-02-27 10:38 a.m., Stewart C. Russell via talk wrote:
On 2019-02-27 10:02 a.m., Gary via talk wrote:
I have kubuntu 18.04 with 20 gigs ram. Does anyone know what the optimum size swap area that I should have? I asked a question about this at a GTALUG Q&A a few years back. Basically what I remember was:
* are you frequently running out of memory? If not, don't change anything.
* depending on what applications you're running, there are various kernel parameters that govern swap behaviour. They're tuned for "typical" performance.
* The OOM killer (out-of-memory process killer) can sometimes kill a task that's taking up what it thinks is too much memory. I sometimes get that with very large (or very badly thought out) OpenSCAD renders, and it can be annoying to have to work round it. OOM killer exists to keep the system stable, and doesn't care if your work isn't happening.
Swap is more of a thing on smaller machines such as a Raspberry Pi. These days, you've always got enough memory + swap until you find that one job for which you don't. For me, that was trying to build MySQL (for someone else, I promise!) on a Raspberry Pi.
cheers, Stewart
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk -- David Collier-Brown, | Always do right. This will gratify System Programmer and Author | some people and astonish the rest davecb@spamcop.net | -- Mark Twain
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk
-- Alvin Starr || land: (905)513-7688 Netvel Inc. || Cell: (416)806-0133 alvin@netvel.net ||
participants (9)
-
Alvin Starr
-
Dave Collier-Brown
-
David Collier-Brown
-
Gary
-
Jason Shaw
-
John Sellens
-
Mauro Souza
-
Stewart C. Russell
-
William Porquet