Chapter 1: Introduction
There are several tools available to measure the performance of your code and server configuration.
In your code, add optional logic that you can enable to record timing information. Measure the execution time for major tasks such as:
Component business method entry and exit
Entry and exit of JSP or servlet service invocations
Calls to other components or EJBs
Database command execution and result-set processing
Requests for cached connections
JNDI lookups that return EJB proxies or JDBC data sources
In Java code, you can record timings by calling System.currentTimeMillis(). Logging can degrade performance, so be sure to encapsulate the timing code in logic that allows you or your administrators to selectively enable tracing for areas where you are tuning. To allow configuration of the log options, you can use Log4j or the Java Logging package. Both of these packages allow simple configuration of logging options and can be integrated with EAServer. For more information, see “Configuring log profiles” in the EAServer System Administration Guide.
Profiling software measures the frequency of execution of each method or function in your code. Some profiles can also break down the execution time and memory use by each object. Popular options include:
OptimizeIt, from Borland. For detailed instructions on using OptimizeIt with EAServer, see Integrating OptimizeIt in Sybase EAServer, on the Sybase Web site.
JProbe, available from Quest Software.
Load-testing software simulates multiple clients, allowing you to replicate real-world timings and server loads in your test environment. These tools typically allow you to run multiple scripted HTTP client sessions that simulate typical end user request patterns. Popular options include:
OpenSTA, which is available on the Web
Segue silkperformer from Segue Software
Winrunner, Loadrunner, and other test tools from Mercury Interactive
e-TEST and other tools from Empirix
Load-testing strategies When setting performance goals, you must also specify a usage pattern that reflects real-world use of the application. For example, interactive users do not usually submit one request per second. A catalog shopper may download a part description, read it, download another, add it to the shopping cart, and so forth before checking out. To get accurate performance results, you must set up your test tools to mimic typical request patterns, including the “think time” between subsequent requests.
You can monitor memory and process CPU time using system tools such as top on UNIX systems or the Task Manager or Performance Monitor on Windows. Many profiling tools such as OptimizeIt track memory and can help you find the source of memory leaks. In EAServer, you can configure memory thresholds for each server as described in “Configuring memory thresholds”.
In Java code, you can log the amount of free memory reported by the methods freeMemory() and totalMemory() in the java.lang.RunTime class to track total memory use in the Java dynamic allocation heap.
You can also turn on tracing for the Java garbage collector as described in “Trace-logging options”.
EAServer includes these monitoring and tracing tools.
EAServer Manager includes a runtime monitor that shows component, Web application, and connection cache statistics. For more information, see Chapter 11, “Runtime Monitoring,” in the EAServer System Administration Guide.
In a clustered deployment, you can monitor the per-server load as described in “Viewing the current per-server load” in Chapter 7, “Load Balancing, Failover, and Component Availability,” in the EAServer System Administration Guide.
EAServer includes several APIs that you can use to create your own monitoring applications, including:
Jaguar::Monitoring provides methods to monitor the server state, connected users, and performance statistics such as the number of active and pooled component instances.
Jaguar::PerfMonitor provides performance statistics in a per-second, per-minute, and per-hour bucket model for systems that have a statistics provider component installed. EAServer includes statistics providers for the connection caching and HTTP protocol handler subsystems. You can implement additional statistics providers for your application code using the Jaguar::StatProvider and Jaguar::StatProviderController interfaces.
CtsComponents::CacheMonitor allows you to retrieve cache statistics for HTTP response caching, EJB CMP entity bean instance caching, and EJB CMP finder-results caching.
The logPerfManagerStats method in the Jaguar::Management interface reports statistics for components and network listeners that have monitoring thresholds configured for the EAServer Performance Monitor. For an example program that calls this method, see “Obtaining performance monitor statistics”.
For additional documentation of these APIs, see the generated HTML reference documentation in the html/ir subdirectory of your EAServer installation.
You can configure some EAServer subsystems to log trace data to the server log file, including:
Thread monitors, to log performance data for the components to which you have assigned the monitor. See “Thread monitors” for more information.
For EJB CMP entity beans, you can configure the EAServer JDBC wrapper driver to record query execution statistics. See “CMP runtime monitoring” for details.
For in-server Java code, you can turn on tracing for the custom class loader. You can use the trace to identify classes that are loaded redundantly for different components and Web applications. To enable tracing, set the server property com.sybase.jaguar.server.classloader.debug to true. For information on configuring custom class lists, see Chapter 30, “Configuring Custom Java Class Lists,” in the EAServer Programmer’s Guide.
For in-server Java code, you can turn on tracing for the Java garbage collector by setting the com.sybase.jaguar.server.jvm.verboseGC server property to true. The trace output describes how often the garbage collector runs, how long it takes, and what objects are deallocated. For information on the encoding of the output, see the documentation for the JDK version that you are running the server with.
|Copyright © 2005. Sybase Inc. All rights reserved.|