Pre-Loading Startup

This topic provides details on pre-loading application files to improve application startup performance.

Overview

When an application loads, the initialization process pulls down all of the files specified in the
classpath.

To include files in the class path and reduce the number of requests to the server, package
your application files in JAR files.

To reduce the size of your JAR files, use pack200 to compress certain JAR files. 

Network Load Time

Network load time is directly related to how much data is initially loaded and how many requests are made.

Generally, to reduce network load time:

  • Use pack200 when applicable; see the topic on pack200 for more details.
    For example, without pack200 the Nexaweb client is ~580k in size; with pack200 it is ~180k
  • Delay loading data not needed in the initial startup; this can be done using XInclude
  • JAR up small files so that only one request is made

Nexaweb Application Class File Locations

Nexaweb Studio stores class files in the project directory structure as follows: 

Class Loading Space Nexaweb Project Directory
Files compiled to server class loading space at run timesrc
Files compiled to client class loading space at run timesrc-client
Files compiled to both class loading spaces at run timesrc-shared


Packaging JAR files

To pre-load resources, package the following in JAR files:

  • Package the class files in the Nexaweb project src-client and src-shared directories
  • Package any classes required for the application's welcome screen and for the first actions users are likely to peform from there
  • Package all images used in styles
  • Can allow other resources to piggy-back on pre-loaded resources 

Styles

If you package images used in styles, you must edit the default stylesheet to reflect the location of the images as the classpath.

For example, open the default stylesheet, project\WebContent\Nexaweb\stylesheets\xal-stylesheet.xml, by double clicking on it.

Locate styles similar to the following:

<style applyTo=".scrollButtonDown">
<normal backgroundColor="gradient(button_normal_gradient_xal)"
        borderColor="#888888" borderStyle="solid"borderWidth="1"
        image="Nexaweb/stylesheets/nexaweb2004/images/arrow_down.gif"/>


and change them similar to the following:

 <style applyTo=".scrollButtonDown">
<normal backgroundColor="gradient(button_normal_gradient_xal)" 
        borderColor="#888888" borderStyle="solid" borderWidth="1" 
        image="classpath://arrow_down.gif"/>

MCOs

  1. Use your shell to make pack200 JAR files containing all of your MCOs.
    Go to this link for more detailed instructions:
    http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pack200.html#pack200_compression
  2. If you want 1.1 JVM compatibility, then also make cab files. On an MS-Windows system,
    use the cabarc shell command.
  3. Copy the JARSs into the application project's \webcontent\web-inf\client\lib directory.
  4. Add the following CLASSPATH entry to the .classpath.xml file:
    <classpathentry kind=”lib” path=”WebContent/Web-INF…/Bridges.jar
  5. In the nexaweb-client.xml configuration file, add an entry under pre-loaded-in-applet-def
    element for your MCO jar and cab files.

Loading Files Dynamically - Overview

The Java Runtime Environment (JRE) or browser caches resources loaded for the Nexaweb client. When the client needs a resource, it first looks for that resource in the JRE's cache. If the resource is not available there, the client then requests it from the server.

References

Nexaweb:
pack200
Peformance Tuning

Sun:
The Java Archive Tool
Pack200 Compression