Friday Jul 04, 2008

Performance improvements in J2SE 6

One of the principal design centers of J2SE 6(Mustang) was to yield improved performance and scalability. This has been brought about mostly by the improved runtime performance optimization, a better garbage collection and some client side features.

The runtime performance optimization includes implementation of biased locking, lock coarsening, adaptive spinning, larger page heap support, background compilation and the new registry allocation algorithm.

Biased locking is where the expense of obtaining and releasing an objects lock can be avoided when not necessary. This is based on the fact that most of the synchronized blocks are never contested. Also, the synchronized blocks are accessed by only one thread in their entire lifetime. In this scenario, obtaining and releasing a lock by the same thread again and again is simply a waste of resource. Thus the concept of biased locking. The synchronized blocks are made biased towards the thread that accesses the lock first. Any other time the same thread tries the enter the synchronized block, it does not need to acquire the lock again. However, if any other thread accesses the block, a reversal of the biasing needs to be done, which is again expensive. The benefit of the elimination of atomic operations must exceed the penalty of revocation for this optimization to be profitable.

Lock coarsening is applied in a situation where no noticeable operation is performed between a lock release and lock reacquire. For example, consider a piece of code where a few objects are added to a vector consecutively. Here, each statement acquires the vector lock and releases it. This is a waste of resource. The compiler can observe that there is a sequence of adjacent blocks that operate on the same lock, and merge them into a single block. Not only does the locking overhead reduce, but it becomes one single synchronized block.

Adaptive spinning occurs when a thread tries to access a synchronized block, but does not get the lock. In this situation, the thread start spinning instead of going for an expensive context switching. The amount of time for which the thread spins is adaptive. It depends on factors like the recent spin success/failure, the state of current lock owner etc.

Support for large page heaps are also supported in J2SE 6. This helps avoid costly Translation-Lookaside Buffer (TLB) misses to enable memory-intensive applications to perform better. However, on the downside, the large page heaps can significantly slow down the system, or cause excessive paging in other applications that are running in the system.

Also, background compilation is now enabled in the Java SE 6 HotSpot client compiler. Which means, the hyperthreaded and multi-processing systems could take advantage of spare CPU cycles to optimize Java code execution speed.

On the client side, there has been a significant improvement in the Swing performance. The popular “Gray Rect” problem(That is, when a Swing based application is exposed after being hidden by another application, there is a noticeable delay between the background of the window disappearing and the Swing contents being painted.) has been fixed. This problem was fixed by introducing the double buffering support to Swings. That is, an off-screen image is always kept in sync with the on-screen image. When the Swing application is exposed, the copying is done directly from the off-screen image.

Further, the Java Virtual Machine's boot and extension class loaders have been enhanced to improve the cold-start time of Java applications.

One key feature added to the Java SE 6 HotSpot VM is the integration of DTrace provider.

DTrace is a dynamic troubleshooting and analysis tool first introduced in Solaris 10 and Open Solaris. It can be used to debug software bugs, observe devices (like network or disk activity), observe applications and capture profiling data for performance analysis.

The DTrace provider makes available numerous probes that can be used to monitor JVM internal state and activities as well as the Java application that is running. A few of the probes are the VM Life Cycle probe, Thread Life Cycle probe, Garbage collection probe and the Class Loading probe.

Another key features of J2SE 6 is the implementation of StAX(Streaming API for XML) – a bi-directional API for reading and writing XML. It is based on the mechanism of “pull parsing”, which combines the ease of use of DOM parser with the efficiency of the SAX parser. In Java SE 6, SJSXP(Sun Java Streaming XML Parser) is the default implementation of StAX.

Wednesday Jun 11, 2008

Analyzing data with dim_STAT

dim_STAT is a tool used for monitoring and performing a detailed performance analysis of Solaris/Linux systems .

Overview of dim_STAT :

Let us suppose a number of Solaris and Linux machines need to be monitored in a multi host environment. dim_STAT is a good utility which could be used in this situation.

dim_STAT contains various components like MySQL database, Webserver, WebX tool, STAT-service etc. The working of the various components are described below -

The STAT-service daemon(client) need to run on all the hosts. This daemon will gather data by running various services like vmstat, iostat and netstat on the hosts. Collectors could be started via a Web browser to communicate with the clients.

These collectors will then feed the collected data into the MySQL database. This data will then be analyzed using the WebX tool. The WebX tool can give its analysis in various forms like table, text, graphs etc.

The WebX tool is actually a CGI which is hosted on top of a webserver. The MySQL database, the webserver and the WebX will be installed during the installation of dim_STAT. Further, the MySQL and the webserver will be started when dim_STAT is started.

The data loaded in the MySQL could either be the data collected during an online monitoring or could be the data which was previously collected. Previously collected data could be stored in the form of a tar.Z file and can be used later for data analysis.

dim_STAT installation

The latest dim_STAT could be downloaded from http://dimitrik.free.fr/. (dim_STAT.tar)

