IBM Support

Weekly Tips from DB2 Experts: Working with OS performance tools : 'caliper' in HP-UX

Technical Blog Post


Abstract

Weekly Tips from DB2 Experts: Working with OS performance tools : 'caliper' in HP-UX

Body

Merry Christmas. DB2 mates !!

Holiday is actually good timing for writing blogs for me. Today I would like to write a topic a bit aside from DB2 but very necessary in some difficult performance cases.

When we need hands from OS team and expert, it's better to understand what kind of OS tools are necessary and how it works.
Actually these tools boost up the problem investigation and provide a smoking gun evidence very shortly.
If we don't know much about right tool for a case, we may sometimes spend lots of time to see another bunch of data.

In case of HP-UX, 'caliper' is one of the popular tools for performance problem. 
But actually, we may undergo trial and error to find right options and example which fit for our problem case.  

Here, some examples which can cover some cases.

Let's say that you see a DB2 admin work takes long time unexpectedly and wants to know which area or code function contributes to the time delay.
You expect the work should finish in some 5~10 seconds but it takes around 100 seconds.

This is just a simulated case to show how 'caliper' works.

<Simulated problem aspect>
1. The work takes much of time in db2 client 'db2bp' process side rather than DB2 server 'db2sysc' process.
    So the bottleneck is on client side.

2. The time is taken much due to the misaligned memory access within a function call.

<'caliper' example>

1. Gather 'caliper' output in overall system views.
    As the work takes about 100 seconds in simulated case, gather the caliper with appropriate time duration.

   ( by 'root' terminal )
   # caliper fprof -o caliper_overall_system.txt --event-defaults all --scope system -e120

 

    where '-e120' means 120 seconds.

    Right after the command, reproduce the performance problem case.

 

   From the report, we can see 'db2bp' client process used most CPU ticks and module is vmunix kernel module.
   And these are the kernel functions being executed which are basically just trying to fix up unaligned data access.

....

Process Summary
-------------------------------------------
% Total  Cumulat
   IP      % of              IP
Samples    Total          Samples   Process
-------------------------------------------
  95.34    95.34           224644   db2bp (PID: 2009)
   2.96    98.31             6978   Unknown process(es)
   0.52    98.83             1226   db2sysc (PID: 23636)
   0.32    99.15              764   utild (PID: 3079)
   0.18    99.33              421   resource_tracker (PID: 2987)

....

% Total  Cumulat
   IP      % of              IP
Samples    Total          Samples   Load Module
-----------------------------------------------
  99.97    99.97           224569   vmunix
   0.01    99.98               31   igelan
   0.01    99.99               25   sasd
   0.01   100.00               19   *kernel gateway*

....

 13.07    13.07            29355  vmunix::bubbleup
   9.85    22.92            22125  vmunix::ss_set_rsebs              ss_access.c
   9.19    32.11            20647  vmunix::post_hndlr                hl_ivt.c
   9.19    41.30            20641  vmunix::pre_hndlr                 hl_ivt.c
   9.04    50.33            20306  vmunix::unaligned_get_gr          unaligned_emu.c
   8.74    59.07            19628  vmunix::unaligned_set_gr          unaligned_emu.c

   8.59    67.66            19302  vmunix::ss_get_rsebs              ss_access.c
   6.08    73.75            13667  vmunix::as_ubcopy
   5.18    78.92            11626  vmunix::int_ldst                  unaligned_emu.c
   4.97    83.89            11157  vmunix::copyin                    user_copy.c
   4.08    87.97             9167  vmunix::unaligned_hndlr           hl_ivt.c
   2.54    90.51             5710  vmunix::bubbledown
   1.51    92.02             3392  vmunix::decode_unaligned          unaligned_emu.c
   1.43    93.46             3222  vmunix::unaligned_emu             unaligned_emu.c

   

2. It's not still clear that which function contributes to unaligned memory access.
    So it's time to gather second phase of 'caliper' output with special 'traps' for checking the detail in 'unaligned memory access' perspective.

# caliper traps -o uadref_db2bp_identity.txt --traps-reported UADREF -e120 224644

  where '224644' is the process ID to check,
             traps ...... 
--traps-reported UADREF  : trap area (unaligned memory access)

 Now, we can see the code function name and line number which is culprit of the performance problem.

......
Load Module Summary
-----------------------------------------------------------
                            Samples Per Trap
% Total  Cumulat
 UADREF    % of      Trap     UADREF    OTHER
Samples    Total    Samples                     Load Module
-----------------------------------------------------------
 100.00   100.00      73266    72877      389   libdb2.so
   0.00   100.00          2        0        2   libpthread.so.1
   0.00   100.00          6        0        6   libdb2g11n.so
   0.00   100.00          2        0        2   vmunix
-----------------------------------------------------------
 100.00   100.00      73276    72877      399   Total
-----------------------------------------------------------

Function Summary
-------------------------------------------------------------------------------------
                            Samples Per Trap
% Total  Cumulat
 UADREF    % of      Trap     UADREF    OTHER
Samples    Total    Samples                    Function                          File
-------------------------------------------------------------------------------------
  99.87    99.87      72785    72785        0  libdb2.so::aaa::bbb()  unaligned_memory_access_test.C
   .....
-------------------------------------------------------------------------------------
[Minimum function entries: 5, percent cutoff: 0.10, cumulative percent cutoff: 100.00]

Function Details
---------------------------------------------------------------
                   Samples Per Trap
% Total                                      Line|
 UADREF     Trap     UADREF    OTHER         Slot|  >Statement|
Samples    Samples                      Col,Offset  Instruction
---------------------------------------------------------------
  99.87    [libdb2.so::aaa::bbb(), 0x4000000001dfd0c0, unaligned_memory_access_test.C]
             72785    72785        0         ~4042  Function Totals

         ------------------------------------------------------
        [File not found: /home/junsulee/c/unaligned_memory_access_test.C]
               596      596        0         ~4045   >
              2225     2225        0         ~4047   >
             69964    69964        0         ~4051   >
---------------------------------------------------------------
[Minimum function entries: 0, percent cutoff: 1.00, cumulative percent cutoff: 100.00]


This is just an example of using OS performance tool 'caliper'.
I hope this is going to be help in case you use this tool with DB2 performance problem in HP-UX.

Happy Christmas !!
 

 

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

UID

ibm11140034