Translated message

A translation of this page exists in English.

Warning message

This translation is outdated. For the most up-to-date information, please refer to the English version.

什么是参数 "max_map_count",它会影响服务器性能吗?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9

Issue

  • 软件厂商建议增加 vm.max_map_count 的值,这对系统有负面影响吗?

Resolution

  • 根据 kernel-doc/Documentation/sysctl/vm.txt:

    • 此文件包含进程可以具有的最大内存映射区域数。内存映射区域用作调用 malloc 的副作用,直接由 mmap 和 mprotect 调用,并在加载共享库时也被调用。

    • 虽然大多数应用程序需要不到一千个映射,但某些程序(特别是 malloc 调试器)可能会消耗大量映射,例如,每个分配最多一个或多个映射。

    • 默认值为 65530。

  • 降低该值可能会导致应用程序行为出现问题,因为系统会在进程达到限制时返回内存不足错误。降低这个限制的好处是它可以为其他内核释放 lowmem。

  • 增加限制可能会增加服务器上的内存消耗。没有立即消耗内存,因为这仅在软件请求时使用,但它可以在服务器上允许更大的应用程序空间。

Root Cause

Diagnostic Steps

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments