<

Go Premium for a chance to win a PS4. Enter to Win

x

Java performance on Solaris - Managing CPUs

Published on
9,488 Points
3,488 Views
Last Modified:
Java performance on Solaris - Managing CPUs

There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".  

In a multithreaded environment where multiple threads are fighting for the CPU cycles, which in turn are the causes for things like switch context, thread migration and thereby causing latency. Assigning critical process or thread within a process to a set of dedicated CPU's improves the performance of the given application. It is because the set of dedicated CPU's is not shared by any other application. I have also observed that not only the process or application but critical thread within the process or application if it is bind to a CPU then that too improves performance.


Background
Post Solaris 10 when a user thread is created, LWP (light weight process) is simultaneously created which maps user thread to kernel thread. Light weight process is a layer between user thread and kernel thread. LWP is present because user thread cannot directly interact with kernel thread. A program will create a set of these processes running on Solaris and in turn consuming (competing for, waiting for) resources.

Performance is potentially a huge issue and beyond the scope of this Article. You can read more about performance via a lot of different sites, and a reasonable place to start is : http://www.princeton.edu/~unix/Solaris/troubleshoot/index.html 

This article is really how to maximise performance of a critical application by using dedicated CPU.


Binding a process to a set of dedicated CPU
Step1: Find out how many logical processor Solaris has
# psrinfo -vp 

Open in new window



Step2: Create a processor set

# psrset -c <CPUID separated by comma>

Open in new window


It will create processor set and generate processor set id usually starting from 1.
Note:  One can create multiple processor set.

Step3: Find out the PID for your application (assume it is already running)
#psj

Open in new window


Step 4: Bind the PID to the processor set you have created in Step 2
#psrset -b <Processor Set ID> <PID of Application>

Open in new window


Step 5:  Verify the performance of your application

Binding user thread  to a set of dedicated CPU
Step1: It remains the same as described earlier.

Lets bind the process to CPU 1-5 and two critical thread to CPU 6 and CPU 7 respectively.
Step2:
#psrset -c 1-5 

Open in new window

This will create processor set ID 1 having CPU 1,2,3,4 and 5.

#psrset -c 6

Open in new window

This will create processor set ID 2 having CPU 6

#psrset -c 7

Open in new window

This will create processor set ID 3 having CPU 7

Step3:
Find out the PID for your application (assume it is already running)

#psj

Open in new window


Step4: Dump the thread stack  into a text file
#jstack <PID> > jstack.txt 

Open in new window


Step5: Find the NID value (hexadecimal) for the critical thread and convert into decimal.
#vi jstack.txt | grep "application level search to find out your critical thread" 

Open in new window

Get the corresponding NID value and convert into decimal

Step6:  Verify that those thread are present in your apps.
#prstat -p <PID> -L

Open in new window

It will list all the LWP's for the given PID.

Step 7: Bind the process and LWPs.
#psrset -b <Processor Set ID(1)> <PID of Application> 
#psrset -b <Processor Set ID(2)> <PID of Application/LWP(Decimal vlaue of NID)>
#psrset -b <Processor Set ID(3)> <PID of Application/LWP(Decimal vlaue of NID)>

Open in new window


Verify the performance.

Note: you can start an application on the processor set by the following command
#pserset -e <Processor Set ID> java application name. 

Open in new window

0
Comment
0 Comments

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Join & Write a Comment

Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month