35 Improving the Performance of Multithreaded Applications

Learn how to improve the performance of Oracle Communications Billing and Revenue Management (BRM) multithreaded applications.

Topics in this document:

Tuning Multithreaded Workloads

In most cases, increasing the number of threads that an application or process can use increases performance. However, too many threads can result in too much context switching between threads, which can decrease performance.

To determine the optimum number of threads, increase the number of threads and watch the CPU utilization. If adding threads increases system time, adding threads is not helping performance.

Controlling Thread Load on Multithreaded Applications

The number of child threads allowed is controlled by the children entry in the application's pin.conf file. You can set the number of threads manually by editing the pin.conf file or automatically by using the pin_mta_monitor monitoring utility.

To improve performance, you can limit the number of child threads. For example, you can limit the number of threads during the business day to prevent excessive load on the network and increase the number of threads during off-peak hours.

To control the number of threads for an MTA by using pin_mta_monitor:

Note:

After entering a command at the monitor prompt, press the spacebar once and then press Enter. If you do not enter a space after the command, the utility does not run the command.

  1. Go to the directory from which you run the MTA.
  2. Ensure the following is configured in the configuration (pin.conf) file:
    mta_application monitor monitor

    where mta_application is the MTA that pin_mta_monitor tracks. For example, the following is used for pin_inv_accts:

    pin_inv_accts monitor monitor
  3. Start the pin_mta_monitor utility by running the following command:
    pin_mta_monitor mta_application

    The (mon)> prompt appears.

  4. Provide the number by which you want to increase or decrease the number of threads that mta_application uses (press the spacebar and then press Enter).

    • To increase the number of threads that mta_application uses, enter:

      (mon)> t+number
    • To decrease the number of threads that mta_application uses, enter:

      (mon)> t-number

For example, the following commands increase the thread pool of pin_inv_export by two threads:

pin_mta_monitor pin_inv_export
(mon)> t+2

Monitoring the Thread Activity of Multithreaded Applications

Use the pin_mta_monitor utility to monitor the thread activity of MTAs.

Note:

After entering a command at the monitor prompt, press the spacebar once and then press Enter. If you do not enter a space after the command, the utility does not run the command.

To monitor the thread activity of an MTA:

  1. Go to the directory from which you run the MTA.

  2. Start the pin_mta_monitor utility by running the following command:

    pin_mta_monitor mta_application

    where mta_application is the MTA that pin_mta_monitor tracks. For example, the following command is used to monitor the activity of pin_inv_export:

    pin_mta_monitor pin_inv_export
  3. The (mon)> prompt appears.

    To print the thread activity of the mta_application to stdout:

    (mon)> p

    The following is a sample output of the thread activity that pin_mta_monitor prints for pin_inv_export:

    Required:2, cmd:print
    Thread_id:2, Working POID:0.0.0.1 /invoice 221084 0, Flag:0
    Thread_id:3, Working POID:0.0.0.1 /invoice 220860 0, Flag:0
  4. To stop printing the thread activity of the mta_application to stdout:

    (mon)> q