Articles in this section

How to check THP usage for asd process?

Context

Aerospike best practice recommends disabling THP (JEMalloc 4KB allocations  can prevent 2MB Transparent Huge Pages from being reclaimed) 

 

Method

The THP usage can be verified by summing the AnonHugePages metric in /proc/<PID>/smaps
  • Script to get total from /proc/<PID>/smaps :
cat /proc/`pgrep asd`/smaps|grep AnonH|awk '{sum+=$2;} END{print sum;}'
  • compare to overall AnonHugePages usage on the system from /proc/meminfo:
cat /proc/meminfo|grep AnonHugePages


Example output:
 
# cat /proc/`pgrep asd`/smaps|grep AnonH|awk '{sum+=$2;} END{print sum;}' 
1886208

# cat /proc/meminfo|grep AnonH
AnonHugePages:   1972224 kB


 


Notes

RSS accuracy: System RSS shows an accurate value for the amount of memory currently in use and includes THP. 

THP impact: Transparent Huge Pages (THP) is a Linux memory management system that reduces the overhead of Translation Lookaside Buffer (TLB) lookups on machines with large amounts of memory by using larger memory pages. As such, the system will allocate larger pages of memory to JEMAlloc than otherwise requested, to try and reduce overhead of small allocations. Unfortunately, for database systems, such as aerospike, this causes allocations issues in terms of memory which cannot be released. By default, a standard allocation, which JEMAlloc believes it received, is 4KB. The THP though, will assign a 2MB chunk page by default, resulting in a large chunk being occupied and potentially unused, which cannot be freed due to the 4KB page being used. As JEMAlloc performs its own reduction in overheads and fragmentation avoidance, this is counter-productive and results in exactly the opposite. (ref )
Was this article helpful?
0 out of 0 found this helpful