EAServer Performance Tuning Techniques
2006-02-23 21:42:38 来源:WEB开发网- ·磁盘阵列(Disk Array)原理
EJBs
For EJBs, follow these suggestions in addition to the ones provided for Java components, and for components in general.
Category | Performance Considerations | More Information |
Intercomponent Calls | The EJB 2.0 architecture introduces local interfaces for calls to an EJB component from within the same Java Virtual Machine. In EAServer, you can use local interfaces for intercomponent calls, and for component invocations made from Servlets and jsp(SUN企业级应用的首选)s hosted by the same server as the component. Using local interfaces can improve performance, but in coding you must be aware that parameters are passed by reference rather than by copy, so object instances passed through a local invocation can be shared by the client and component, and that the called component must be hosted in the same server process as the calling component since Local interfaces are not location transparent. | "About Enterprise JavaBeans components", "EJB local references" in EAServer Programmer's Guide |
Load Options | The com.sybase.jaguar.component.load property tells the server when to call ejbLoad. It can be one of these values:
| "Repository Properties Reference" in EAServer System Administration Guide |
Reduce ejbStore invocations | For best performance, set the Read Only property for all methods that do not modify data. As a result, he components ejbStore or ctsStore method is not invoked after the business method returns. In addition, if you are updating multiple fields, call the entity bean from session bean with the transaction open, then do multiple sets in entity bean, so only one ejbStore will occur instead of being called for each set. | "Component-managed entity persistence" in EAServer Programmer's Guide |
Entity object and query caching | EAServer supports object and query caching for EJB entity beans and entity components that use automatic persistence. Caching can improve performance by minimizing the number of database select queries required for load, finder, and select operations. Performance gains may range from 1.5 to 2 times faster for applications where most transactions are updates, and from 3 to 30 times faster for applications where most transactions are read-only. Object Caching is off by default and can be turned on for all Components and their finder methods that use Automatic Persistence. To further optimize performance, you can; Object Caching is implemented in C++ by the CtsComponents/ObjectCache component. | "Managing Persistent Component State" in the EAServer Programmer's Guide |
Timestamps in Automatic persistence | For entity components that use automatic persistence, using timestamps for concurrency control yields the best performance in most cases. In optimistic concurrency control, use of the timestamp reduces unnecessary database read operations for tables with many columns or large column values (such as Sybase text or image columns). | "Entity object and query caching", "Configure concurrency control" in EAServer Programmer's Guide |
Entity Bean Relationships | EAServer uses relationship components to manage relationships between EJB 2.0 CMP entity beans. The tables represented by related components must be related in the database. To maintain the relationships, foreign keys offer better performance than join tables, but can be used only when one destination instance relates to a given source instance. | "Managing Persistent Component State" in the EAServer Programmer's Guide |
Using EJB-QL | EJB 2.0 entity beans can use EJB Query Language (EJB-QL) in the EJB-JAR deployment descriptor. EAServer translates EJB-QL to SQL at runtime. You can configure additional EAServer query mapping properties to enable caching of the query results for improved performance. | "Configure finder- and ejbSelect-method queries" in EAServer Programmer's Guide |
Session Bean Pooling | Unlike stateful session beans, stateless session beans can be pooled by the server, improving overall application performance. | "Stateless session beans" in EAServer Programmer's Guide |
Web Components (jsp(SUN企业级应用的首选)s / Servlets)
This section contains suggestions applicable to Servlets, jsp(SUN企业级应用的首选)s, and Web Applications.
Category | Performance Considerations | More Information |
Dynamic Page Caching | To improve the performance of Servlet and jsp(SUN企业级应用的首选) requests, you can use the page caching feature. When page caching is enabled for a Servlet or jsp(SUN企业级应用的首选) Web component, EAServer checks the cache before invoking the Web component. If an appropriate response is found in the cache, EAServer returns the contents of the cache, instead of calling the Servlet Page caching is not enabled for any jsp(SUN企业级应用的首选)s or Servlets by default. It must be enabled on page by page basis as caching requirements might be different for each jsp(SUN企业级应用的首选)/Servlet See: | "Page caching" in EAServer Programmer's Guide |
Threading | If possible, Servlets should be coded to be thread-safe so the service method can be called concurrently from multiple threads. This threading model is the default for Servlets running in EAServer, and in most cases, offers the best performance | "Threading" in EAServer Programmer's Guide |
jsp(SUN企业级应用的首选) / Servlet Performance Advantages over CGI, ISAPI, and NSAPI | jsp(SUN企业级应用的首选)s and Servlets provide superior performance and scalability because they can be compiled, loaded into memory, and reused by multiple clients while running in a single thread, and they can take advantage of connection caching or pooling. Additionally, they overcome many of the deficiencies of CGI, ISAPI, and NSAPI. Although the CGI-BIN interface is not platform-specific, code has to be recompiled for different platforms, and performance is poor for large-scale applications because each new CGI request requires a new server process. Similar platform-specific interfaces such as ISAPI and NSAPI improve performance, but at the cost of even less portability. | "About Java Servlets" in EAServer Programmer's Guide |
Tune the check interval | The com.sybase.jaguar.webapplicaton.jsp(SUN企业级应用的首选)c-interval property value indicates if and when the jsp(SUN企业级应用的首选) runtime checks whether a jsp(SUN企业级应用的首选) is current.
| "Page caching" in EAServer Programmer's Guide |
Tracing | Ensure the com.sybase.jaguar.server.servlet.trace property is set to false. | "Repository Properties Reference" in EAServer System Administration Guide |
Timeouts | You can set initialization and destroy timeouts for Web Applications, and override most of the settings at the individual Servlet level. See these properties for more information: | "Repository Properties Reference" in EAServer System Administration Guide "Server properties for Servlets" in EAServer Programmer's Guide |
Load On Startup | You can decrease the amount of time it takes to serve up the first request to a Servlet by loading it on server startup with the com.sybase.jaguar.servlet.load-on-startup property. | "Repository Properties Reference" in EAServer System Administration Guide |
C++ Components
Category | Performance Considerations | More Information |
External Components | If you configure a C++ component to execute within a dedicated external process, be aware the component will not utilize EAServer transactions or connection caches. | "Running C++ components externally" in EAServer Programmer's Guide |
Maximum Active Instances | The com.sybase.jaguar.component.objects specifies the maximum number of component instances that can exist at once. For a C++ component that runs as an external process, it specifies the maximum number of simultaneously running external processes. If a request arrives when the maximum number of instances exist and are all busy, the request blocks, with blocking time constrained by the Maximum Wait setting. | "Repository Properties Reference" in in EAServer Programmer's Guide |
C Components
Category | Performance Considerations | More Information |
Shared variables | After a method finishes all operations on a collection, release the reference and all shared variable references. This helps to prevent memory leaks. Releasing collection and shared variable references does not release the shared variable values. | "Release shared variable and collection references" in EAServer Programmer's Guide |
ActiveX Components
Category | Performance Considerations | More Information |
Design issues | You can define get and set methods that control runtime properties for your component. However, using get and set methods to access properties over a network decreases performance | "ActiveX datatype support" in EAServer Programmer's Guide |
PowerBuilder Components
In addition to good design and coding practices you would follow for any PowerBuilder applications, follow these suggestions for PowerBuilder components deployed to EAServer.
Category | Performance Considerations | More Information |
DataStore footprint | There are a number of steps you can take to reduce the memory footprints of DataStores. Documentation includes an explanation of system resource utilization, monitoring tips, and suggestions. | Operating System Constraints Affecting the Scalability of PowerBuilder DataStores in EAServer |
Component Memory Management | A technique for sharing class group loaders can be used to reduce the memory requirements -- sometimes dramatically -- of EAServer when running multiple PowerBuilder components. | Reducing Memory Requirements When Using PowerBuilder Components in EAServer |
DataWindow Memory Management | For large retrievals or imports into a DataWindow object, set the datawindow.storagepagesize property to large. Setting this property allows the DataWindow to most efficiently use the available virtual memory. While the setting LARGE is recommended, a setting of MEDIUM is also available. | PowerBuilder 7.0.3 readme Will be added to 8.0 and 7.0.3 online help as well. |
Garbage Collection | To remove unused objects from memory, you can call the GarbageCollect() function to force garbage collection to occur immediately. | Forcing the Garbage Collection Process in PowerBuilder |
Bind Thread property | Setting the Bind Thread property to false can improve performance. However, you can only set this property to false for a PB component that either:
If the Bind Thread property is set to true, be sure to utilize Named Instance Pools, which is described in the Components in general section. In the development environment, this property must be set to TRUE if you are using live editing to build your component. | "Threading issues and component types" in PowerBuilder Application Techniques |
Web DataWindow Code Size | If you do not use a feature such as display formatting, validation rules, or client-side scripting, you can enhance performance by preventing the server component from generating code for the unused feature. You can also cache client-side methods in JavaScript files to reduce the size of the generated code and increase performance on both the server and the client. Without JavaScript caching, each time a Web DataWindow is rendered in a client browser, JavaScript code for DataWindow methods is generated on the server and downloaded to the client. However, there is no performance gain if the client web browser settings prevent caching. | "Controlling the size of generated code" in PowerBuilder DataWindow Programmer's Guide |
Web DataWindow Container | Using a customized component instead of the preinstalled HTML generator component allows you to set properties for your component in Jaguar Manager. Setting properties reduces the number of method calls required to configure the component and can result in improved performance, maintainability, and scalability. Specifically, you can set the source file and DataWindow object on the server so that the DataWindow object is loaded when the component instance is created, resulting in fewer method calls from server-side scripts in the Web page. You can also improve performance by having your custom component maintain its state. | "Web DataWindow Container component" in PowerBuilder Building Internet and Enterprise Applications Using a custom server component" in PowerBuilder DataWindow Programmer's Guide |
Web Target default behavior | By default, the PSJaguarConnection methods for using a Web DataWindow make several trips to the server. You can set the bOneTrip argument to make one trip to the server instead. | "PSJaguarConnection" in the PowerBuilder Web Target Reference |
Section 4: Message Service |
This section contains suggestions for the EAServer Message Service.
Category | Performance Considerations | More Information |
Message Acknowledgment | To optimize the performance of a JMS application, set REQUIRES_ACKNOWLEDGE to false so the message service will not acknowledge messages. | "Configuring a message queue's properties" in EAServer System Administration Guide |
Sharing | SHARED_LISTENER Indicates whether multiple clients can simultaneously receive messages from the queue. When a queue is not shared, only one client at a time can receive messages from it | "Configuring a message queue's properties" in EAServer System Administration Guide |
Transactions | REQUIRES_TRANSACTION determines whether JMS publish, send, receive, and onMessage calls can participate in a transaction. If you set this to false, it significantly improves performance throughput for transient message bulk processing | "Configuring a message queue's properties" in EAServer System Administration Guide |
Permanent Destinations | To provide permanent destinations for JMS client applications, define message queues and message topics using Jaguar Manager. When you create a permanent destination, you can optimize its configuration properties, which benefits every JMS client application that uses the destination. | "Adding and configuring the message service parts" in EAServer System Administration Guide |
Thread Pools | By default, the Reader, Writer and Worker Threads are set to 0. For high-volume client notification with transient messages, you can improve performance by tuning the number of reader and writer threads if it improves throughput. For component notification, you can prevent or allow parallel message processing by changing the worker threads setting. | "Configuring the message service" in EAServer System Administration Guide |
Section 5: Client Applications |
Be sure to follow good coding practices for the language you write the client application in. Additionally, follow these suggestions for clients you plan to use with EAServer.
Category | Performance Considerations | More Information |
Client Design Issues | In designing your client, plan to optimize network performance by keeping traffic between the client and components on the server to a minimum. To optimize network performance, plan to:
| "Implementing components and clients" in EAServer Programmer's Guide http://www.gzip.org/zlib/ PowerObjects article: Jaguar Performance Using ZLIB |
Client Timeout | The IdleConnectionTimeout property specifies the amount of time a connection is allowed to sit idle. By default, connections do not timeout. Specifying a finite timeout for your client applications can improve server performance. If many instances of the client run simultaneously, a finite client connection timeout limits the number of server connections that are devoted to idle clients. A finite timeout also allows rebalancing of server load in an application that uses a cluster of servers. For CORBA-Java clients -- If you specify an idle connection timeout, make sure the garbage collection interval (com.sybase.CORBA.GCInterval) is set to an equal or lesser value For C++ clients, use the ORBRetryCount and ORBRetryDelay options | "Creating EJB Clients", "Creating Java-CORBA Clients", "Creating C++ Clients" in EAServer Programmer's Guide |
Sockets | com.sybase.ejb.socketReuseLimit, com.sybase.CORBA.socketReuseLimit, com.sybase.ORBSocketReuseLimit Specify the number of times that a network connection may be reused to call methods from one server. The default is 0, which indicates no limit. The default is ideal for short-lived clients. The default may not be appropriate for a long-running client program that calls many methods from servers in a cluster. If sockets are reused indefinitely, the client may build an affinity for servers that it has already connected to rather than randomly distributing its server-side processing load among all the servers in the cluster. In these cases, the property should be tuned to best balance client performance against cluster load distribution. In Sybase testing, settings between 10 and 30 proved to be a good starting point. If the reuse limit is too low, client performance degrades. | "Creating EJB Clients", "Creating Java-CORBA Clients", "Creating ActiveX Clients", "Creating CORBA-C++ Clients" in EAServer Programmer's Guide |
CORBA C++ or ActiveX Client | Ensure that IIOP protocol tracing is not turned on via the ORBLogIIOP parameter to ORB_init, or via the JAG_LOGIIOP environment variable. | "Configure and initialize the ORB runtime", or "Initializing the ORB" in EAServer Programmer's Guide |
Web Proxies (a.k.a. HTTP-connect-based proxies) | Web proxies can be used to improve network performance, by caching the results of frequently executed Web requests. Web proxies typically act as a gateway for outgoing connections from a group of workstations, and are sometimes used to enhance network security, by restricting and/or logging the protocols and servers used in client connections. By default, the client ORB attempts to open IIOP connections, then attempts an HTTP-tunnelled connection if plain IIOP fails. Since Web proxy connections require HTTP tunneling, set the following property to true to eliminate the performance overhead of trying plain IIOP connections before trying HTTP-tunnelled IIOP. CORBA property: com.sybase.CORBA.http | "Properties that affect Web proxy use" in EAServer Security Administration and Programming Guide |
Section 6: Protocols |
Category | Performance Considerations | More Information |
SSL | SSL Session Share, and SSL Session Linger SSL reuses the previously negotiated security session parameters in a number of short-lived connections, which results in a relatively large performance gain over setting up completely new security sessions for each connection. When a security session is reused, clients avoid a CPU-intensive encryption of the premaster-secret using the server's public key. Similarly, servers avoid a CPU-intensive decryption of the premaster-secret using its private key. By configuring these parameters, you can control SSL caching on the server side. | "Defining security profiles" in EAServer Security Administration and Programming Guide |
IIOP | HTTP-tunnelled IIOP connections The com.sybase.jaguar.server.http.force.close property specifies whether HTTP-tunnelled IIOP connections should be closed after sending each IIOP response. When debugging proxy configurations, you can set this property to true if it helps your debugging efforts. This setting degrades server performance, so it should only for debugging purposes. | "Repository Properties Reference" in EAServer System Administration Guide |
Section 7: Web Server Redirector Plug-Ins |
Category | Performance Considerations | More Information |
Connection timeout | com.sybase.jaguar.listener.http.conn.keepalive This is an optional property that specifies the length of time, in seconds, to keep a connection alive before it is closed by EAServer. The default value is 120 seconds (2 minutes) and can be modified, if necessary, to improve performance. | "Configuring EAServer to accept Web server requests" in EAServer System Administration Guide |
Maximum requests | com.sybase.jaguar.listener.http.conn.maxrequests This optional property determines the number of requests processed before EAServer closes the connection. The default value is 100 and can be modified, if necessary, to improve performance. | "Configuring EAServer to accept Web server requests" in EAServer System Administration Guide |
Tracing | Set the log level property to Inform or Error instead of Verbose. | "Editing the redirector configuration file" in EAServer System Administration Guide |
Section 8: Database Access |
Good database and query design is essential for database performance in general. Additionally, these suggestions are applicable to working with databases in EAServer.
Category | Performance Considerations | More Information |
Physical Database Connections | Physical database connects are very expensive. You can reduce the cost using EAServer connection caches. A connection cache maintains a pool of connections to a database\ server, increasing performance by allowing connection sharing and reuse. Since more clients can be serviced using fewer third-tier connections, CPU time and memory are not consumed by opening more connections than necessary. | "Using Connection Management" in EAServer Programmer's Guide |
Connection Cache Tuning | You can set the pool size using the Number of Connections in Cache property. After a connection is released, it is returned to the pool. The default value is 10. You can increase this number if performance suffers due to an insufficient number of available connections. To tune the number of connections, use runtime monitoring to ensure that there is not a large number of Forced Connections. | "Connection cache properties" in EAServer System Administration Guide |
Connection Cache Sanity Checking | Disable connection sanity check. When the option is enabled, EAServer verifies that the connection is open and accepts commands before making it available for reuse. Disabling the option increases performance, but may complicate debugging. For example, components may release a connection that is not ready for use by another component, such as when there is unretrieved results on the connection. | "Connection cache properties" in EAServer System Administration Guide |
Connection Management in C, C++, and ActiveX components | ActiveX, C, and C++components can call the Connection Manager routines to take advantage of connection caching. These routines manage caches of ODBC, Client-Library, or Oracle(大型网站数据库平台) Call Interface (OCI) connections. When there are many configured caches, a component can achieve better performance by passing the cache handle explicitly in JagCmGetConnection to eliminate repeated internal table searches. | "Using Connection Manager routines in C, C++, and ActiveX components" in EAServer Programmer's Guide |
XA Resources | Be aware that XA performance diminishes when connections span across methods. | "Configuring XA resources" in EAServer System Administration Guide |
JDBC Drivers | JDBC driver properties can also provide good performance boots depending on what you enable/disable. To help you choose a driver type, read the JavaWorld article " JDBC drivers in the wild" to learn the differences between JDBC driver types, and how to benchmark them. | Documentation for the JDBC driver you are using |
jConnect | The jConnect documentation includes a chapter devoted to the ways to fine-tune and improve performance when working with jConnect. | Performance and Tuning chapter in Programmer's Reference jConnect for JDBC |
ODBC | ODBC 3.0 drivers generally perform better than older versions. | |
ASA | ASA can run on multiple processors, has an advanced query optimizer, and provides performance monitoring and tuning tools. | |
ASE |
| "Configuring Adaptive Server Enterprise connections" in EAServer System Administration Guide |
Database Driver Tracing | Ensure tracing features for the database driver are not enabled, as this can severely degrade performance |
Section 9: Web Services Toolkit |
Category | Performance Considerations | More Information |
Trace and Debug | When generating WSDL or SOAP templates, do not include the -d or -t flags for debug or trace output | Web Services Toolkit User Guide |
Section 10: System-Level Tuning and Sizing |
Category | Performance Considerations | More Information |
Sizing | See TechWave 2001 presentation http://techwave.sybase.com/2001_presentations/ID333.zip | |
Multiprocessors | Some operating systems fully utilize multiple CPUs, while others do not. Depending on the OS you are using, you may need to bind EAServer to each CPU in order to take advantage of the multiple processors. | Binding a Process to a CPU on Windows NT or Sun Solaris (written for PB but applies generically) |
Section 11: Runtime Monitoring and Stress Testing |
Category | Performance Considerations | More Information |
EAServer Monitoring Tools | Use the File Viewer, Runtime Monitor, and the OTS Transaction Monitor to track EAServer's performance and statistics. | "Runtime Monitoring," in EAServer System Administration Guide |
Operating System Resource monitoring | Use operating system tools and utilities to monitor and gather information about process and resource utilization. Microsoft Windows platforms: Solaris: | |
Load / Stress testing | You should always stress test an application before putting it into production. A variety of stress testing tools are available, to help you simulate a load to test if the application will scale and perform at acceptable levels. Some of the tools are available free of cost. For example, OpenSTA is free from http://www.opensta.org/ | |
Benchmarking | A whitepaper is available that points out the fundamentals involved in an application server benchmark, and outlines the results for EAServer tests for the nile.com benchmark. | Application Server Benchmarking Fundamentals white paper |
Section 12: PowerDynamo |
This section includes suggestions for those sites that use PowerDynamo.
Category | Performance Considerations | More Information |
Achieving Optimum Performance with PowerDynamo | How to optimize performance using caching, scheduling, load balancing, minimizing use of expensive methods and properties, and more | Chapter 10 of the PowerDynamo User's Guide |
Tracing | Ensure both the EAServer property com.sybase.jaguar.server.dynamo.trace and PowerDynamo trace configuration setting are set to false. | "Repository Properties Reference" in EAServer System Administration Guide, and "Changing Dynamo configuration settings" in the PowerDynamo User's Guide |
Data Source configuration | If you are connecting to a database server on the same machine as the Web server, do not select Client as the Agent. This would result in the local connection being made through the network, which would cause a decline in performance. | "Setting up the Adaptive Server Anywhere database server for PowerDynamo" in the PowerDynamo User's Guide |
Text substitution | Rather than text substitution, significant performance improvements can result in some circumstances using host variables in a SQL statement, since it can be executed repeatedly without being reparsed | "Text substitution and host variables" in the PowerDynamo User's Guide |
Connection pool settings | Configure the connection pool minimum, maximum, and timeout for optimum results | "Managing the connection pool" in the PowerDynamo User's Guide |
Temporary connections | Avoid using temporary connections, since they do not utilize pooling. | "Working with connections" in the PowerDynamo User's Guide |
Script and Template properties | If a script or template does not require any connections to a database to complete execution, specifying <no connection> in the definition, so that no connection object is created during the execution of the document. | "Using <no connection>" in the PowerDynamo User's Guide |
Performance Monitor | On NT, use the performance monitor for feedback on utilization and processing of caches, queries, scripts, and requests | "Using the Performance Monitor" in the PowerDynamo User's Guide |
Java Class Cache | To improve performance, information about the methods and properties of Java classes is cached. | "Configuring Dynamo to use Java" in the PowerDynamo User's Guide |
Java class storage | Java classes can be accessed from within a database or within the file system. If you do not need the Java classes stored in the database (for replication or other reasons), you should store them in the file system for performance reasons. | "Using Java in a PowerDynamo script" in the PowerDynamo User's Guide |
xml(标准化越来越近了) Document Nodes | It is generally more efficient to use explicit objects instead of the generic node interface to xml(标准化越来越近了) documents. | "The object interface to xml(标准化越来越近了) documents" in the PowerDynamo User's Guide |
xml(标准化越来越近了) Document parsing | Parsing large documents with toDOMDocument can be expensive. Design your site so this occurs as infrequently as possible. You can avoid unnecessary parsing of the document by attaching the DOMDocument object to the session object. | "Creating the DOMDocument object" in the PowerDynamo User's Guide |
Section 13: Localization |
Category | Performance Considerations | More Information |
Global Sort component | The Global Sort component, which provides high performance sorting of small to medium length lists and supports multiple alphabets and sort orders. This feature is documented in Using Global Sort. | Using Global Sort |
xml(标准化越来越近了) conversion | The xml(标准化越来越近了) conversion module (XCM) tool is a high-performance EAServer component development tool that provides encoding verification and character set conversion for xml(标准化越来越近了) data. Using the XCM Tool describes how to use this feature. | Using the XCM Tool |
Section 14 -- Development Environment |
Category | Performance Considerations | More Information |
Deployment and code generation | EAServer 4.0 introduces Java-to-IDL and IDL-to-Java code generation optimizations. These optimizations can increase your productivity when you deploy Java based applications with complicated component class hierarchies and when you generate Java stubs for these applications. The J2EE EAR importer, EJB JAR importer, and the Java code generator have been enhanced to allow you to specify a code generation strategy as follows:
| "Deployment and code generation performance" in What's New in EAServer 4.1 |
Class Loader | EAServer supports hot refresh of components by using a Java class loader. This feature speeds the development process by allowing you to deploy new class versions without restarting the server. To enable refresh, set com.sybase.jaguar.component.refresh to true, which is set by default. | "Repository Properties Reference" in EAServer System Administration Guide |
Additional Information |
It is important to review performance information for the languages, operating systems, databases, protocols, etc you are working with.
Here are a few sample links to get you started.
Java Related:
- Java Developer Connection: Advanced Programming for the Java 2 Platform Chapter 8: Performance Techniques
- Java Developer Connection: JAVA PLATFORM PERFORMANCE STRATEGIES AND TACTICS
- JavaWorld: Design for performance. Part 1: Interfaces matter, Part 2: Reduce object creation, Part 3: Remote interfaces
- JavaWorld: Java performance programming, Part 1: Smart object-management saves the day
Tags:EAServer Performance Tuning
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接