Introduction: Use the Apache Web server as an example to learn how to analyze the performance implications of a public configuration. Use application tracking to observe system calls made during the application's run. By counting the number of calls and the time that occurs, you can easily understand the impact of performance changes.
You can track your applications to find out why they are paused or not running. And you can use the same approach to learn more about your application and understand the performance implications of some configurations. Because Apache is very popular and most readers are familiar with it, this article uses Apache as an example. Each system call made by Apache brings a delay to the availability of Web pages, and you can determine the impact of specific configurations by tracking the Web servers under different configurations.
Application Tracking Overview
During the execution of an application, when you need to open a file, send a packet, or use system resources, it makes a corresponding system call to the underlying operating system. Tracking an application means that these system calls can be observed when the call occurs, which allows you to gain insight into the behavior of the application. In the Solaris and IBM aix® operating systems (AIX), the truss command is used to accomplish this task, and Strace is used in linux®. Listing 1 shows an example of tracking the PWD command.
Listing 1. Tracking pwd Command
-bash-3.00$ truss pwd
...
getcwd ("/export/home/sean", 1025) = 0
/export/home/sean
write(1, " / e x p o r t / h o m e".., 18) = 18
_exit(0)
After removing the output associated with the application loading at the beginning, you can see the three system calls made:
GETCWD returns the current working directory. The output shows the string "/export/home/sean" returned to the buffer.
Write can display the given string. Because the system call is displayed after it has been executed, the results of its execution are exported first. You can also note that the result of the write system call is the number of characters written, plus a carriage return in this example of 17.
_exit uses error code 0 to exit the program, which usually indicates a successful end.
Although this is a very simple example, it demonstrates the extent to which you can observe the internal mechanism of a program through application tracking. For more in-depth information on tracing, see the Resources section.