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.
.... .... % Total Cumulat |
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 !!
UID
ibm11140034