Using binary modules to optimize Rational Application Developer in a team environment

This article shows how you can keep some of your projects in source form, and others in binary form, to improve the speed of many of the day-to-day operations that you perform in IBM® Rational® Application Developer.

Gary Karasiuk (karasiuk@ca.ibm.com), Rational Application Developer Performance Analyst, IBM Toronto Lab

Gary KarasiukGary Karasiuk is a Rational Application Developer Performance Analyst at the IBM Toronto Laboratory. You can reach Gary at karasiuk@ca.ibm.com .



Jason Sholl (jsholl@us.ibm.com), Software Engineer, IBM

Jason ShollJason Sholl works on Rational Java 2 Platform, Enterprise Edition (J2EE) tooling at the IBM Raleigh Laboratory.



19 June 2007

Also available in Chinese Japanese

As your application grows, it may not be practical nor desirable to keep your entire application in source form in your workspace. Large workspaces can include more than a hundred projects. It is very unlikely that every developer will need to change every one of those projects every day. A better approach is to keep only the projects or modules that you intend to changing in source form and keep the projects or modules that you are using in binary form. Doing this will greatly reduce the memory footprint of IBM® Rational® Application Developer and greatly speed up many common development tasks. You will still be able to view the source code in the binary projects and do most of the productivity operations, such as Open Declaration (F3), that you have come to depend on often.

As an example, one of the customer workspaces that we use takes 27 minutes to build when the entire workspace is in source form. When most of the modules are in binary form, the build time drops to less than 3 minutes. Please see the Real-world test section at the end of this article for more details about this example.

This article provides step-by-step instructions on how you can exploit binary modules in your environment. It assumes that you are developing an EAR project and that you are using source control. This article applies to version 7.0.0.3 of Rational Application Developer and later. The new shared EAR file support was not included until version 7.0.0.3.

Many of the tips here apply to other IBM Rational products, including Rational® Software Architect, Rational® Software Modeler, and Rational® Web Developer.

Step-by-step approach

The basic practice is for only one developer to change a subset of the projects at any one time. They still may need to see all parts of the application in source form. The list of projects that they need to change can change, so that at any point in time they can add to the list of projects that they can change.

The basic approach is quite simple:

  • Start with an EAR file that contains the complete application, including the source code.
  • Import this EAR file, and this becomes your base. Typically, this EAR file comes from a nightly or weekly build process.
  • You then import from source control the projects or modules that you expect to change.

Example application

This article uses a running example (see Downloads) that has each of the main types of projects that you might encounter while developing a Java™ 2 Platform, Enterprise Edition (J2EE) application:

  • SampleEAR: The EAR itself, which also contains a binary third-party Java Archive (JAR) file called SampleThirdParty.jar
  • SampleEJB: An EJB project example
  • SampleEJBClient: The client part of the EJB project example
  • SampleWeb: An Web project example
  • SampleUtility: An utility project example

Your application will usually have many more projects, but this example includes the main type of J2EE projects (Figure 1).

Figure 1. Example application
Example

Creating the EAR

Normally, you would create the EAR through some sort of automated build process. Typically, most customers do either nightly or weekly builds, but this example will show you how to create the EAR manually.

  1. If the application includes EJBs, then you need to ensure that the EAR has been prepared for deployment before the export (Figure 2).
  2. Export the EAR file by using the Export Shared EAR file wizard, as Figure 3 shows.
Figure 2. Prepare for deployment
Prepare deployment
Figure 3. Exporting the shared EAR file
Exporting shared EAR file
  1. As you see by Figure 3, the new shared EAR file menu item has been added by the helper plug-in.

Note:

