Online Tutorials & Training Materials | STechies.com
Register Login
Advertisement

Generate Call Stacks of SAP HANA Threads

|| 0

Generate Call Stacks of SAP HANA Threads
Stechies

How to generate call stacks of SAP HANA threads?

In few scenarios, the information in views like M_SERVICE_THREADS is not adequate for understanding what the threads are actually doing. Additionally, it may happen that SELECTs from SAP HANA monitoring views no longer functions when SAP HANA is stuck.

In these cases, it is advisable to generate the call stacks of the active threads. This SAP doc lists which options exist for that purpose.

Solution:

The options listed below exist for generating the SAP HANA call stacks:

Approach

Scenario

Details

M_SERVICE_THREAD_CALLSTACKS

SQL connection reqired

The SAP HANA monitoring view M_SERVICE_THREAD_CALLSTACKS can be queried for determining the call stacks of running threads.

SQL: "HANA_Threads_Callstacks"

SQL connection required
flexibly aggregated and combined with thread information

This command permits  to aggregate information from M_SERVICE_THREAD_CALLSTACKS in several ways. This makes it easier to determine popular call stacks which are identical for various threads.

SAP HANA Studio
-> Administration
-> Performance
-> Threads
-> Create call stacks

SQL connection possible

In SAP HANA Studio the user can check the call stacks of individual active threads by activating the appropriate check box.

hdbcons
-> context l -s
SAP HANA Studio
-> SQL console
-> MANAGEMENT_CONSOLE_PROC
-> context l -s

no SQL connection required

For all active threads, this hdbcons command dumps the call stacks.

hdbcons
-> runtimedump dump
SAP HANA Studio
-> SQL console
-> MANAGEMENT_CONSOLE_PROC
-> runtimedump dump

no SQL connection required
part of more comprehensive data collection

This hdbcons command generates a SAP HANA runtime dump that encompasses call stacks and other information such as thread activities and monitoring view content.
User can use SAP HANADumpViewer for generating a graphical hierarchy for the call stacks of the threads.

hdbcons
-> profiler_clear
-> profiler_start
-> profiler_stop
-> profiler_print
SAP HANA Studio
DBACOCKPIT

no SQL connection required
summary of multiple sampling snapshots

The kernel profiler trace takes multiple snapshots of SAP HANA thread activities and also provides a DOT file with a graphical presentation of the call stack hierarchies.

SAP HANA Studio
-> Administration
-> Diagnosis Files
-> Diagnosis Information
-> Collect
fullSystemInfoDump.py

no SQL connection required
part of more comprehensive data collection

The full system info dump retrieves comprehensive system and trace information and can be used for configuring to collect implicitly also runtime dumps.

Linux command
-> gstack

no SQL connection required
no SAP HANA tools required

Incase all the SAP HANA related methods for capturing call stacks fail, user can then use the Linux command gstack for that purpose.
Attention: Using gstack on SAP HANA processes can lock all database activities, so user should only use this option when all the operations are anyway stuck.

Linux
-> /proc/<thread_id>/stack

no SQL connection required
no SAP HANA tools required
quicker than global gstack command

User can verify the call stacks of individual threads by displaying stack information in the virtual /proc file system. User can proceed as follows:
Determine the process ID <process_id> of the relevant SAP HANA process (e.g. indexserver):
ps -ef | grep indexserver
Display the threads of this process, e.g. sorted by current CPU consumption:
top -H -p <process_id>
The first output column PID comprises of the thread IDs <thread_id>. Now user can display the call stack of threads via:
cat /proc/<thread_id>/stack


Advertisement
Advertisement
Advertisement