How to improve Ubuntu performance thanks to ZSwap

Tux mascot

For several months now, a tool called Z-Swap. This tool helps us optimize the operation of the operating system by better managing memory and making the paging memory be stored in the ram memory and not in another device.

This kernel tool is useful, especially if we have a computer with few resources, with a slow processor or with a slow hard disk, which causes the operation of the operating system to slow down more than normal.

Before activating and using ZSwap, we must make sure that we do not have it activated. In old versions of Ubuntu, in derived distributions or in LTS versions we may not have this function activated. I currently use Ubuntu 17.10 and this version already has it activated by default. But the best is check for ourselves that it is activated, thus, we only have to write the following in the terminal:

cat /boot/config-`uname -r` | grep -i zswap

If this appears to us CONFIG_ZSWAP = y, it will mean that it is activated, if it appears the same but ends in «n», it will mean that we do not have it activated. If we do not have it activated we have to edit the grub file. To do this we open gedit with root permission:

gksu gedit /etc/default/grub

And we replace the line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

By

GRUB_CMDLINE_LINUX_DEFAULT = "splash silencioso zswap.enabled = 1 zswap.compressor = lz4"

We save, close the file and update the grub:

sudo update-grub

Now we have to activate another tool that uses ZSwap, the Lz4 compressor. To do this, from the same terminal, we write the following:

sudo su
echo lz4 >> / etc / initramfs-tools / modules
echo lz4_compress >> / etc / initramfs-tools / modules
update-initramfs -u

We restart the pc and now we can check again if we have ZSwap activated, using the first command that we use in the terminal and showing the message first. As well we will notice an increase in the performance of our team, being faster in certain tasks such as opening Gimp.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Francisco Antonio Nocetti Anziani said

    Mauricio Figueroa

  2.   Michel said

    Since you copy articles without mentioning their author ... at least translate it well. The command lines have spaces that are non-existent, they are generated by google translator.
    The original article is this:
    https://ubuntu-mate.community/t/enable-zswap-to-increase-performance/11302

    1.    Jimmy olano said

      PERMISSION, WITH ALL RESPECT my opinion:

      Well ME WHAT I AM INTERESTED IN IS LEARNING, the dissemination of free knowledge I EXPLAIN:
      that article on ubuntu-mate (in English) quickly answers what I thought while reading this article: how do we know we have the LZ4 compressor on?

      dmesg | grep -i zswap

      I ADD that we use Ubuntu 16.o4 LTS and both are activated by default because it is the first time we have heard about ZSwap, much less activate it ourselves (see our Twitter account @ ks7000 status 926793773756977152
      https://twitter.com/ks7000/status/926793773756977152
      )

      BY THE WAY the command in quotes 'uname -r' does not work in Ubuntu - at least in our version, we assume that in ArchLinux IT IS ADVANCED we are going to ask a colleague who uses it and if we get an answer we will pay you back in these parts.

      OTHER DETAIL: that article (from what the author himself writes) is based (simplified I would say) from the Archlinux Wiki
      https://wiki.archlinux.org/index.php/Zswap

      ? GREETINGS and happy day, let's keep spreading our knowledge !?

    2.    Solrak Rainbow Warrior said

      Thank you for saying it, because then you put it on and your machine freaks out.

  3.   Jimmy olano said

    I recommend this article about ZRAM, ZSWAP and ZCACHE, very enlightening (in English) in terms of the hardware that one has to work and the available options:

    https://askubuntu.com/questions/471912/zram-vs-zswap-vs-zcache-ultimate-guide-when-to-use-which-one

    (Now I don't bother with my comments anymore, greetings!)