How can I tweak my Linux desktop to be more responsive?

6,207

Solution 1

I suggest reading SwapFAQ , in particular the swapiness parameter.

Solution 2

Some pointers:

  1. Don't run so many GUI programs at once.
  2. Make sure that any programs running in the background that you don't need e.g. Apache are stopped.
  3. Use a distro aimed at low-memory situations (e.g. for a netbook)
  4. Buy more memory.
  5. Buy a faster HD (or SSD) for your swap partition. :)

Solution 3

Purchase more memory? :)

If you are running applications that are using more memory than you have present in the system, there's nothing that any operating system can do about this other then to swap to the swap partition. If this is a situation you find yourself in often, stop running some of the programs that you do not need, or, really, buy more memory, it is very inexpensive these days.

Solution 4

Try to change the values of the kernel variables 'vm.swappiness' and 'vm.page-cluster' to more appropriate values.

  1. Start a terminal emulator.
  2. cd /etc/sysctl.d/
  3. sudo echo "vm.swappiness = 0" > 60-memory-management.conf
  4. sudo echo "vm.page-cluster = 1" >> 60-memory-management.conf
  5. sudo chmod 644 60-memory-management.conf
  6. Reboot.

Check if the new values are in use with:

  1. cat /proc/sys/vm/swappiness
  2. cat /proc/sys/vm/page-cluster

Solution 5

Swapping will heavily decrease performance no matter what, so it's best to avoid that altogether. This may sound stupid, but one option is to not configure a swap partition. I've been running swap-free on all my systems for some time now:

  • 1 GB on the netbook is enough for browsing the web, listening to music and other lightweight stuff.
  • 4 GB on my desktop is enough for all above things plus development (even in Eclipse) and basic image editing.

If you do something that's really memory intensive (Gimp with large images, 3D modelling, CAD) than you should probably purchase some RAM.

Share:
6,207

Related videos on Youtube

Matthew Ruston
Author by

Matthew Ruston

Ubuntu member, Kubuntu member

Updated on September 17, 2022

Comments

  • Matthew Ruston
    Matthew Ruston over 1 year

    I have the experience that Linux works fine until the physical memory is exhausted. As soon as swap space is used the performance is severely degraded and the GUI becomes unresponsive.

    This problem is not limited to a specific distro or desktop, because I've tried a few (and the issue remains).

    What can I do about this?

  • Matthew Ruston
    Matthew Ruston over 13 years
    I have already maximum RAM. I would like to know some tweak that make swapping more efficient than it is.
  • Matthew Ruston
    Matthew Ruston over 13 years
    How does that tweak the Linux system? Hardware change or improvement is not the issue here.
  • Matthew Ruston
    Matthew Ruston over 13 years
    Yes. I slowly come to the same conclusion. I seems to me that the the way the Linux kernel swaps is not very efficient for desktops (on servers all of this work fine). Hence, maybe the recommendation should be to disable all swap space on desktops. Btw. I use 8GB RAM :)
  • phunehehe
    phunehehe over 13 years
    @txwikinger: may I ask why it is fine on servers?
  • Mike H
    Mike H over 13 years
    It's possible that your linux install isn't using all of the hardware available to it. This is a performance issue and you've stated in a previous comment that you're at your max RAM limit. Without knowing more details about your configuration an easy route to take is better hardware.
  • cjac
    cjac over 13 years
    the "Linux system" is composed of hardware and software. Adding memory is "tweaking" the system.
  • cjac
    cjac over 13 years
    I've found that disabling swap entirely tends to make a system respond faster. Apps get notified by the kernel that they don't have memory and respond accordingly.
  • Avery Payne
    Avery Payne over 13 years
    +1, swap is a band-aid that we hope to not use...
  • jjclarkson
    jjclarkson over 13 years
    Most systems monitors just drag down a slow system more it's Schrödinger's cat. Without increasing memory he has to fix memory leaks or trim unnecessary programs that are running.
  • Matthew Ruston
    Matthew Ruston over 13 years
    A lot of usages for desktop don't give this option since they are lapbooks, or netbooks which do not allow a second drive.
  • Matthew Ruston
    Matthew Ruston over 13 years
    Linux is software that runs on hardware. Hardware is not included inside Linux :p
  • Matthew Ruston
    Matthew Ruston over 13 years
    I have extensively tried out different settings for swappiness with no success. I have also noticed, that the opinions about the value of swappiness are not unified at all. For desktops some recommend 10, others 100, meaning they suggest they suggest the total opposite effect.
  • invert
    invert over 13 years
    @txwikinger obviously true, but I considered the question's title which reads "desktop", otherwise I would not have suggested this if a laptop was specifically mentioned :-)
  • Matthew Ruston
    Matthew Ruston over 13 years
    Well.. I meant desktop in order to distinguish from servers, where I believe the swapping works reasonably well. :)
  • Kristof Provost
    Kristof Provost over 13 years
    @cjac: That's usually not the case. You can configure the kernel to do this, but by default it will overcommit (give your app memory which your system doesn't have). As soon as an app touches memory and the kernel can't find any more the out-of-memory killer will terminate one or more processes.
  • Matthew Ruston
    Matthew Ruston over 13 years
    After further tests, I recommend not to use either swapiness 100 nor 0. Both have created situations in which the desktop got into a swapping craze which even had the panel clock stop for more than 20 mins.
  • xenoterracide
    xenoterracide over 13 years
    I think that more ram is more appropriate than faster... RAM speed is limited by the Mobo usually too...
  • bahamat
    bahamat over 13 years
    @txwikinger the reason that swapping is slow is because RAM speeds are so much faster that hard disks. RAM seek time is measured in nanoseconds (10^-9). HDD seek times are measured in milliseconds (10^-3). That's six orders of magnitude, in other words RAM is one million times faster than swap. Your question is like asking how to make a bicycle go as fast as a Concorde jet. You can't.
  • Matthew Ruston
    Matthew Ruston over 13 years
    @bahamat. You are stating the obvious, but it is not the problem. The problem is that the swapping is done very ineffectively, and hence creates something in the direction of the philosopher's problem.
  • bahamat
    bahamat over 13 years
    @txwikinger Ok, that's swell. How about you rewrite the vm subsystem for the Linux kernel that "fixes" swap and submit a patch then? We'll all appreciate that.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 13 years
    With gigabit Ethernet, this is going to be a lot slower than a midrange SSD, and I'm not sure if you could even reach the speed of a 7200rpm hard disk. Maybe with Firewire you can reach the speed of local swap. But it would be more effective to simply add RAM.
  • Matthew Ruston
    Matthew Ruston over 13 years
    @bahamat: Well, I believe that had been done, but the changes have not been accepted by the kernel team. Anyway, I think we are digressing here.
  • Jeff Winkworth
    Jeff Winkworth about 12 years
  • Alessio
    Alessio over 11 years
    with modern SSDs the entire system is likely to be obsolete and ready for replacement long before the SSD dies. it really isn't worth worrying about these days. backups are, of course, still required because a disk - SSD or mechanical - can die at any time.
  • jasonwryan
    jasonwryan over 11 years
    Please do not just post links; include some context so that, should the site you are linking to go down, there is sufficient information here to make the answer meaningful.