From 26c31e16dd87f1b76a34a18406c273d4871ae031 Mon Sep 17 00:00:00 2001 From: adi Date: Wed, 24 Aug 2022 15:26:07 +0300 Subject: [PATCH] DOc for memory profiling --- docs/troubleshooting.rst | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 docs/troubleshooting.rst diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst new file mode 100644 index 000000000..c11ed662a --- /dev/null +++ b/docs/troubleshooting.rst @@ -0,0 +1,35 @@ +Troubleshooting +=============== + +In case of **troubleshooting**, CGRateS can monitorize memory profiling and CPU profiling. + +Memory Profiling +---------------- + +Creating the memory profile files. +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Firstly, go to the main config directory and run manager with the flag named ```-memprof_dir```. For this example, I choosed ```tmp``` directory from my machine. +Also, there are other flags that we can use: + +```-memprof_interval``` - Time between memory profile saves. By default, the time between writing into files is 5 seconds. +```-memprof_nrfiles``` - Number of memory profile to write. By default, the numbers of files is 1. + +:: + + cd ~/go/src/github.com/ITsysCOM/Rakuten/ricc/cfgs/cgrmanager/dev + cgr-manager -config_path=. -logger=*stdout -memprof_dir=/tmp/ + +In the running process, this will create a file named ```mem1_prof.prof```. Let the engine run for some time, and then you can kill the process. When the process is killed, it will create another file named ```mem_final.prof``` containing the final memory profiling information. + +Reading the memory profile files +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Next step is to read properly the memory profiling. We will use the tool from go package, pprof. Go to the directory where the files were written and read the files. + +:: + + cd /tmp + go tool pprof mem1.prof + +It will open a console, and to check the memory usage, type ```top``` to see. For more documentation about this tool, we recommand you to read the pprof package documentation from golang, or simply type ```help```. \ No newline at end of file