Linux Memory

Mango milk 2021-02-23 16:22:46
linux memory

free -h

total used free shared buff/cache available
Mem: 3.7G 1.1G 1.4G 1.0M 1.2G 2.4G
Swap: 0B 0B 0B
used: Used memory
free: Memory left at present
shared: Memory shared by multiple programs
buff/cache: File search ,inode, Cache like that , Improve performance
available: Represents the memory that an application can apply for
buff(Buffer Cache) It's a kind of IO cache , Buffer for memory and hard disk , yes io The device's read / write buffer . According to the disk read and write design , Centralize distributed write operations , Reduce disk fragmentation and hard disk repeat seek , To improve system performance .
cache(Page Cache) It's a kind of cache , be used for CPU Buffer between and memory , It's the file system cache.
Save the read data , Re read if hit ( Find the data you need ) Don't read the hard disk , If you don't hit the learning hard disk . The data is organized according to the frequency of reading , Put the most frequently read content in the easiest place to find , Keep going back to the back of what you no longer read , Until you remove .
They all take up memory . Both are RAM Data in . Simply speaking ,buff Is about to be written to disk , and cache It's read from the disk .
Available memory = free + buff/cache
Used memory = used + shared + buff/cache
eliminate buff/cache ( Use it carefully , eliminate cache, Reading the hard disk directly can cause too much pressure , Something bad happened )
* sync: Write all unwritten system buffers to disk , Include modified i-node、 Delayed block I/O And read-write mapping files
* echo 1 > /proc/sys/vm/drop_caches: eliminate page cache
* echo 2 > /proc/sys/vm/drop_caches: Clear and recycle slab The object in the allocator ( Includes directory item cache and inode cache ).slab An allocator is a mechanism for managing memory in the kernel , Many of these cache data implementations are used pagecache.
* echo 3 > /proc/sys/vm/drop_caches: eliminate pagecache and slab The cache object in the allocator .
/proc/sys/vm/drop_caches Value , The default is 0
本文为[Mango milk ]所创,转载请带上原文链接,感谢

  1. 头条面试官:说说Kafka的消费者提交方式,怎么实现的
  2. 什么是HTTPS以及如何实施HTTPS?
  3. vue使用sdk进行七牛上传
  4. k8s-dns
  5. JavaScript 邮箱验证 - 正则验证
  6. k8s-dashboard
  7. HashMap连环问你能答出几道?
  8. Where does memory overflow occur in the JVM? What are the reasons for this?
  9. How many questions can you answer?
  10. k8s-cronjob
  11. spring注解--Transactional
  12. k8s-cert
  13. Will the Spring Festival holiday be extended to February 27 in 2021? Here comes the response
  14. Headline Interviewer: talk about Kafka's consumer submission method, how to achieve it
  15. 【k8s集群】搭建步骤
  16. k8s-kubeadm
  17. k8s-etcd
  18. What is HTTPS and how to implement it?
  19. Java中使用HashMap改进查找性能
  20. maven发布jar包运行时找不到类问题
  21. J2EE
  22. Vue uses SDK to upload seven cows
  23. k8s-dns
  24. JavaScript mailbox verification - regular verification
  25. k8s-dashboard
  26. How many questions can you answer?
  27. Spring annotation -- transactional
  28. [k8s cluster] construction steps
  29. k8s-kubeadm
  30. k8s-etcd
  31. Using HashMap to improve search performance in Java
  32. There is no class problem when Maven publishes jar package
  33. JavaScriptBOM操作
  34. J2EE
  35. k8s-prometheus-memory
  36. k8s-prometheus disk
  37. k8s-prometheus
  38. JavaScript BOM operation
  39. k8s-prometheus-memory
  40. k8s-prometheus disk
  41. k8s-prometheus
  42. Linux Disk Command
  43. Linux FS
  44. 使用docker-compose &WordPress建站
  45. Linux Command
  46. This time, thoroughly grasp the depth of JavaScript copy
  47. Linux Disk Command
  48. Linux FS
  49. Using docker compose & WordPress to build a website
  50. Linux Command
  51. 摊牌了,我 HTTP 功底贼好!
  52. shiro 报 Submitted credentials for token
  53. It's a showdown. I'm good at it!
  54. Shiro submitted credentials for token
  55. Linux Stress test
  56. Linux Root Disk Extension
  57. Linux Stress test
  58. Linux Root Disk Extension
  59. Redis高级客户端Lettuce详解
  60. springboot学习-综合运用(一)