How to swap more often
My PC has swappiness set to 60.
cat /proc/sys/vm/swappiness
60
Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.
I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.
I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.
Contents of free -h
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
swapon
:
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 30,5G 3,5G -2
18.04 performance swap memory-usage
|
show 4 more comments
My PC has swappiness set to 60.
cat /proc/sys/vm/swappiness
60
Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.
I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.
I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.
Contents of free -h
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
swapon
:
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 30,5G 3,5G -2
18.04 performance swap memory-usage
2
afaik swap is not a mirror but more like an extension of your ram.
– RoVo
Jan 14 at 12:42
@RoVo Is it more clear with the changes I did?
– brunoais
Jan 14 at 12:44
How much RAM and Swap space do you have, and what makes your machine run out of RAM?
– Soren A
Jan 14 at 14:46
1
@brunoais yes, thanks. Your swap is excessive, unless you're hibernating your comuter, but that's not a show stopper. You probably have plenty of RAM. Usetop
to see more. Interminal
, trysudo sysctl vm.swappiness=80
and then run the machine for a while and see if there's any improvement. Due to more swapping, it may make it worse. If it's not better, then try the opposite... =10... a more common value when there's enough RAM.
– heynnema
Jan 15 at 18:08
1
@brunoais please see my slight edits to my previous comment. If thetop
command confirms your thought about memory hogs, and vm.swappiness tweaking doesn't help... and it may not... you'll just have to get more RAM to solve it.
– heynnema
Jan 15 at 18:14
|
show 4 more comments
My PC has swappiness set to 60.
cat /proc/sys/vm/swappiness
60
Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.
I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.
I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.
Contents of free -h
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
swapon
:
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 30,5G 3,5G -2
18.04 performance swap memory-usage
My PC has swappiness set to 60.
cat /proc/sys/vm/swappiness
60
Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.
I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.
I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.
Contents of free -h
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
swapon
:
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 30,5G 3,5G -2
18.04 performance swap memory-usage
18.04 performance swap memory-usage
edited Jan 15 at 17:53
brunoais
asked Jan 14 at 12:40
brunoaisbrunoais
1136
1136
2
afaik swap is not a mirror but more like an extension of your ram.
– RoVo
Jan 14 at 12:42
@RoVo Is it more clear with the changes I did?
– brunoais
Jan 14 at 12:44
How much RAM and Swap space do you have, and what makes your machine run out of RAM?
– Soren A
Jan 14 at 14:46
1
@brunoais yes, thanks. Your swap is excessive, unless you're hibernating your comuter, but that's not a show stopper. You probably have plenty of RAM. Usetop
to see more. Interminal
, trysudo sysctl vm.swappiness=80
and then run the machine for a while and see if there's any improvement. Due to more swapping, it may make it worse. If it's not better, then try the opposite... =10... a more common value when there's enough RAM.
– heynnema
Jan 15 at 18:08
1
@brunoais please see my slight edits to my previous comment. If thetop
command confirms your thought about memory hogs, and vm.swappiness tweaking doesn't help... and it may not... you'll just have to get more RAM to solve it.
– heynnema
Jan 15 at 18:14
|
show 4 more comments
2
afaik swap is not a mirror but more like an extension of your ram.
– RoVo
Jan 14 at 12:42
@RoVo Is it more clear with the changes I did?
– brunoais
Jan 14 at 12:44
How much RAM and Swap space do you have, and what makes your machine run out of RAM?
– Soren A
Jan 14 at 14:46
1
@brunoais yes, thanks. Your swap is excessive, unless you're hibernating your comuter, but that's not a show stopper. You probably have plenty of RAM. Usetop
to see more. Interminal
, trysudo sysctl vm.swappiness=80
and then run the machine for a while and see if there's any improvement. Due to more swapping, it may make it worse. If it's not better, then try the opposite... =10... a more common value when there's enough RAM.
– heynnema
Jan 15 at 18:08
1
@brunoais please see my slight edits to my previous comment. If thetop
command confirms your thought about memory hogs, and vm.swappiness tweaking doesn't help... and it may not... you'll just have to get more RAM to solve it.
– heynnema
Jan 15 at 18:14
2
2
afaik swap is not a mirror but more like an extension of your ram.
– RoVo
Jan 14 at 12:42
afaik swap is not a mirror but more like an extension of your ram.
– RoVo
Jan 14 at 12:42
@RoVo Is it more clear with the changes I did?
– brunoais
Jan 14 at 12:44
@RoVo Is it more clear with the changes I did?
– brunoais
Jan 14 at 12:44
How much RAM and Swap space do you have, and what makes your machine run out of RAM?
– Soren A
Jan 14 at 14:46
How much RAM and Swap space do you have, and what makes your machine run out of RAM?
– Soren A
Jan 14 at 14:46
1
1
@brunoais yes, thanks. Your swap is excessive, unless you're hibernating your comuter, but that's not a show stopper. You probably have plenty of RAM. Use
top
to see more. In terminal
, try sudo sysctl vm.swappiness=80
and then run the machine for a while and see if there's any improvement. Due to more swapping, it may make it worse. If it's not better, then try the opposite... =10... a more common value when there's enough RAM.– heynnema
Jan 15 at 18:08
@brunoais yes, thanks. Your swap is excessive, unless you're hibernating your comuter, but that's not a show stopper. You probably have plenty of RAM. Use
top
to see more. In terminal
, try sudo sysctl vm.swappiness=80
and then run the machine for a while and see if there's any improvement. Due to more swapping, it may make it worse. If it's not better, then try the opposite... =10... a more common value when there's enough RAM.– heynnema
Jan 15 at 18:08
1
1
@brunoais please see my slight edits to my previous comment. If the
top
command confirms your thought about memory hogs, and vm.swappiness tweaking doesn't help... and it may not... you'll just have to get more RAM to solve it.– heynnema
Jan 15 at 18:14
@brunoais please see my slight edits to my previous comment. If the
top
command confirms your thought about memory hogs, and vm.swappiness tweaking doesn't help... and it may not... you'll just have to get more RAM to solve it.– heynnema
Jan 15 at 18:14
|
show 4 more comments
2 Answers
2
active
oldest
votes
Your free -h
shows...
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
indicates that you have enough RAM and SWAP (you ARE using hibernation).
Tuning your system with regards to swap is a tricky procedure.
It involves:
- how much RAM you have
- how much SWAP you have
- whether swap if FILE based or PARTITION based
- what applications you run and how much RAM they use
- whether you use hiberation, or not
Setting up appropriate swap space is open for large debate. GENERALLY speaking, swap space should be 50-120% of total RAM. Larger amounts of swap are used in a hibernation configuration.
Assuming that you have enough RAM and swap, vm.swappiness is a parameter that you can adjust to optimize the use of RAM vs swap. To see your current setting:
sudo systemctl vm.swappiness
it's normally set to 60.
To temporarily change this setting:
sudo systemctl vm.swappiness=nn
where nn=0 to 100.
Lower settings make more use of RAM and less swapping. Higher settings reduce RAM use and increase swapping.
After determining the optimum value for your configuration, to set it permanently, edit /etc/sysctl.conf
. Add this value to the bottom of the file:
vm.swappiness=90
we've determined that 90 is a good value for your use. This setting MAY slow down your system a bit, as swapping is based on slow disk I/O.
then reboot.
In my case, it's better to have slowdowns here and there but keep the PC responsive than having complete pauses for many seconds just because there's a high need to swap. Thank you.
– brunoais
Jan 17 at 18:10
add a comment |
Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness
is some kind of threshold.
About this topic, Red Hat Knowledge Base states:
this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory
Also, another answer in Ask Ubuntu states:
Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.
A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.
Hence, I think you are working on a misconception about how swap and swappiness works.
I'm not having problems related to swap thrashing. It becomes unresponsive, then after ~1 minute sending ~1GB to swap, the system runs snappy again.
– brunoais
Jan 15 at 17:57
This means that all cold memory is already in swap and the kernel needs to start swapping hot memory. There is nothing the system can do about that. The best you can do is settingswappness
to a higher value and buy more RAM.
– PEdroArthur
Jan 17 at 12:46
In my case, "cold" memory was still being kept in memory. I wonder if it is caused by the size of the swap.
– brunoais
Jan 19 at 9:04
how did you measure that?
– PEdroArthur
Jan 19 at 9:08
Nothing precise but by analysing to which process and thread had memory that hadn't been touched for a while and then manually checking the behavior of such programs manually and take notice when swap use was making the machine slower
– brunoais
Jan 19 at 9:19
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1109629%2fhow-to-swap-more-often%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your free -h
shows...
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
indicates that you have enough RAM and SWAP (you ARE using hibernation).
Tuning your system with regards to swap is a tricky procedure.
It involves:
- how much RAM you have
- how much SWAP you have
- whether swap if FILE based or PARTITION based
- what applications you run and how much RAM they use
- whether you use hiberation, or not
Setting up appropriate swap space is open for large debate. GENERALLY speaking, swap space should be 50-120% of total RAM. Larger amounts of swap are used in a hibernation configuration.
Assuming that you have enough RAM and swap, vm.swappiness is a parameter that you can adjust to optimize the use of RAM vs swap. To see your current setting:
sudo systemctl vm.swappiness
it's normally set to 60.
To temporarily change this setting:
sudo systemctl vm.swappiness=nn
where nn=0 to 100.
Lower settings make more use of RAM and less swapping. Higher settings reduce RAM use and increase swapping.
After determining the optimum value for your configuration, to set it permanently, edit /etc/sysctl.conf
. Add this value to the bottom of the file:
vm.swappiness=90
we've determined that 90 is a good value for your use. This setting MAY slow down your system a bit, as swapping is based on slow disk I/O.
then reboot.
In my case, it's better to have slowdowns here and there but keep the PC responsive than having complete pauses for many seconds just because there's a high need to swap. Thank you.
– brunoais
Jan 17 at 18:10
add a comment |
Your free -h
shows...
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
indicates that you have enough RAM and SWAP (you ARE using hibernation).
Tuning your system with regards to swap is a tricky procedure.
It involves:
- how much RAM you have
- how much SWAP you have
- whether swap if FILE based or PARTITION based
- what applications you run and how much RAM they use
- whether you use hiberation, or not
Setting up appropriate swap space is open for large debate. GENERALLY speaking, swap space should be 50-120% of total RAM. Larger amounts of swap are used in a hibernation configuration.
Assuming that you have enough RAM and swap, vm.swappiness is a parameter that you can adjust to optimize the use of RAM vs swap. To see your current setting:
sudo systemctl vm.swappiness
it's normally set to 60.
To temporarily change this setting:
sudo systemctl vm.swappiness=nn
where nn=0 to 100.
Lower settings make more use of RAM and less swapping. Higher settings reduce RAM use and increase swapping.
After determining the optimum value for your configuration, to set it permanently, edit /etc/sysctl.conf
. Add this value to the bottom of the file:
vm.swappiness=90
we've determined that 90 is a good value for your use. This setting MAY slow down your system a bit, as swapping is based on slow disk I/O.
then reboot.
In my case, it's better to have slowdowns here and there but keep the PC responsive than having complete pauses for many seconds just because there's a high need to swap. Thank you.
– brunoais
Jan 17 at 18:10
add a comment |
Your free -h
shows...
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
indicates that you have enough RAM and SWAP (you ARE using hibernation).
Tuning your system with regards to swap is a tricky procedure.
It involves:
- how much RAM you have
- how much SWAP you have
- whether swap if FILE based or PARTITION based
- what applications you run and how much RAM they use
- whether you use hiberation, or not
Setting up appropriate swap space is open for large debate. GENERALLY speaking, swap space should be 50-120% of total RAM. Larger amounts of swap are used in a hibernation configuration.
Assuming that you have enough RAM and swap, vm.swappiness is a parameter that you can adjust to optimize the use of RAM vs swap. To see your current setting:
sudo systemctl vm.swappiness
it's normally set to 60.
To temporarily change this setting:
sudo systemctl vm.swappiness=nn
where nn=0 to 100.
Lower settings make more use of RAM and less swapping. Higher settings reduce RAM use and increase swapping.
After determining the optimum value for your configuration, to set it permanently, edit /etc/sysctl.conf
. Add this value to the bottom of the file:
vm.swappiness=90
we've determined that 90 is a good value for your use. This setting MAY slow down your system a bit, as swapping is based on slow disk I/O.
then reboot.
Your free -h
shows...
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
indicates that you have enough RAM and SWAP (you ARE using hibernation).
Tuning your system with regards to swap is a tricky procedure.
It involves:
- how much RAM you have
- how much SWAP you have
- whether swap if FILE based or PARTITION based
- what applications you run and how much RAM they use
- whether you use hiberation, or not
Setting up appropriate swap space is open for large debate. GENERALLY speaking, swap space should be 50-120% of total RAM. Larger amounts of swap are used in a hibernation configuration.
Assuming that you have enough RAM and swap, vm.swappiness is a parameter that you can adjust to optimize the use of RAM vs swap. To see your current setting:
sudo systemctl vm.swappiness
it's normally set to 60.
To temporarily change this setting:
sudo systemctl vm.swappiness=nn
where nn=0 to 100.
Lower settings make more use of RAM and less swapping. Higher settings reduce RAM use and increase swapping.
After determining the optimum value for your configuration, to set it permanently, edit /etc/sysctl.conf
. Add this value to the bottom of the file:
vm.swappiness=90
we've determined that 90 is a good value for your use. This setting MAY slow down your system a bit, as swapping is based on slow disk I/O.
then reboot.
edited Jan 17 at 15:51
answered Jan 17 at 15:45
heynnemaheynnema
18.5k22155
18.5k22155
In my case, it's better to have slowdowns here and there but keep the PC responsive than having complete pauses for many seconds just because there's a high need to swap. Thank you.
– brunoais
Jan 17 at 18:10
add a comment |
In my case, it's better to have slowdowns here and there but keep the PC responsive than having complete pauses for many seconds just because there's a high need to swap. Thank you.
– brunoais
Jan 17 at 18:10
In my case, it's better to have slowdowns here and there but keep the PC responsive than having complete pauses for many seconds just because there's a high need to swap. Thank you.
– brunoais
Jan 17 at 18:10
In my case, it's better to have slowdowns here and there but keep the PC responsive than having complete pauses for many seconds just because there's a high need to swap. Thank you.
– brunoais
Jan 17 at 18:10
add a comment |
Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness
is some kind of threshold.
About this topic, Red Hat Knowledge Base states:
this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory
Also, another answer in Ask Ubuntu states:
Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.
A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.
Hence, I think you are working on a misconception about how swap and swappiness works.
I'm not having problems related to swap thrashing. It becomes unresponsive, then after ~1 minute sending ~1GB to swap, the system runs snappy again.
– brunoais
Jan 15 at 17:57
This means that all cold memory is already in swap and the kernel needs to start swapping hot memory. There is nothing the system can do about that. The best you can do is settingswappness
to a higher value and buy more RAM.
– PEdroArthur
Jan 17 at 12:46
In my case, "cold" memory was still being kept in memory. I wonder if it is caused by the size of the swap.
– brunoais
Jan 19 at 9:04
how did you measure that?
– PEdroArthur
Jan 19 at 9:08
Nothing precise but by analysing to which process and thread had memory that hadn't been touched for a while and then manually checking the behavior of such programs manually and take notice when swap use was making the machine slower
– brunoais
Jan 19 at 9:19
add a comment |
Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness
is some kind of threshold.
About this topic, Red Hat Knowledge Base states:
this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory
Also, another answer in Ask Ubuntu states:
Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.
A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.
Hence, I think you are working on a misconception about how swap and swappiness works.
I'm not having problems related to swap thrashing. It becomes unresponsive, then after ~1 minute sending ~1GB to swap, the system runs snappy again.
– brunoais
Jan 15 at 17:57
This means that all cold memory is already in swap and the kernel needs to start swapping hot memory. There is nothing the system can do about that. The best you can do is settingswappness
to a higher value and buy more RAM.
– PEdroArthur
Jan 17 at 12:46
In my case, "cold" memory was still being kept in memory. I wonder if it is caused by the size of the swap.
– brunoais
Jan 19 at 9:04
how did you measure that?
– PEdroArthur
Jan 19 at 9:08
Nothing precise but by analysing to which process and thread had memory that hadn't been touched for a while and then manually checking the behavior of such programs manually and take notice when swap use was making the machine slower
– brunoais
Jan 19 at 9:19
add a comment |
Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness
is some kind of threshold.
About this topic, Red Hat Knowledge Base states:
this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory
Also, another answer in Ask Ubuntu states:
Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.
A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.
Hence, I think you are working on a misconception about how swap and swappiness works.
Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness
is some kind of threshold.
About this topic, Red Hat Knowledge Base states:
this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory
Also, another answer in Ask Ubuntu states:
Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.
A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.
Hence, I think you are working on a misconception about how swap and swappiness works.
answered Jan 14 at 14:37
PEdroArthurPEdroArthur
39127
39127
I'm not having problems related to swap thrashing. It becomes unresponsive, then after ~1 minute sending ~1GB to swap, the system runs snappy again.
– brunoais
Jan 15 at 17:57
This means that all cold memory is already in swap and the kernel needs to start swapping hot memory. There is nothing the system can do about that. The best you can do is settingswappness
to a higher value and buy more RAM.
– PEdroArthur
Jan 17 at 12:46
In my case, "cold" memory was still being kept in memory. I wonder if it is caused by the size of the swap.
– brunoais
Jan 19 at 9:04
how did you measure that?
– PEdroArthur
Jan 19 at 9:08
Nothing precise but by analysing to which process and thread had memory that hadn't been touched for a while and then manually checking the behavior of such programs manually and take notice when swap use was making the machine slower
– brunoais
Jan 19 at 9:19
add a comment |
I'm not having problems related to swap thrashing. It becomes unresponsive, then after ~1 minute sending ~1GB to swap, the system runs snappy again.
– brunoais
Jan 15 at 17:57
This means that all cold memory is already in swap and the kernel needs to start swapping hot memory. There is nothing the system can do about that. The best you can do is settingswappness
to a higher value and buy more RAM.
– PEdroArthur
Jan 17 at 12:46
In my case, "cold" memory was still being kept in memory. I wonder if it is caused by the size of the swap.
– brunoais
Jan 19 at 9:04
how did you measure that?
– PEdroArthur
Jan 19 at 9:08
Nothing precise but by analysing to which process and thread had memory that hadn't been touched for a while and then manually checking the behavior of such programs manually and take notice when swap use was making the machine slower
– brunoais
Jan 19 at 9:19
I'm not having problems related to swap thrashing. It becomes unresponsive, then after ~1 minute sending ~1GB to swap, the system runs snappy again.
– brunoais
Jan 15 at 17:57
I'm not having problems related to swap thrashing. It becomes unresponsive, then after ~1 minute sending ~1GB to swap, the system runs snappy again.
– brunoais
Jan 15 at 17:57
This means that all cold memory is already in swap and the kernel needs to start swapping hot memory. There is nothing the system can do about that. The best you can do is setting
swappness
to a higher value and buy more RAM.– PEdroArthur
Jan 17 at 12:46
This means that all cold memory is already in swap and the kernel needs to start swapping hot memory. There is nothing the system can do about that. The best you can do is setting
swappness
to a higher value and buy more RAM.– PEdroArthur
Jan 17 at 12:46
In my case, "cold" memory was still being kept in memory. I wonder if it is caused by the size of the swap.
– brunoais
Jan 19 at 9:04
In my case, "cold" memory was still being kept in memory. I wonder if it is caused by the size of the swap.
– brunoais
Jan 19 at 9:04
how did you measure that?
– PEdroArthur
Jan 19 at 9:08
how did you measure that?
– PEdroArthur
Jan 19 at 9:08
Nothing precise but by analysing to which process and thread had memory that hadn't been touched for a while and then manually checking the behavior of such programs manually and take notice when swap use was making the machine slower
– brunoais
Jan 19 at 9:19
Nothing precise but by analysing to which process and thread had memory that hadn't been touched for a while and then manually checking the behavior of such programs manually and take notice when swap use was making the machine slower
– brunoais
Jan 19 at 9:19
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1109629%2fhow-to-swap-more-often%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
afaik swap is not a mirror but more like an extension of your ram.
– RoVo
Jan 14 at 12:42
@RoVo Is it more clear with the changes I did?
– brunoais
Jan 14 at 12:44
How much RAM and Swap space do you have, and what makes your machine run out of RAM?
– Soren A
Jan 14 at 14:46
1
@brunoais yes, thanks. Your swap is excessive, unless you're hibernating your comuter, but that's not a show stopper. You probably have plenty of RAM. Use
top
to see more. Interminal
, trysudo sysctl vm.swappiness=80
and then run the machine for a while and see if there's any improvement. Due to more swapping, it may make it worse. If it's not better, then try the opposite... =10... a more common value when there's enough RAM.– heynnema
Jan 15 at 18:08
1
@brunoais please see my slight edits to my previous comment. If the
top
command confirms your thought about memory hogs, and vm.swappiness tweaking doesn't help... and it may not... you'll just have to get more RAM to solve it.– heynnema
Jan 15 at 18:14