Skip to main content

User Manual

zRAM virtual swap file

In the KeeneticOS operating system of Keenetic routers, the general-purpose parameters that affect the device performance are the virtual memory swap file and the network address translation acceleration mode.

Note

An important characteristic of a computer system can be considered operational (volatile) memory, usually called RAM (Random Access Memory). This is a buffer with a high-speed data exchange interface in which the processor can store operational information while processing tasks.

In modern routers based on embedded processor solutions, a special subsystem for network address translation (NAT) significantly impacts the speed of processing traffic transmitted over the network. To offload the main processor, network address translation processing can be performed by a special hardware module.

RAM virtualization and network address translation mechanism settings can be managed from the web interface, 'General system settings' menu, selecting the required performance level.

zram-en.png

Consider these settings in more detail.

Swap file in a virtual area of RAM (RAM disk).

A swap file (SWAP file or SWAP partition is used on *nix operating systems for these tasks) becomes necessary due to the limited amount of physically installed RAM. When the amount of data required to be stored while the processor is working on the task at hand exceeds the RAM capacity, and in some other cases, the system may move some of the operational data to ROM storage (Read-Only Memory, or non-volatile memory). This frees up space in RAM to store data for the processor's current requests.

When using the zRAM virtual disk for a swap file, a specialized system module selects, according to certain criteria, areas of RAM that can be efficiently reduced in size by rapid compression. The data in these areas is compressed and, when requested, is restored and transferred to the processor. Physically, this data remains in RAM. But, it is available to the system by accessing the virtual swap file.

This algorithm can significantly improve system efficiency with a little extra load on the processor for some types of operation.

For example, the IntelliQoS component may increase memory usage under network load. Still, some of the data buffered by the processor will be relatively rarely needed, and a virtual swap file is perfectly suited to accommodate it.

Note

The swap file may not be needed in practical operation scenarios on devices with large capacity RAM. Enabling virtual swap zRAM for these devices does not make much sense.

In fact, using a swap file on a RAM disk does not cause any significant increase in CPU utilization. Disabling the swap file on the RAM disk essentially makes sense if there is a physical high-speed (SSD) drive where the system hosts a classic swap file or SWAP partition or if problems are detected with zRAM enabled.

Important

We recommend that you do not use flash drives or hard disk drives with SMR shingle magnetic recording technology to host a swap file or SWAP partition. Such devices are not designed for either frequent random (non-sequential) data access or multiple overwrite cycles.

We recommend the use of modern SSDs or HDDs for such applications with conventional perpendicular magnetic recording (CMR) technology.

For more information, see the instructions on Using the zRam swap file.