V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
initialdp
V2EX  ›  Linux

请教“free -m”的问题

  •  
  •   initialdp · Sep 15, 2016 · 2721 views
    This topic created in 3524 days ago, the information mentioned may be changed or developed.
    如下是一台 VPS 的结果。比较奇怪的是:为什么 free 的内存有 672M ,仍然会使用 swap ? 感觉不太合理啊,是什么参数需要调整么? 谢谢。

    total used free shared buffers cached
    Mem: 1000 784 215 87 87 368
    -/+ buffers/cache: 328 672
    Swap: 2047 1 2046
    ruojiner
        1
    ruojiner  
       Sep 16, 2016   ❤️ 1
    大部分 Linux 系统在内核编译时会设定一个阈值,物理内存使用到百分之几开始往 swap 调页,当然这个使用了仅仅 1M 还是无所谓的,如果看着不舒服,在物理内存足够的情况下完全可以关掉。
    initialdp
        2
    initialdp  
    OP
       Sep 16, 2016
    @ruojiner 谢谢。

    事前已经调整过以下两个参数:
    vm.swappiness = 10
    vm.vfs_cache_pressure = 200

    从这两个参数讲,系统应该是尽量利用内存、尽早回收内存。理论上讲,在空闲内存有 672M 的情况下,更不可能用到 swap 才对。
    用到 swap 倒是无所谓,只是为什么会在这种情况下用到 swap ,让人疑惑。对 linux 系统的内存管理不熟悉,感觉系统实际表现与预期差异很大。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   854 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:32 · PVG 04:32 · LAX 13:32 · JFK 16:32
    ♥ Do have faith in what you're doing.