Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that the linux server does not have enough memory

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Linux server memory is not enough to solve, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

As the server runs longer, its memory footprint increases. If the server memory is small, it is easy to have full memory, slow down the system, or even stuck. One solution is to increase physical memory, but this involves costs, downtime, opening the chassis, etc. Here's a treatment plan for you to follow. If the effect is good, you don't have to buy memory.

If you analyze the memory footprint of individual processes and add them together, it doesn't equal the total memory footprint. So why does the free -m instruction show that the remaining memory is so small? What does memory do?

The original operating system will choose part of the data cache to memory, free -m results

-/+ buffers/cache: The statistics behind are the cache data

The physical memory used by the cache plus the physical memory consumed by the process is the total physical memory.

In order to protect the service from being stuck due to high physical memory consumption, you can regularly schedule crontab to clear the cache data of the operating system every hour. The configuration is as follows. Every time 45 minutes on the hour, execute

echo 3 > /proc/sys/vm/drop_caches command to clear the operating system cache.

[root@localhost ~]# crontab -l

45 * * * * echo 3 > /proc/sys/vm/drop_caches

It turns out that clearing the cache does not slow down the system, but significantly speeds it up. Of course, my experimental scenario is the case where physical memory is already small, only 8 gigabytes, and the system access users are not large. There is no data to support the suitability of other systems.

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report