IBM Support

Installing and using strace

Question & Answer


Question

How can I find application performance bottlenecks (hot spots) using strace?

Answer

The strace command is useful for pinpointing some types of application performance bottlenecks. It takes another command as its argument, runs that command, and displays each system call made by the program.

The strace command is not part of the default installation on Netezza systems. To install the strace rpm package, do the following:  

The example below is for a RedHat Version 5.3 system.

1. Install the strace rpm from /opt/nz-hwsupport/pts/rpms or receive latest file from support.
2. Copy the rpm file to the /tmp directory on the system.
3. As the root user, run the following command (version may be different):



    rpm -ivh strace-4.5.18-2.el5.x86_64.rpm
For example:
    [root@NZ-80019-H1 tmp]# rpm -ivh strace-4.5.18-2.el5.x86_64.rpm
    warning: strace-4.5.18-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
    Preparing...                ########################################### [100%]
       1:strace                 ########################################### [100%]

Below is an example of the strace command using the nzsql process.
    [root@NZ-80019-H1 tmp]# strace /nz/kit/bin/nzsql -V 2>&1 | less
    mprotect(0x9c7000, 4096, PROT_READ)     = 0
    mprotect(0xb7b000, 4096, PROT_READ)     = 0
    mprotect(0x864000, 4096, PROT_READ)     = 0
    mprotect(0x82a000, 4096, PROT_READ)     = 0
    mprotect(0x6d7000, 4096, PROT_READ)     = 0
    munmap(0xf7f49000, 49931)               = 0
    access("/etc/selinux/", F_OK)           = 0
    brk(0)                                  = 0xa74c000
    brk(0xa76d000)                          = 0xa76d000
    open("/etc/selinux/config", O_RDONLY|O_LARGEFILE) = 3
    fstat64(3, {st_mode=S_IFREG|0644, st_size=447, ...}) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0xffd5563c) = 0xfffffffff7f55000
    read(3, "# This file controls the state o"..., 4096) = 447
    read(3, "", 4096)                       = 0
    close(3)                                = 0
    munmap(0xf7f55000, 4096)                = 0
    open("/proc/mounts", O_RDONLY|O_LARGEFILE) = 3
    fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0xffd55614) = 0xfffffffff7f55000
    read(3, "rootfs / rootfs rw 0 0\n/dev/root"..., 4096) = 2072
    read(3, "", 4096)                       = 0
    close(3)                                = 0
    munmap(0xf7f55000, 4096)                = 0
    access("/tmp/spin_nzsql", F_OK)         = -1 ENOENT (No such file or directory)
    fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0xffd54cc0) = 0xfffffffff7f55000
    write(1, "nzsql (Netezza SQL) Release 5.0."..., 217nzsql (Netezza SQL) Release 5.0.8 (P-3) [Build 12434]
    contains history support
    Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
    Portions Copyright (c) 1996 Regents of the University of California
    ) = 217
    exit_group(0)                           = ?
    [ Process PID=12916 runs in 32 bit mode. ]

For a list of command options for strace, refer to the the man pages man strace .
[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ095878

Document Information

More support for:
IBM PureData System

Software version:
1.0.0

Document number:
197425

Modified date:
17 October 2019

UID

swg21578057