Limit state storage, Limit database fetches, Limit page sizes – Apple WebObjects 3.5 User Manual

Page 158

Advertising
background image

Chapter 9

Deployment and Performance Issues

158

Limit State Storage

As the amount of memory required by an application becomes large, its
performance decreases. You can solve this problem by limiting the amount of
state stored in memory or by storing state using some other means, as described
in the chapter “Managing State” (page 109). You can also set up the application
so that it shuts down if certain conditions occur, as described in the section
“Automatically Terminating an Application” (page 155).

One common mistake is neglecting to set a session time-out value. By default,
sessions almost never expire, so the application may be using valuable memory
to store sessions that users have long forgotten. When you set the session time-
out value, if the session is idle for that amount of time, it terminates and its state
is removed from memory. This is described in more detail in the chapter
“Managing State” (page 109).

Limit Database Fetches

Every database access that your application performs is a potential drag on
performance. One easy way to limit trips to the database is to perform
prefetching. For more information, see the chapter “Answers to Common
Design Questions” in the Enterprise Objects Framework Developer’s Guide.

Limit Page Sizes

Be aware of the size of the HTML pages that you are downloading to the client
machine. The larger the page, the more time it takes to download and draw. At
first glance, your component’s HTML might not seem unreasonably large;
however, be sure you take into account the following:

Image files.

Does the page download a lot of images? If so, how large are these

images? If image files are making the page too large, consider using GIF
images, which are often much smaller than other formats, or consider
limiting the number of images you use.

Reusable components.

Does the page include reusable components? If so, does

the reusable component itself contain any reusable components? You must
factor in the size of each component included and all of the image files that
each component uses.

Repetitions.

If the page uses a repetition, how large it the array that the

repetition iterates over? How large is the amount of HTML generated for
each element in the array? In particular, if you have a repetition that
generates a table row for each element in a large array, the page may take a
long time to render.

Advertising