Memory profiling is the process of dynamic program analysis using TCMalloc to determine a program's memory consumption and identify ways to optimize it. In this recipe, we discuss how you can use memory profilers on the Ceph daemons for memory investigation.
Let's see how to profile memory use for the Ceph daemons running on our nodes:
- Start the memory profiler on a specific daemon:
# ceph tell osd.2 heap start_profiler
Note
To auto-start the profiler as soon as the Ceph osd
daemon starts set the environment variable as CEPH_HEAP_PROFILER_INIT=true
.
It's a good idea to keep the profiler running for a few hours so that it can collect as much information related to the memory footprint as possible. At the same time, you can also generate some load on the cluster.
- Next, print heap statistics about the memory footprint that the profiler has collected:
# ceph tell osd.2 heap stats
- You can also dump heap stats on a file that can be used later; by default...