logo NodeSeekbeta

【Linux内核】另一种增大内存的方法——适合CPU性能过剩但RAM少,硬盘读写不佳(或容量小)的鸡鸡

1234
  • Debian系的OS也可以直接使用apt源里的zram-tools package进行安装:

    sudo apt install zram-tools
    

    安装完毕后可通过编辑 /etc/default/zramswap 调整配置:

    # Compression algorithm selection
    # speed: lz4 > zstd > lzo
    # compression: zstd > lzo > lz4
    # This is not inclusive of all that is available in latest kernels
    # See /sys/block/zram0/comp_algorithm (when zram module is loaded) to see
    # what is currently set and available for your kernel[1]
    # [1]  https://github.com/torvalds/linux/blob/master/Documentation/blockdev/zram.txt#L86
    #ALGO=lz4
    #推荐设置为zstd算法,有着更好的压缩比
    
    # Specifies the amount of RAM that should be used for zram
    # based on a percentage the total amount of available memory
    # This takes precedence and overrides SIZE below
    #PERCENT=50
    
    # Specifies a static amount of RAM that should be used for
    # the ZRAM devices, this is in MiB
    #SIZE=256
    #以上这两个参数取决于希望按照现有内存的比例还是绝对大小来设置zram大小,按需调整
    
    # Specifies the priority for the swap devices, see swapon(2)
    # for more details. Higher number = higher priority
    # This should probably be higher than hdd/ssd swaps.
    #PRIORITY=100
    #不需要动
    

    设置完毕后重启服务应用配置:

    sudo service zramswap restart
    
  • windows有类似的功能吗?

  • 先插个,过后学习

  • @cctv #12 发布于2024/2/18 16:40:29
    windows有类似的功能吗?

    image.png

  • 感谢分享

  • xhj003

  • 先插个,过后学习

  • 好贴

  • 感谢分享!

  • Mark

1234

你好啊,陌生人!

我的朋友,看起来你是新来的,如果想参与到讨论中,点击下面的按钮!

📈用户数目📈

目前论坛共有72280位seeker

🎉欢迎新用户🎉