- Memlock limit too small: 32768 to accommodate segment size: 4194304
# -l The maximum size that may be locked into memory
$ ulimit -l
32
Note that the "memlock" figure is specified in Kb. From the warning, we know our memlock limit needs to be larger than 4194304 bytes. In reality, it is better to oversize it a little.
How to increase memlock limit on Linux?
Unix operating system can enforce "Limits" the resources a process/user can consume. Memlock is one of the resource. On Linux systems, you can adjust the "memlock" parameter in the
- /etc/security/limits.conf
For example, this is what we have specified to correct the "memlock-limit-too-small" issue:
#vi /etc/security/limits.conf
@perfgrp soft memlock 14680064
@perfgrp hard memlock 14680064
* soft nofile 65535
* hard nofile 65535
In general, individual limits have priority over group limits, so if you impose no limits for admin group, but one of the members in this group have a limits line, the user will have its limits set according to this line. In our case, we specify the group limit for "perfgrp" to be 14680064 bytes. For other users, default values will be applied, which is 65535 bytes. Finally, you need to reboot to make new settings effective.
Consideration for Java Applications
Similar to database software, you also have the same tuning requirement for application running on HotSpot. For example,
- For all users who will run HotSpot with large pages, you need to set their memlock limit to a value higher than the maximum heap they will run. This ensures user running the Java application can lock the correct amount of memory.
Of course, the memlock limit to be considered should be based on how much physical memory you have on your systems. See [1] for details.
No comments:
Post a Comment