You are not logged in.

#1 2019-03-01 17:08:35

kr37
Member
Registered: 2018-03-17
Posts: 6

Hard drive grinds system to a halt when going to swap

This is probably posted in the wrong place, but I thought it might help someone.

I've been fighting with this for a year now. My laptop has 8GB RAM and 4GB swap on a standard hard drive. When I open too many things (virtualbox with Windows, lots of heavy web pages, etc etc) at a certain point, the hard drive runs continuously, and it is completely impossible to do anything. The mouse will rarely respond, can't close any windows or open a terminal. And if I leave it like this for 20 minutes, it doesn't improve. The clock has stopped, and conky hasn't updated. I have to power it off by holding the power button.

Today I just found this:
https://www.reddit.com/r/linux/comments … down_when/

And based on that, added to /etc/sysctl.conf (which was linked from /etc/sysctl.d/99-dirty-pages.conf)

# 128 MiB.
vm.dirty_background_bytes = 134217728

# 256 MiB.
vm.dirty_bytes = 268435456

Now I can open up masses and masses of pages and programs, and it seems to keep clearing the RAM out much better so it barely touches swap. Even when it does start to use swap, there is no noticeable lag when it does.

Offline

#2 2019-03-02 05:31:06

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,143
Website

Re: Hard drive grinds system to a halt when going to swap

Thank you for this.
I have had the kind of experience described here a couple of times in the last half year or so, although not recently. Both CPU and RAM have plenty of slack, but the system is frozen.

If it comes back I'll definitely try that sysctl tweak. @kr37 (or others) can you think of any possible issues that might result from making those settings default in BunsenLabs? ...or is a future kernel upgrade likely to make it unnecessary?

BTW this forum section is quite appropriate for posting tips like this.

Last edited by johnraff (2019-03-02 05:35:16)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#3 2019-03-02 06:10:13

kr37
Member
Registered: 2018-03-17
Posts: 6

Re: Hard drive grinds system to a halt when going to swap

@johnraff thanks for the reassurance about posting here.

I know nothing of the underlying I/O layers of Linux, but having read a fair amount from the linked page and some of the pages linked from it, I think that this fix forces something to write more frequently, thus preventing some kind of horrendous backlog.

I think your question is, would there be a situation in which it would be beneficial for the I/O queues or I/O scheduler (or whatever) to have more flexibility about when it writes to disk? Maybe?

All I know is that this has seemed like the only major flaw in my Bunsenlabs experience--the computer just basically locking up when opening too many programs. Resorting to the power button is pretty bad. If BL(Debian) can now handle this situation gracefully, fantastic, it becomes the most stable/trustworthy OS for me.

Offline

#4 2019-03-02 06:38:18

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,000

Re: Hard drive grinds system to a halt when going to swap

Would leave it up to the kernel to manage this type of thing jmo, though long since advocated lowering swappiness. Consider it a very well known tweak extremely unlikely to have any adverse effect. On this not sure but believe I've reduced these from default too.

Smaller more frequent i/o blocking VS larger ones. Any way it goes, good to see BL-team is willing to go a step above in even considering these types of tweaks. smile

Offline

#5 2019-03-02 07:02:01

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 730

Re: Hard drive grinds system to a halt when going to swap

kr37 wrote:

@johnraff thanks for the reassurance about posting here.

I know nothing of the underlying I/O layers of Linux, but having read a fair amount from the linked page and some of the pages linked from it, I think that this fix forces something to write more frequently, thus preventing some kind of horrendous backlog.

That's pretty much my understanding from a quick perusal too, start writing smaller chunks earlier.

I can't speak to if we should tweak it, 90% of my BL experience is 32 bit where Linus noted it's not such an issue.. so I've not seen it happen.

Logic would suggest smaller write caches mean less potential loss in power failure though, or that hard reset people report being forced into. But then there's Kettering's Law to consider when it comes to logic.

Last edited by Bearded_Blunder (2019-03-02 07:09:25)


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Offline

#6 2019-03-02 12:02:34

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,719

Re: Hard drive grinds system to a halt when going to swap

Seems like a good read http://www.akitaonrails.com/2017/01/17/ … -computers (A good way to benchmark one settings over the other?)

some info

sysctl -a | grep dirty
sysctl vm.swappiness

Last edited by brontosaurusrex (2019-03-02 12:36:28)

Offline

Board footer

Powered by FluxBB