Ubuntu 14.04 using Zram

Source: Internet
Author: User

As we all know, the bottleneck of modern computer is hard disk, and Linux system in the design, in order to high-load security at the expense of performance, using virtual memory swap as a stopgap measure, not the system lack of available memory crashes, the results can be imagined that once the swap to the hard disk will be slow as cattle, The performance will go straight down. So theoretically, once you use swap, it means you should add a memory bar.


Zram is the gospel of the poor, a part of physical memory virtual into a special compression function of the block device (similar to TMPFS, but TMPFS does not have compression function), as a swap partition, by compressing the swap to obtain additional performance improvement, compression ratio of about 3:1.


Zram officially entered the production state at the start of Linux kernel 3.13. Ubuntu 14.04.5 kernel is 3.16, can be assured to use Zram. In fact, many companies have started using zram very early.


1, the Import module Zram, will produce a new block device/dev/zram0

Modprobe Zram


2, adjust the capacity, the use of 512M memory here

echo 1024M >/sys/block/zram0/disksize


3. Create a Swap partition

Mkswap/dev/zram0

4. Mount the Swap partition

Swapon-p 100/dev/zram0

Using the Free-m command, you can find that the swap partition is more 512m,-p than the priority, and the value is about the higher the priority level.


If the swap exceeds 512M, it will be the same as the Linux preset: the system slows down. After all, Zram is not a silver bullet.


In addition, Zram can be used to a certain extent in place of TMPFS, such as the/TMP partition, not detailed.


Reference documents

Https://wiki.gentoo.org/wiki/Zram



This article is from the "Focus on Linux Operations" blog, please be sure to keep this source http://purplegrape.blog.51cto.com/1330104/1708945

Ubuntu 14.04 using Zram

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.