WASKB-010 PERFORMANCE TUNING WEBSPHERE STUDIO APPLICATION DEVELOPER TUTORIAL

PERFORMANCE TUNING WEBSPHERE STUDIO APPLICATION DEVELOPER TUTORIAL

 

MEMORY OPTIMIZATION

Setting JVM Heap Size

WSAD spends a lot of time during startup to grow the JVM heap. You can eliminate heap growth or minimize it by setting a high initial heap size using the -Xms argument. As a rule of thumb, first launch WSAD without any special command line argument. After WSAD starts up, check the memory usage of the javaw.exe process in Windows process listing. The non-heap related memory usage of WSAD is about 30M. So, if WSAD is taking up about 120M of OS memory, the heap size after startup is about 90M.

Optionally, set the maximum heap size of both WSAD and the WebSphere Test Environment (WTE) to limit the maximum memory usage. This is done using the -Xmx command line argument. Note that, WebSphere server runs in a separate JVM than WSAD. You will need to set the memory size of the JVMs separately. Most projects can be developed within a 100MB memory limit of the WSAD JVM. Very small applications can be developed within a 75MB limit.

To set the heap settings, open the Properties dialog of the Windows Start menu item that launches WSAD. From the Shortcut tab set the command line argument in the Target text box as follows:

wsappdev.exe -vmargs -Xms90m -Xmx100m

Caveat:
1. Make sure that there are no typos in the argument. WSAD may fail to start otherwise.
2. When you open very large files, WSAD may run out of memory. It will crash. Use the -Xmx argument only if you are sure about the value.

Similarly, you can set the initial heap size of the WebSphere JVM by double clicking on the server instance, selecting the General tab and setting the JVM argument. The following JVM argument sets the initial (100M) and maximum (200M) heap size:

-Xms100 -Xmx200m

Shutdown DB2 Services

By default DB2 starts many services. You can safely shutdown all DB2 services except for DB2 – DB2. All DB2 service names start with “DB2”. In addition, shut down Warehouse Manager and Warehouse Logger services.

Use a Remote Database

Both DB28.1 and Oracle 9i have significant memory requirements. Multiple developers can share a common database instance. Just create a separate schema for each developer in the common instance. The same set of tables and views can be created in each schema. Developers can independently modify their schema and modify the database content. Just make sure that each developer uses a separate user ID to configure the data source and perform any SQL operations. The user ID should be the same as the schema name.

DISK OPTIMIZATION

WSAD performs heavy disk access to load the code from JAR files and read project files from the workspace folder. Disk optimization has major impact on WSAD performance.

Defragment Regularly

Defragment the drive where WSAD code is installed and where the wrkspace files are located.

Free Up Space

WSAD slows down if the amount of free disk space becomes small (less than 1GB). Free up space and defragment the drives where WSAD is installed and where the workspace is located.

Disable Real-time Virus Checking

Virus checkers intercept every disk access call. This seriously slows down disk I/O. If your company policy allows, disable real-time virus checking.

GUI OPTIMIZATION

Many of these optimizations are suggested for advanced users only. Beginners of WSAD should get used to the tool first.

Navigator Selection

By default, when you select an editor to work on, system automatically selects that file in the Navigator view. This slows down the GUI. You can disable synchronization between the Navigator view and the active editor. To do this select Window->Preferences and select Workbench. Uncheck Link Navigator selection to active editor check box.

Package Selection

By default, when you open a Java class file editor, system automatically selects the class in the Packages view. This slows down the GUI. To disable this open Window->Preferences. Select Java. Uncheck Link Packages view selection to active editor check box.

Outline View

By default, when you move a Java or XML file editor’s cursor, the Outline view attempts to select the section. This can slow down the GUI significantly for large XML, JSP and Java files. Close the Outline view to avoid the synchronization.

JSP Editing

The visual JSP editor is useful but slow to start and takes up memory. You can open a JSP file using the Source Editor (right click on file and select Open With->Source Editor). It starts much faster and you still get code completion and color coding.

Minimize Open Perspectives and Files

WSAD takes more time to start when you have many open perspectives and files. WSAD remembers the files that were open when it was shutdown and it will reopen these files when it starts up again.

Minimize Open Projects

You may have several projects added to the workspace. WSAD attempts to compile and validate all projects. You can significantly speed up the system by closing projects that you are not working on. Just make sure that no other open project depends on the closed projects. To close a project right click on it in the Navigator view and select Close Project.

Closing a project does not delete the files in the system. When you need to work on a closed project, simply right click on it and select Open Project.

BUILD OPTIMIZATION

This section, by far, has the largest impact on performance.

Automatic Build

By default, when you save a Java or JSP file, system compiles the resource. This is handy for small projects. For large projects and classes, this can slow down development. Also, changes made to a Servlet class will restart the web module, if you are currently running the module in a server.

To disable auto-build, open Window->Preferences. Select Workbench and unchek the Perform build automatically on resource modification checkbox.

Once you have made necessary changes to one or more resources, you can manually build the project. To do this, right click on the project in the Packages view and select Build Project. At the time of this writing, the Navigator view gives the option to Rebuild Project only.

Caveat: You must remember to run a manual build before exporting a JAR file. Otherwise, the distributed JAR file may have compile problems or outdated code.

Automatic Validation

Validation finds problems that a compiler can not. There are validators for SQL, XML, JSP, EJB Module, Web Module and more. By default a project is re-validated everytime a file is modified. This can slow down the system significantly. To disable automatic validation open the projects property dialog. Select Validation and uncheck the Run validation automatically option. After you have finished making changes to one or more resources, run the validation manually by right clicking on the project in the Navigator view and selecting Run Validation.

Automatic Refresh

WSAD can be configured to refresh the workspace after a start up. This adds to the startup time. For large projects, you can save a few seconds by disabling it. Open the Preferences dialog. Select the Workbench node. Uncheck Refresh Workspace on startup.