We need using gpertools to find the memory or CPU issue. That’s what this document is about.

Install gperftools

Install gperftools as described in https://github.com/gperftools/gperftools. We get the library and the command line tools.

Compiler libch.so

Disable jemalloc -DENABLE_JEMALLOC=OFF in cpp-ch/CMakeLists.txt, and recompile libch.so.

Run Gluten with gperftools

For Spark on Yarn, we can change the submit script to run Gluten with gperftools. Add the following to the submit script:

export tcmalloc_path=/data2/zzb/gperftools-2.10/.libs/libtcmalloc_and_profiler.so # the path to the tcmalloc library
export LD_PRELOAD=$tcmalloc_path,libch.so # load the library in the driver
--files $tcmalloc_path # upload the library to the cluster
--conf spark.executorEnv.LD_PRELOAD=./libtcmalloc_and_profiler.so,libch.so # load the library in the executor
--conf spark.executorEnv.HEAPPROFILE=/tmp/gluten_heap_perf # set the heap profile path, you can change to CPUPROFILE for CPU profiling

For thrift server on local machine, note using export LD_PRELOAD="$tcmalloc_path libch.so" # load the library in the driver to preload dynamic libraries.

Analyze the result

We can get the result in the path we set in the previous step. For example, we can get the result in /tmp/gluten_heap_perf. We can use the following website to analyze the result: https://gperftools.github.io/gperftools/heapprofile.html https://gperftools.github.io/gperftools/cpuprofile.html


Back to top

Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache Gluten, Gluten, Apache, the Apache feather logo, and the Apache Gluten project logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

Apache Gluten is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Privacy Policy

This site uses Just the Docs, a documentation theme for Jekyll.