我曾经有一个 LAMP/file 无头服务器,运行 Ubuntu 服务器 12.04 和 1 GB 内存。它运行良好,多年来没有出现任何问题。
当我换到新的硬件时4GB和服务器 16.04,提供完全相同的服务,我的内存被缓存填满了,并且我有很多交换使用。
帮帮我,解决这个问题。
$ sudo lshw -C memory
*-firmware
description: BIOS
vendor: American Megatrends Inc.
physical id: 0
version: P1.30
date: 05/16/2014
size: 64KiB
capacity: 4032KiB
capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification uefi
*-cache:0
description: L1 cache
physical id: 5
slot: L1-Cache
size: 128KiB
capacity: 128KiB
capabilities: internal write-back unified
configuration: level=1
*-cache:1
description: L2 cache
physical id: 6
slot: L2-Cache
size: 1MiB
capacity: 1MiB
capabilities: internal varies data
configuration: level=2
*-memory
description: System Memory
physical id: a
slot: System board or motherboard
size: 4GiB
*-bank:0
description: DIMM DDR3 Synchronous 667 MHz (1.5 ns)
product: M378B5673FH0-CH9
vendor: Samsung
physical id: 0
serial: 83047B3B
slot: A1_DIMM0
size: 2GiB
width: 64 bits
clock: 667MHz (1.5ns)
*-bank:1
description: DIMM DDR3 Synchronous 667 MHz (1.5 ns)
product: M378B5773CH0-CH9
vendor: Samsung
physical id: 1
serial: 631A7A4F
slot: A1_DIMM1
size: 2GiB
width: 64 bits
clock: 667MHz (1.5ns)
答案1
请看一下“swappiness 值”: 如何配置 swappiness?
顺便说一句,你只使用了 284M,其余的是缓存: 查看 htop 时缓存内存是什么意思?