System performance settings: zRAM virtual swap file and HWNAT traffic accelerator

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.


Consider these settings in more detail.

1. 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 (such as the Keenetic Peak KN-2710). 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.

NOTE: 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.

2. NAT hardware accelerator.

Address translation has become an integral part of IPv4 operation in modern networks. The translation operation can be performed completely by software or partially by a hardware dedicated module, HWNAT (HardWare offloading for Network Address Translation).
In the latter case, a certain portion of the general-purpose resources in the system may be freed up, and processing speed increases markedly. This is usually noticeable in applications that make heavy use of high-speed links between nodes on the LAN and the Internet.

However, for applications that need to access data in packets with HWNAT-translated addresses, a problem arises. Since the data is processed in a separate subsystem, access to it by the processor is limited, and the application may only be able to process it partially.
Here again, the IntelliQoS application and the network application classifier service are examples. On MT7621, EN7512, EN7513, EN7516, EN7528 processor-based devices (KN-1010/1011, KN-1810, KN-1910, KN-2310, KN-2610, KN-3010, KN-2110, KN-2410, KN-2510), the traffic classification service and IntelliQoS will require the hardware NAT engine to be disabled for the service to work properly.

If you want maximum performance from your system, and the detail in recognizing network traffic is negligible, you should leave the hardware accelerator switched on.

Note: Assigning a class of service to a LAN device automatically optimizes that device's Internet traffic handling mode so that prioritization works correctly.

Was this article helpful?

13 out of 13 found this helpful

Have more questions? Submit a request