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

Example Analysis of MongoDB taking up too much memory and frequently crashing

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

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail the example analysis of MongoDB's excessive memory usage and frequent crashes. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.

Starting with MongoDB 3.4, the default WiredTiger internal cache size is the larger of:

50%(RAM-1 GB), or 256 MB

For example, on a system with a total of 4GB RAM, WiredTiger cache will use 1.5GB RAM ().

Conversely, a system with 1.25 GB of total memory would allocate 256 MB for WiredTiger cache, since that's more than half of total RAM minus 1 GB ().

// 4GB

0.5 * (4 GB - 1 GB) = 1.5 GB

// 1.25GB

0.5 * (1.25 GB - 1 GB) = 128 MB < 256 MB

After reading the documentation, I checked my memory usage

$ free -h#does not start mongod total used freeMem: 3.7G 2.4G 1.3G #Start mongod total used freeMem: 3.7G 1.8G 364M

It's full of memory.

MongoDB takes up too much memory and is killed by the system, so there is downtime.

solution

Add two parameters

Modify configuration mongodb.conf

#The maximum amount of memory allocated for cache; default is 1/2#of physical RAM wiredTigerCacheSizeGB wiredTigerCacheSizeGB=0.5#Maximum simultaneous connections, default 100000About "MongoDB takes up too much memory and frequently crashes example analysis" This article is shared here, I hope the above content can have some help for everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

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

Database

Wechat

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

12
Report