Java performance on Solaris - Managing CPUs

AID: 8194
  • Status: Published

1180 points

  • By2sbsbsb
  • TypeTutorial
  • Posted on2011-10-13 at 09:51:50
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 
                                    
1:

Select allOpen in new window




Step2: Create a processor set

# psrset -c <CPUID separated by comma>
                                    
1:

Select allOpen 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
                                    
1:

Select allOpen 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>
                                    
1:

Select allOpen 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 
                                    
1:

Select allOpen in new window


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

#psrset -c 6
                                    
1:

Select allOpen in new window


This will create processor set ID 2 having CPU 6

#psrset -c 7
                                    
1:

Select allOpen 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
                                    
1:

Select allOpen in new window



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

Select allOpen 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" 
                                    
1:

Select allOpen 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
                                    
1:

Select allOpen 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)>
                                    
1:
2:
3:

Select allOpen 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. 
                                    
1:

Select allOpen in new window

Asked On
2011-10-13 at 09:51:50ID8194
Tags

Solaris Performance CPUs

Topic

Sun Solaris

Views
650

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Solaris Unix Experts

  1. blu

    11,550

    0 points yesterday

    Profile
    Rank: Sage
  2. woolmilkporc

    7,000

    0 points yesterday

    Profile
    Rank: Genius
  3. ganjos

    6,960

    0 points yesterday

    Profile
    Rank: Guru
  4. arnold

    6,300

    0 points yesterday

    Profile
    Rank: Genius
  5. gerwinjansen

    4,000

    0 points yesterday

    Profile
    Rank: Sage
  6. mrjoltcola

    2,800

    0 points yesterday

    Profile
    Rank: Genius
  7. Tintin

    2,000

    0 points yesterday

    Profile
    Rank: Genius
  8. bummerlord

    2,000

    0 points yesterday

    Profile
    Rank: Master
  9. gheist

    2,000

    0 points yesterday

    Profile
    Rank: Genius
  10. Jacobfw

    2,000

    0 points yesterday

    Profile
    Rank: Master
  11. solarisadmin7

    2,000

    0 points yesterday

    Profile
  12. advega

    1,500

    0 points yesterday

    Profile
  13. yuzh

    1,000

    0 points yesterday

    Profile
    Rank: Genius
  14. amolg

    1,000

    0 points yesterday

    Profile
    Rank: Guru
  15. Anacreo

    1,000

    0 points yesterday

    Profile
  16. oklit

    1,000

    0 points yesterday

    Profile
    Rank: Genius
  17. hossamshaaban

    1,000

    0 points yesterday

    Profile
    Rank: Master
  18. masax

    1,000

    0 points yesterday

    Profile
  19. Manjitk

    1,000

    0 points yesterday

    Profile
  20. 2sbsbsb

    730

    0 points yesterday

    Profile
  21. Laruso21

    500

    0 points yesterday

    Profile
  22. serialband

    200

    0 points yesterday

    Profile
    Rank: Master

Hall Of Fame