You are not logged in.

#1 2016-04-13 13:08:47

calef13
Member
Registered: 2007-06-10
Posts: 142

Strategies to avoid thrashing

Hi,

I've been having issues with thrashing, so tried to disable my swap. I've been having issues identical to the poster in this thread:

http://unix.stackexchange.com/a/30596/104325

The solution linked to above seems reasonable, but I don't want to have to manually set limits for all processes, since the thrashing is caused by compile jobs, virtualbox and various other things. Is there a way to set global limits? Can anyone recommend strategies to stop my computer seizing up?

Offline

#2 2016-04-13 14:04:12

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: Strategies to avoid thrashing

If the ulimits trick works for you, I think you can set it per-user in limits.conf

Other than that, you could try tweaking vm.swappiness, and/or enabling zswap.

Offline

#3 2016-04-13 19:03:08

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Strategies to avoid thrashing

Given that you don't say much about your setup I'd say the solution is adding more RAM.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2016-04-14 09:21:41

calef13
Member
Registered: 2007-06-10
Posts: 142

Re: Strategies to avoid thrashing

Thanks for the responses, I'll play around a bit.

I'm considering adding more RAM, I have 8GB at the moment. My question was a bit vague; My main contention is that I feel Linux should handle this more gracefully. I want a way to guarantee that the UI remains responsive at all times. This is a desktop machine after all, not a server. I want to carve out resources so I can always switch between tasks, use the mouse etc... Having to do this by hand by editing ulimit files is something I'd expect to do with a server, not a workstation. I guess I should be complaining to Linus about that though tongue.

Offline

#5 2016-04-14 14:14:46

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: Strategies to avoid thrashing

Might I ask what you are doing with your system?  For a typical system, that should be more than enough memory to browse, run email, do software development, serve and view multimedia, etc... It is even plenty to do non-linear video editing.
Unless you are running multiple VMs, or are doing some serious number crunching with massive arrays, I would not expect you to be thrashing.  (I am not a gamer, so I've no seat-of-the-pants feeling for that)
Perhaps you should be looking for something that is leaking memory or is forking ad nauseam.  Also, are you sure it is thrashing? Any chance you are getting I/O errors on your disk?  Check your journal for that.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2016-04-14 14:23:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,522
Website

Re: Strategies to avoid thrashing

ewaller wrote:

Perhaps you should be looking for something that is leaking memory or is forking ad nauseam.

Agreed, 8GB should be far more than enough for what you've described so far.

But if you really just want to carve out resources for the main UI as you describe, I'd create a vm or an nspawn instance (you can set up x11 forwarding too) and run all these background processes.  You can allot the vm a majority of your mem - say 6gb - and then you'd be sure you'd always have 2gb available for any of the foreground ui processes.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2016-04-15 08:59:12

calef13
Member
Registered: 2007-06-10
Posts: 142

Re: Strategies to avoid thrashing

Thanks for the useful responses. This should be enough to sort the issue. I will confess that in this particular instance, the issues were exacerbated by 3 scala programs running in the background which were consuming a lot of memory. This is my work machine, so I am running a large, multi-threaded compile job in a VM, then compiling on the host as well as running Chrome with lots of tabs open etc.. It's not light usage. The issue is that everything is fine, until I run out of memory, and I only have about 5-10 seconds before the machine freezes. It's not very graceful.

Offline

Board footer

Powered by FluxBB