외장 하드 드라이브를 RasberryPi4에 연결하고 다음을 실행하면:
time du -sh /mnt/disk/thisfolderis300gb.dir
그러면 6분정도 걸리고, 이후의 모든 실행도 6분이 걸리고,
그러나 동일한 하드 드라이브를 오래된 Linux 노트북에 연결하고 동일한 명령을 실행하면 첫 번째 실행에도 6분이 걸리지만 모든 후속 실행은 단지2초.
분명히 일종의 캐싱이 여기서 작동하고 있습니다. 여기서 정확히 무슨 일이 일어나고 있으며 어떻게 RPi에서 동일한 "성능"을 얻을 수 있습니까? (마운트 옵션을 복사해 보았으나 효과가 없었습니다)
두 장치 모두 메모리가 거의 부족하다는 것을 알았습니다.
하드웨어 세부정보:
하드 드라이브: 외장 2.5인치 2TB USB3, ext4. RaspberryPi4
: 4GB RAM, USB3.
오래된 노트북: 6세 이상, 16GB RAM, Linux Mint, USB2만 해당.
RaPi 마운트 옵션: (rw,relatime)
Linux mint 마운트 옵션:(rw,nosuid,nodev,uhelper=udisks2)
*위 설치 옵션을 모두 사용하여 RaPi에 설치를 시도했지만 결과는 동일했습니다.
노트북 /proc/meminfo
, 실행하기 전
MemTotal: 16386892 kB
MemFree: 11127292 kB
MemAvailable: 13237468 kB
Buffers: 192568 kB
Cached: 2331040 kB
SwapCached: 0 kB
Active: 3166152 kB
Inactive: 1523380 kB
Active(anon): 2166896 kB
Inactive(anon): 312204 kB
Active(file): 999256 kB
Inactive(file): 1211176 kB
Unevictable: 96 kB
Mlocked: 96 kB
SwapTotal: 2097148 kB
SwapFree: 2097148 kB
Dirty: 124 kB
Writeback: 0 kB
AnonPages: 2166040 kB
Mapped: 918028 kB
Shmem: 314208 kB
KReclaimable: 238016 kB
Slab: 377336 kB
SReclaimable: 238016 kB
SUnreclaim: 139320 kB
KernelStack: 15360 kB
PageTables: 38840 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 10290592 kB
Committed_AS: 10813140 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 42604 kB
VmallocChunk: 0 kB
Percpu: 6208 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 362240 kB
DirectMap2M: 16404480 kB
노트북 /proc/meminfo
, du 실행 후
MemTotal: 16386892 kB
MemFree: 8264124 kB
MemAvailable: 12752864 kB
Buffers: 1291636 kB
Cached: 2430124 kB
SwapCached: 0 kB
Active: 4706588 kB
Inactive: 1605828 kB
Active(anon): 2591628 kB
Inactive(anon): 346244 kB
Active(file): 2114960 kB
Inactive(file): 1259584 kB
Unevictable: 96 kB
Mlocked: 96 kB
SwapTotal: 2097148 kB
SwapFree: 2097148 kB
Dirty: 5784 kB
Writeback: 0 kB
AnonPages: 2590316 kB
Mapped: 949516 kB
Shmem: 348248 kB
KReclaimable: 1452468 kB
Slab: 1595388 kB
SReclaimable: 1452468 kB
SUnreclaim: 142920 kB
KernelStack: 16544 kB
PageTables: 45964 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 10290592 kB
Committed_AS: 12123736 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 43836 kB
VmallocChunk: 0 kB
Percpu: 6208 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 376576 kB
DirectMap2M: 16390144 kB
RasPi4 /proc/meminfo
, du를 실행하기 전
MemTotal: 3999784 kB
MemFree: 3828048 kB
MemAvailable: 3789780 kB
Buffers: 14584 kB
Cached: 51556 kB
SwapCached: 0 kB
Active: 48208 kB
Inactive: 32684 kB
Active(anon): 14984 kB
Inactive(anon): 8336 kB
Active(file): 33224 kB
Inactive(file): 24348 kB
Unevictable: 16 kB
Mlocked: 16 kB
HighTotal: 3264512 kB
HighFree: 3189372 kB
LowTotal: 735272 kB
LowFree: 638676 kB
SwapTotal: 524284 kB
SwapFree: 524284 kB
Dirty: 4 kB
Writeback: 0 kB
AnonPages: 14792 kB
Mapped: 19408 kB
Shmem: 8576 kB
Slab: 34932 kB
SReclaimable: 14160 kB
SUnreclaim: 20772 kB
KernelStack: 1072 kB
PageTables: 1108 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 2524176 kB
Committed_AS: 85956 kB
VmallocTotal: 245760 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
Percpu: 608 kB
CmaTotal: 262144 kB
CmaFree: 222908 kB
RasPi4 /proc/meminfo
, du 실행 후
MemTotal: 3999784 kB
MemFree: 3274908 kB
MemAvailable: 3742736 kB
Buffers: 428308 kB
Cached: 37832 kB
SwapCached: 0 kB
Active: 254960 kB
Inactive: 227440 kB
Active(anon): 16504 kB
Inactive(anon): 8336 kB
Active(file): 238456 kB
Inactive(file): 219104 kB
Unevictable: 16 kB
Mlocked: 16 kB
HighTotal: 3264512 kB
HighFree: 3200564 kB
LowTotal: 735272 kB
LowFree: 74344 kB
SwapTotal: 524284 kB
SwapFree: 524284 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 16284 kB
Mapped: 19976 kB
Shmem: 8580 kB
Slab: 185740 kB
SReclaimable: 158128 kB
SUnreclaim: 27612 kB
KernelStack: 1056 kB
PageTables: 1172 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 2524176 kB
Committed_AS: 89956 kB
VmallocTotal: 245760 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
Percpu: 608 kB
CmaTotal: 262144 kB
CmaFree: 51616 kB
답변1
대답은 짐작하셨겠지만 캐싱입니다.
캐싱을 개선하는 방법: RAM 추가.
- 많은 양의 RAM을 사용하는 프로세스 실행을 중지합니다.
- 더 많은 RAM을 확보하세요(Pi는 이미 최대 용량이므로 옵션이 아닙니다).