Skip to main content

Manuale Utente (Inglese)

Using the zRam swap file

Starting with KeeneticOS 2.09 in the Keenetic devices, you can enable the zRam swap file. You may need a swap file for the correct operation of the built-in Transmission torrent client.

zRam — the Linux kernel module (formerly known as compcache) that increases performance by preventing data paging to the hard disk drive and using RAM compression (the lzo compression algorithm) until you need to use a swap file on the hard drive.

The data exchange rate with RAM is much faster than with a hard disk drive; therefore, zRam allows more swap operations on devices with a small amount of RAM. Also, zRam will be useful for SSDs that use flash memory, which has a limited number of overwrite cycles.

From KeeneticOS 3.7 onwards, zRAM can be enabled in the router's web interface under 'Management' on the 'General system settings' page under 'Performance options'.

zram-usage0-en.png

Set the 'Compressed RAM disk for system swap' switch to Enabled.

For devices with KeeneticOS 3.6 and earlier, zRAM can only be enabled from the command-line interface (CLI). Connect to CLI and execute the commands:

(config)> system zram
(config)> system configuration save
zram-usage-en.png

When you execute the system zram command, the system will automatically determine the recommended file size. As a rule, the size of the zRam file corresponds to the size of Keenetic RAM.

In our example, the RAM size of Keenetic Titan (KN-1810) is 256 MB or 262016 Kbytes (you can see it in CLI):

(config)> show system

hostname: Keenetic_Titan
 domainname: WORKGROUP
 cpuload: 1
 memory: 41908/262016
 swap: 0/262012
 memtotal: 262016
 memfree: 183428
 membuffers: 9248
 memcache: 27432
 swaptotal: 262012
 swapfree: 262012
 uptime: 824

In our case, the system automatically selected the swap file size equal to 256 MB.

You can use the show system zram command to view the zRam parameters:

(config)> show system zram

zram: 
 enabled: yes
 compression-algo: lzo
 disk-size: 262016456
 compressed-size: 87
 original-size: 4096
 total-memory-used: 12288
 compression-threads: 2
 compressed-ratio-pcs: 300

To disable memory compression, you can use the command system no zram

(config)> system zram
Zram::Manager: Enabled zram swap of size 262144Kb.
(config)> system no zram
Zram::Manager: Zram swap disabled.