After an untar, go into the dim_STAT-INSTALL directory and run install.sh as the root. Enter the various parameters asked. These parameters are used for installing WebServer and MySQL. The default parameters should work.

The /apps is the default dim_STAT home directory and /apps/ADMIN contains all the administration scripts.

You can then start the dim_STAT by using the following commands -

# cd /apps/ADMIN 
# dim_STAT-Server start

To stop servers:

# cd /apps/ADMIN 
# dim_STAT-Server stop
Loading data

Just after installation, dim_STAT will provide a link in the output to access the “Home Page” of dim_STAT.

The “Home Page” looks like this -




Now, click on the “Welcome” link. Note that a link to a complete user guide is given just below the “Welcome” link.


The “Welcome Page” looks like this -



If you want to do online monitoring of the data, click on the “Start New Collect” link. Enter the information to start a new collect on the host named localhost. Click the “Continue” button to move to the next screen. Select the monitoring options of your choice (for example: vmstat, iostat, netstat). Finally click the “Start STAT(s) Collect Now!!!” button to start monitoring.


If you need to analyze a previously collected data, in the “Welcome Page”, click on “Restore Collects from tar.Z”.


Upload the tar.Z file and click on “Restore”. dim_STAT will unzip/untar the file supplied. It will also logically group the files according to the various runs and display them. The runs that need to be analyzed should be chosen and restored. This will load the corresponding data into MySQL.

Changing the database

By default, the database created for storing the data is dim. If you want to create another database for storing the data, click on “Preferences” link on the “Welcome Page”.

In this page, you can create a new database and set any existing database as the default.

The current (working) database name is always present in every dim_STAT window as “Database : [db-name]”.

Analyzing the data:


To start analyzing the data loaded, click on the “Analyze” button on the “Welcome Page”.

You could either do a “Multi-Host Analyze” or a “Single Host Analyze”. The single host is described below

Select “Single-Host Analyze” and click on the “Analyze” button to proceed to the next screen.

Choose the log file you want to analyze and click on the monitoring option of your choice. Eg : let us suppose we click on psSTAT.


Click on the corresponding user and the process name. The “Interval” section gives a choice to select the exact time period that we need to be monitored. In the “Graphics” section, you can choose if you want an applet or a PNG image as the output. The background color and the size of the image could also be modified as needed.

Then, click on the various values that need to be analyzed (eg : CPU%, MEM%) and click on “Start”.

A sample graph is given below -

Friday Apr 20, 2007

Sun's Worldwide Volunteer Week - "Inclusion – Children of Spastics Society" event



This week marked the Sun's 13th annual Worldwide Volunteer Week. With over 30 global volunteer projects conducted, employees joined their local communities to contribute time and energy in a company-wide effort to create opportunities that drive participation, economic growth, and social progress.

I took part in a project which was named as "Inclusion – Children of Spastics Society" event. This event had 30 specially-abled children from the spastics society visiting us for a day (19th April, 2007)

The day started with a ice-breaking event - "passing the ball". The idea was to have the kids pass the ball among themselves as long as the music plays. When the music stops, the person with the ball steps forward and introduces himself/herself. They were encouraged to demonstrate any special talent they had. Though a bit shy initially, the kids caught along and expressed themselves more freely. The volunteers cheering in the background helped them come out of their shell more easily.





We then moved on to a painting competition. The kids were split into groups of 4-5. Each group were helped by one or two volunteers. The general theme was "Celebrating 25 years". Coincidentally, both Sun and the Spastics society are celebrating their 25th anniversary this year. The talent displayed by the kids were amazing.





Post lunch, we had a magic show by Magician Satish Kumar. Satish soon became very popular with the kids. Not just the kids, but we volunteers too were totally astounded by the show.







Simultaneously, we also had a person to draw the caricature of all the kids. This was one of the item in the goodies bag along with chocolates and a Sun cap, which was distributed at the end of the day.

The kids had a really lovely time. It was so evident from their happy faces. A few of them got hooked to FoozeBall too. (We played a few games during the lunch session). But it would not be fair to stop with that! We volunteers had such a great time with these kids. A few of us as planning to visit them at their school in the nearby future.

Kudos to Sun and Sun volunteers for organizing this event and making it a grand success.

Thursday Mar 08, 2007

Bitten by the blog bug

Blogs, blogs and blogs everywhere...now, I have been bitten by the blog bug too.....Hoping to stay that way!!

Now for a little intro - Have been working with the Java Enterprise System Integration team for a little over a couple of years now. It has been pretty interesting here....What we do is - take most of Sun's middle ware products, stack it up, build an installer around it and deliver it as a single product. You could download the product from here. For those customers who are not interested in the entire stack and who think a subset would work just fine for them, we have got suites. Suites contain logically grouped subsets of the entire stack.

Ok, leaving Java ES alone for now. I would probably talk more about it in my upcoming entries.
About

157438

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today