|< Day Day Up >|
9.3. Optimizing an Application
When optimizing an application, several areas of the application's execution may present a problem. This section directs you to the proper section based on the problem that you are seeing.
Figure 9-1 shows the steps that we will take to optimize the application.
To start diagnosing, go to Section 9.3.1.
9.3.1. Is Memory Usage a Problem?
9.3.2. Is Startup Time a Problem?
9.3.3. Is the Loader Introducing a Delay?
To test whether the loader is a problem, set the ld environmental variables described in the previous chapters. If the ld statistics show a significant delay when mapping all the symbols, try to reduce the number and size of libraries that the application is using, or try to prelink the binaries.
9.3.4. Is CPU Usage (or Length of Time to Complete) a Problem?
Quite often, different parts of an application will have different performances. It may be necessary to isolate those parts that have poor performance so that their performance statistics are measured by the performance tools without measuring the statistics of those parts that do not have a negative performance impact. To facilitate this, it may be necessary to change an application's behavior to make it easier to profile. If a particular part of the application is performance-critical, when measuring the performance aspects of the total application, you would either try to measure only the performance statistics when the critical part is executing or make the performance-critical part run for such a long amount of time that the performance statistics from the uninteresting parts of the application are such a small part of the total performance statistics that they are irrelevant. Try to minimize the work that application is doing so that it only executes the performance-critical functions. For example, if we were collecting performance statistics from the entire run of an application, we would not want the startup and exit procedures to be a significant amount of the total time of the application runtime. In this case, it would be useful to start the application, run the time-consuming part many times, and then exit immediately. This allows the profilers (such as oprofile or gprof) to capture more information about slowly running code rather than parts that are executed but unrelated to the problem (such as launching and exiting). An even better solution is to change the application's source, so when the application is launched, the time-consuming portion is run automatically and then the program exits. This would help to minimize the profile data that does not pertain to the particular performance problem.
9.3.5. Is the Application's Disk Usage a Problem?
9.3.6. Is the Application's Network Usage a Problem?
If the application is known to cause an unacceptable amount of network I/O, go to Section 9.8.6.
Otherwise, you have encountered an application performance issue that is not covered in this book. Go to Section 9.9.
|< Day Day Up >|