7 The Oracle Data Provider : Performance Considerations

Performance Considerations
Connection String Options
Array Send Size: The value for this option can be an integer from 1 to 4,294,967,296 (4 GB); the default is 4096 (4 MB). The value 1 is a special value that does not define the number of bytes but, instead, causes the data provider to allocate space for exactly one row of data. Larger values increase throughput by reducing the number of times the data provider fetches data across the network when retrieving multiple rows. Smaller values improve response time, as there is less of a delay waiting for the server to transmit data.
For example, if your application normally fetches 200 rows, it is more efficient for the data provider to fetch 200 rows at one time over the network than to fetch 50 rows at a time during four round trips over the network.
Batch Update Behavior: When batch updating is enabled, you can optimize performance with array binding. If your application 1) uses batch operations for inserts, updates, or deletes and 2) performs these operations on many values in the same columns, the Oracle data provider can use array binding to optimize batch updates. In this case, set this option to ArrayBindWhenPossible. If your application 1) uses batch operations for inserts only and 2) inserts many values in the same columns, the data provider can use array binding to optimize batch inserts. In this case, set this option to ArrayBindOnlyInserts.
Commit Behavior: Typically, redo changes generated by update transactions are written to disk immediately when the transaction is committed, and the session waits for the disk write to complete before returning control to the application. Oracle 10g R2 can let the log writer write the redo changes to disk in its own time instead of immediately and return control to the application before the disk write is complete instead of waiting. Not waiting for the disk write improves performance for applications that perform update operations and where data integrity is not critical. For example, most banking applications cannot tolerate data loss in the event that the server has a problem writing the redo changes to disk or fails during the process, but many logging applications for diagnostic purposes can.
Enable Server Result Cache: If your application connects to Oracle 11g and executes the same query multiple times, you can improve performance by using the Oracle server-side resultset caching feature. When enabled, Oracle stores the result set in database memory. On subsequent executions of the same query, the result set is returned from database memory if the underlying tables have not been modified. Without result set caching, the server would process the query and formulate a new result set.
Encryption Method: Data encryption can adversely affect performance because of the additional overhead (mainly CPU usage) required to encrypt and decrypt data.
Enlist: If your application needs to connect to more than one database, you need to use distributed transactions. Using distributed transactions impacts performance in two ways. To enlist in distributed transactions, the Oracle data provider must call some unmanaged code, which incurs performance and security issues (see “About the Data Providers”). In addition, distributed transactions require additional logging and network round trips, making them up to four times slower than local transactions. If your application connects to only one database and you do not need to connect to another database, set this option to False and use local transactions.
Packet Buffer Size: Increasing the buffer size often improves performance for applications that have large result sets. The packet buffer size should be the same as or smaller than the size set for Fetch Array Size.
Pooling: If you enable the data provider to use connection pooling, you can define additional options that affect performance:
Load Balance Timeout: You can define how long to keep connections in the pool. The pool manager checks a connection's creation time when it is returned to the pool. The creation time is compared to the current time, and if the timespan exceeds the value of the Load Balance Timeout option, the connection is destroyed. The Min Pool Size option can cause some connections to ignore this value.
Connection Reset: Resetting a re-used connection to the initial configuration settings impacts performance negatively because the connection must issue additional commands to the server.
Max Pool Size: Setting the maximum number of connections that the pool can contain too low might cause delays while waiting for a connection to become available. Setting the number too high wastes resources.
Min Pool Size: A connection pool is created when the first connection with a unique connection string connects to the database. The pool is populated with connections up to the minimum pool size, if one has been specified. The connection pool retains this number of connections, even when some connections exceed their Load Balance Timeout value.
Procedure Description Cache: When executing a stored procedure, the Oracle data provider needs information about the REF CURSOR parameters the stored procedure uses. By caching the stored procedure information obtained from the server, the data provider can significantly reduce the number of round trips to the server. Applications that change stored procedure definitions during runtime should not use this cache.
Schema Options: Returning some types of database metadata can affect performance. To optimize application performance, the data provider prevents the return of performance-expensive database metadata such as procedure definitions or view definitions. If your application needs this database metadata, you can specifically request its return.
To return more than one type of the omitted metadata, specify either a comma-separated list of the names, or the sum of the hexadecimal values of the column collections that you want to return. For example, to return procedure definitions and view definitions, specify one of the following:
Schema Option=ShowProcedureDefinitions, ShowViewDefinitions
Schema Options=0x60
Session Data Unit: For maximum performance, the data provider should transmit data to the database server in packets (Session Data Unit) that are equal in size to the maximum SDU size configured on the database server.
Server Type: When using a dedicated server connection, a server process on Linux/UNIX (a thread on Windows) is created to serve only your application connection. When you disconnect, the process goes away. The socket connection is made directly between your application and this dedicated server process. This can provide tremendous performance improvements, but uses significantly more resources on Linux/UNIX servers.
Because this is a thread on Oracle servers running on Windows platforms, the additional resource usage on the server is significantly less. The Server Type option should be used when you have a batch environment with lower numbers of connections or if you have a performance-sensitive application that would be degraded by sharing the server’s resources with other applications.
IMPORTANT: The server must be configured for shared connections (the SHARED_SERVERS initialization parameter on the server has a value greater than 0) for the data provider to be able to specify the shared server process type.
Wire Protocol Mode: Set this option to 2 if:
NOTE: If your application: 1) returns single row result sets or result sets that do not contain repeating data or 2) does not update or insert long data, set this option to 1; otherwise, performance may be degraded.
Properties
BatchUpdateSize: If your application uses disconnected DataSets and updates those DataSets, you can positively influence performance by setting the BatchUpdateSize property of the DataAdapter object to a value greater than 1. By default, the data provider attempts to use the largest batch size possible. However, this may not equate to optimal performance for your application. The value you set depends on the number of rows you are typically updating in the DataSet. For example, if you are updating less than 50 rows, a suggested setting for this property is 25.
When set to 0, the DataAdapter uses the largest batch size the data source can support. The UpdatedRowSource property for the UpdateCommand, DeleteCommand, and InsertCommand must be set to None or OutputParameters.
When set to 1, batch updating is disabled.
When set to a value greater than 1, the specified number of commands are executed in a batch. The UpdatedRowSource property for the UpdateCommand, DeleteCommand, and InsertCommand must be set to None or OutputParameters.
CurrentUserAffinityTimeout: Increasing the CurrentUserAffinityTimeout can increase the chances that a connection with the same CurrentUser exists in the pool. However, when set too high relative to other CurrentUserAffinityTimeout values, the connection pool might have to create new connections, which is more performance-expensive than reauthenticating an existing connection.