If you want to incorporate this as part of your automated build process, you will need to perform these additional steps. (If you are using the Export > Shared EAR file menu item, then you do not need to do these steps.)

  1. In Rational Application Developer V7.0.0.3, manually add two these special files to the EAR after it has been exported:
    • .settings\com.ibm.etools.j2ee.teamshare: This is a marker file, the contents don't matter. I put the word "marker" in the file just so it wouldn't be an empty file.
    • .settings\org.eclipse.wst.common.component: This needs to come from your EAR project in the source workspace.
  2. You can copy these two files to anywhere in your file system (see Figure 4).
  3. Then use a file compression utility to compress them into the EAR file. You can use something like this command:
    > zip -r SampleEAR.ear .settings/*.

Your EAR file now contains the original files and the two files that you added manually (Figure 4).

Figure 4. Modified EAR file in the workspace
Modified EAR file in workspace

Importing the EAR

In a team setting, each developer would start by importing the previously exported EAR file.

  1. Select Import in the J2EE screen (Figure 5).
  2. In the Import window, select your Shared EAR file (Figure 6).
  3. Use the arrows in the Shared EAR import window to select the name of the file, the name of the project, and the runtime target server (Figure 7).
Figure 5. To begin, select Import
Begin, Select Import
Figure 6. Select the file that you want to import
Select file to import
Figure 7. Select the file name, project name, and runtime server
Select file name, project name, and runtime server
  1. Close and then re-open the SampleEAR project. (This is to get around a synchronization bug in Rational Application Developer).
  2. After re-opening the project, your workspace should look like Figure 8. You can see that all of the modules are binary modules.
Figure 8. Screen view after importing your project
Screen view after importing project
  1. You are ready to deploy and run the application.

Switching a binary module to become a source module

Now that you have a base in place, you will need to import the projects that you want to change.

  • Web modules
    1. Use your normal technique for importing a Web module from source control. For this example, we used the open source Concurrent Version System (CVS), as you'll see in Figures 9 and 10.
    2. Make whatever changes that you want to make to your Web project. Your changes will be reflected in your running application.
    3. You can check your changes into your source control system, if you wish, so that they can be picked up by others and by your build process.
Figure 9. Select Projects from CVS under the CVS folder
Select Projects from CVS under CVS folder
Figure 10. Select the module to check out from the CVS
Select module to check out from CVS
  • EJB modules
    The approach for Enterprise Java™Beans (EJB) projects is similar to the approach for Web projects. You simply check out your projects.
  • Utility projects
    The approach for utility projects is similar to the approach for Web projects. You simply check out your projects.

Switching from a source module to a binary module

Switching back to a binary module is quite simple. Simply delete the source project from your workspace, and then request the server to republish. You are now back to using the binary form of the module.

Workaround for deleting the Web project
Because the IBM® WebSphere® Application Server had a lock on some of the Web library files, we couldn't delete the Web project. This is the solution:

  1. Stop the WebSphere server, and then delete the Web project.
  2. After restarting the server, you need to also restart the EAR to be able to use the binary version of the Web archive (WAR) file.

Ad hoc fixes

You can also change code without having to import the project from your source control system. Imagine that you are working late at night, and you want to temporarily fix someone else's code. You don't intend to check this code back in; you merely want to make some temporary changes so that, perhaps, you can finish testing your code.

You can convert any of the binary modules to source modules directly from the EAR.

  1. Right-click on a shared EAR project, and then select Shared EAR > Extract Binary Modules to Projects (Figure 11).
Figure 11. Extract Binary Modules to Projects
Extract Binary Modules to Projects view
  1. Check the box next to the binary module associated with the shared EAR file (the SampleUtility.jar file, in this case) to extract it to your project *Figure 12)
Figure 12. Select the binary module associated with the shared EAR
Select binary module associated with shared EAR
  1. After the import action, you will have a normal source project where you can test your changes, as you see in Figure 13. (But remember: Because this project didn't come from your source control system, you will not be able to check your changes in to save them.)
Figure 13. Normal source project
Normal source project view
  1. When you are finished using the modified source project, simply delete it to revert back to the original binary version.
  2. It is also possible to replace the binary version of the module with the modified source project by using the Shared EAR > Repackage Projects to Binary Modules action.

Real-world test

We took a large workspace that had 6 EJB modules, 5 Web modules, and 29 utility projects. We first did a clean build when all of the projects were in source form. This was performed on a Pentium 4, 3 GHz machine with 2 GB of memory. We then switched to using binary modules, except for one Web project. Again, we did a clean build. Here is what we measured for the two different approaches:

Table 1. Table using a heading tag for the caption, all columns left-aligned (recommended style)
Source workspaceBinary workspace
Elapsed time29.9 minutes2.7 minutes
CPU time30.5 minutes3.9 minutes
Number of bytes read1.9 GB0.25 GB
Page faults443 K22 K
Peak working set931 MB318 MB

As you can see the savings are dramatic.

Conclusion

This article shows how you can keep some of your projects in source form, and others in binary form, to improve the speed of many of the day-to-day operations that you perform in Rational Application Developer. If there are other tips that you know of, that have been effective in your environment, we would love to hear from you.


Download

DescriptionNameSize
The sample application used for this article.SampleEAR.zip10KB

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, SOA and web services, DevOps
ArticleID=230631
ArticleTitle=Using binary modules to optimize Rational Application Developer in a team environment
publish-date=06192007