<

Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

Java performance on Solaris - Managing CPUs

Published on
9,438 Points
3,438 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
0 Comments

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Join & Write a Comment

Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month