Tuning

Return to overview

Tuning Using the Engine Activity Monitor

If This is True Consider These Actions For More Detailed Research, Use
CPU Busy Percent low for all engines and Yield to OS high, indicating that engines are yielding voluntarily Reduce the number of engines configured for Adaptive Server.
To reduce the amount of time Adaptive Server holds the CPU before yielding to the operating system, lower the runnable process search count parameter. Network Activity Monitor to make sure your changes do not increase network latency.
CPU Busy Percent greater than 60% for all engines or CPU Busy Percent medium to high and Yield to OS high, indicating that the engine is being starved out of CPU time Add another engine by increasing the max online engines configuration parameter. First, however, check:
  • Resource contention levels. Adding engines can increase contention for data caches, database devices, and locks.
  • Number of usable CPUs on the machine. Never configure more engines than CPUs.
Performance Summary Monitor

Tuning Using the Network Activity Monitor

If This is True Consider These Actions For More Detailed Research, Use
Average Received Packet Size or Average Sent Packet Size equals (+/- 512 bytes) the default packet size configuration parameter Increase the max network packet size configuration parameter. View current configuration settings.
Make sure that users or applications performing large data transfers log on to Adaptive Server requesting a packet size larger than the default size. Tasks that can benefit from large packet sizes are:
  • bulk copy
  • readtext and writetext commands
  • select statements resulting in large amounts of data
Increase the default packet size configuration parameter. Use multiples of 512 bytes. Consider the packet size of the underlying network. In general, default packet size should be large enough to handle average transfers. sp_sysmon command. Examine task context switches due to Network Packet Received and Network Packet Sent.
Make sure the additional network memory configuration parameter is set large enough to accommodate requests for larger packet sizes. Otherwise, the connection receives network I/O buffers equal to the default packet size.
Average Received Packet Size and Average Sent Packet Size are both at least 512 bytes less than default packet size Decrease default packet size configuration parameter if conserving Adaptive Server memory is important. Note: Never set default packet size less than 512 bytes.
Packets Received plus Packets Sent is high relative to benchmarks or relative to total network traffic. (Use network monitoring tools to observe total network traffic.) Reduce network traffic caused by Adaptive Server. Suggestions are:
  • Encourage use of stored procedures, views, and triggers. These features store code on Adaptive Server and require only a short command across the network to invoke them.
  • Use larger packet sizes by increasing default packet size or encouraging connections that request packet sizes larger than the default.
  • Set the tcp no delay configuration parameter to off (the default). The off setting allows TCP to batch small logical packets into large physical packets.
  • Tune the TCP packet size to better accommodate Adaptive Server average packet size.
  • Tune SQL statements to select (and send across the network) the specific information required. For example, an application should not select all columns in a table when it only needs information from one column.
  • Tune SQL statements that use cursors to request multiple rows in each fetch command if a single row does not fill up a network packet.
  • Run applications with large data transfers at non-peak hours or use a separate network for such operations. Run backups at non-peak hours.
  • Use replication processing and two-phase commits only when necessary. These features contribute heavily to network traffic.
  • Place heavy network users on a separate network.
  • Configure multiple network listener ports for a single Adaptive Server. See platform specific configuration guides for more information.
Total Network I/Os Delayed > zero Add another engine (applies to SMP systems only). Note: Never add more engines than CPUs. If sp_sysmon shows some engines having little or no activity, then adding another engine will not help. Consult with a network administrator to determine reason for a network bottleneck. sp_sysmon shows network activity by engine.

Tuning Using the Object Page I/O Monitor

If This is True Consider These Actions For More Detailed Research, Use
Data Page or Index Page Physical Reads or Writes greater than expected Bind the object to a named data cache or increase the size of the named data cache.
  • Named Data Cache Monitor
  • Databases-->User Tables folder - Cache Binding tab.
Increase the size of the data cache that the object uses.
Implement large I/O on the object by binding it to a large I/O buffer pool.
Index Page Physical Reads greater than expectations Research index usage on the table.
Data Page Logical Reads much greater than expectations Reduce the number of page reads it takes to satisfy requests involving this table.
  • Research long-running statements to reduce table scans.
  • Research index design to reduce table scans.
Process Current SQL Statement Monitor to tune queries. To identify the processes that are using the table you are analyzing, use a long sample interval and toggle between the Process Activity Monitor and Object Page I/O Monitor.

Tuning Using the Application Activity Monitor

If This is True Consider These Actions For More Detailed Research, Use
Physical Reads high Investigate data cache issues.
  • Object Page I/O Monitor
  • Named Data Cache Monitor
Contention Percent higher than 15% or Wait Time unacceptable Investigate lock contention issues.
  • Object Lock Status Monitor to see details about specific locks
  • Object Lock Contention Monitor to see contention statistics by table.
CPU Utilization Percent low Investigate why this application is not getting CPU time.
  • sp_sysmon command (task management section) to see reasons for task context switches
  • Process Activity Monitor to see execution classes of concurrently running processes
  • Execution Classes folder -- Bindings tab.

Tuning Using the Device I/O Monitor

If This is True Consider These Actions For More Detailed Research, Use
Device Hit Percent low and I/O rates are approaching the physical limits of the device Add a new device or redistribute objects (see next entry). Overloaded devices can have a high impact on performance. However, remember that different devices have different capacities. Use OS utilities to determine capacity limits for a specific device.
Device Hit Percent low or over 100% Redistribute objects among devices. Some techniques are:
  • Place a heavily used index on a different segment from its table.
  • Separate heavily used tables by placing them on different devices
  • Place tempdb on its own physical disk.
  • Place transaction logs on different devices from tables
  • Split a large table over several devices. Split tables by:
    • Separate text and data pages
    • Partition a heap table
    • Partially load a clustered index table
Totals and Rates on the current monitor to determine which devices could handle additional objects.
Examine objects stored on the device to determine if they are fragmented. If so:
  • Perform maintenance
  • In ASE version 11.9.x, reduce future fragmentation by setting reserve page gap.
To set reserve page gap on tables and indexes:
  • Table property sheet - Lock tab
  • Index property sheet - Misc. tab
Investigate these causes for server-wide I/O delays:
  • the operating system cannot keep pace with Adaptive Server disk I/O requests
  • limits imposed by these Adaptive Server configuration parameters: disk i/o structure, max async i/os per server, or max async i/os per engine
  • limits on asynchronous I/Os imposed by an operating system parameter
Disk I/O Management section of sp_sysmonoutput
Load among devices is unbalanced Balance loads by redistributing objects. Follow tips for low Hit Rate.
Writes very high on the transaction log device Configure a large I/O buffer pool for the transaction log data cache (a 4K pool is recommended.) Use sp_logiosize to make sure the log I/O buffer size matches the buffer pool size.

Note: Although you must create and maintain objects on segments (not devices), the chapter "Creating and Using Segments" in the System Administration Guide includes detailed procedures for moving objects to specific devices by using segments. Segments are labels for one or more devices.

Tuning Using the Performance Summary Monitor

If This is True Consider These Actions For More Detailed Research, Use
Yield to OS Rate high Investigate whether Adaptive Server is getting enough CPU time. Engine Activity Monitor
CPU Percentage greater than 60% Add another engine by increasing the max online engines configuration parameter. First, however, check:
  • Resource contention levels. Adding engines can increase contention for data caches, database devices, and locks.
  • Number of usable CPUs on the machine. Never configure more engines than CPUs.
Check resource contention levels by examining other items displayed on this monitor.
Cache Dirty Grabs greater than zero Investigate wash area size in the data caches. Perform this action as soon as possible for greatly enhanced performance. sp_sysmon command, Cache Management section, to see dirty grab statistics per buffer pool.
Network I/O Rate significantly lower than benchmarks Investigate whether a network problem exists. Generic network management tools.
Network I/O Rate approaching the networkĘs packet per second capability Investigate reducing Adaptive Server network traffic. Network Activity Monitor
Number Sleeping on Locks high or Deadlock Count high Investigate object lock contention.
Investigate lock promotion configuration parameters:
  • lock promotion LWM
  • lock promotion HWM
  • lock promotion PCT

You can tune these parameters server-wide or on a per-table basis.
Data Cache Hit Percent low Investigate data cache configuration and how objects are bound to data caches. Named Data Cache Monitor
Procedure Cache Hit Percent low Investigate procedure cache size.
Device Hit Percent low or Device I/O Rate approaching the speed limitations of your devices Investigate device configuration and how objects are distributed on devices. Device I/O Monitor
Locks Denied or Locks Granted after Wait high Investigate lock configuration issues.
Investigate object lock contention. Object Lock Status Monitor

Tuning Using the Process Current SQL Statement Monitor

If This is True Consider These Actions For More Detailed Research, Use
Query Plan is old (e.g., statistics or arguments in the plan are wrong; many changes were recently made to table keys.) Run update statistics and sp_recompile commands.
Take action as soon as practicable. Old query plans can affect performance severely.
Statement is a heavy resource consumer To determine the statementĘs area of resource overloading, look for spikes in the following areas while the statement executes:
  • CPU usage
  • I/O in the transaction log
  • Physical page I/O
  • Writes
  • Locks Granted After Waiting
  • Locks Denied
    Tune the statement and the objects it uses to reduce table scans, page locks, hot spots, and number of pages accessed.
    Perform maintenance on indexes.
    • Process Activity Monitor
    • Stored Procedure Activity Monitor
    • Object Lock Status Monitor to identify hotspots. (If the same page address shows up repeatedly, the page might be a hot spot.)

    Tuning Using the Stored Procedure Activity Monitor

    If This is True Consider These Actions For More Detailed Research, Use
    Highest values in # of Times Executed and Average Execution Time Concentrate on improving execution time for these procedures.
    Investigate how execution classes of other concurrently running processes affect execution of this stored procedure.
    • Process Activity Monitor to see execution classes of concurrently running processes.
    • Execution Classes folder -- Bindings tab.
    Physical Reads high Investigate data cache issues.
    Locks Denied high Investigate lock contention issues. Object Lock Status Monitor

    Tuning Using the Transaction Activity Monitor

    If This is True Consider These Actions For More Detailed Research, Use
    Page Splits high Reorganize indexes using fill factor.
    For tables with clustered indexes, use ascending insert mode.
    For ASE versions 11.9 or greater, if the locking scheme is allpages, change to a data-only locking scheme.
    Heap Table Inserts high Create a clustered index on highly used database tables. Object Lock Status Monitor to identify hot spots. (If the same Page Number shows up repeatedly, the page might be a hot spot.)
    Partition tables or increase the number of existing partitions on tables with high activity. Object Page I/O Monitor shows high-use tables.
    Deferred Updates high Increase the chances that an appropriate index exists for a direct update by:
    • Creating at least one unique index on a table.
    • Redesign statements to use non-key columns in the where clause when updating a key.

    Use the not null attribute for columns that do not need the null value.

    Increase the chances that enough room will exist on a page for a direct update to occur by:

    • Using fixed length datatypes instead of variable length datatypes.
    • Using max_rows_per_page attribute on tables or indexes.
    Process Current SQL Statement Monitor. The Query Plan shows whether deferred or direct updates will be used.

    Tuning Using the Data Cache Monitor

    If This is True Consider These Actions For More Detailed Research, Use
    Hit Percent low or Miss Rate high Increase the size of the data cache.

    An optimally sized named cache retains a good percentage of often-used pages in cache, increasing hit rates.

    Adding space to a named data cache detracts from available procedure cache space.

    • Object Page I/O Monitor. Logical Reads identifies high-use objects.
    • Caches folder -- Configuration tab.
    Change which high-use objects are bound to the named cache.

    Optimal object binding reduces physical reads. Indexes and their table data can be bound to separate caches.

    • Object Page I/O Monitor. Logical Reads identifies high-use objects.
    • Caches folder -- Cache Bindings tab.
    Add buffer pools or resize existing buffer pools for large I/O. Caches folder -- Buffer Pool tab.
    Efficiency low relative to other named caches Reduce the size of the cache or delete the cache and reallocate the space to other caches.

    Efficiency is low when hit rates are low and memory allocations are relatively high. This could mean that space is being wasted in this named cache. Redistributing that space (to the default cache, for example) might improve the hit rate of another cache.

    High efficiency means that space is appropriately allocated to this named cache.

    This monitor. Compare hit rates and efficiency for other named caches.
    Prefetch Effectiveness low Examine objects bound to the cache to determine if they are fragmented. (Large I/O reads data adjacent pages only.) If so:
    • Perform maintenance.
    • In ASE versions 11.9 or greater, reduce future fragmentation by setting reserve page gap.
    • Caches folder -- Cache Bindings tab.

      To set reserve page gap:

    • Tables property sheet - Lock tab
    • Index property sheet - Misc. tab
    If you need space elsewhere, delete this buffer pool and use a smaller sized pool (e.g., use an 8K pool instead of a 16K pool.)
    Check that not more than two buffer pools are allocated per cache.

    The Adaptive Server optimizer attempts to use the buffer pool with the largest sized buffers. If it cannot use that pool, it uses the 2K pool. All other pools are ignored.

    Large I/O Denied Rate above zero Add buffer pools or change the size of existing buffer pools.

    The Adaptive Server Optimizer cannot perform large I/O if there are no buffers to handle the large reads.

    Caches folder -- Buffer Pool properties tab.
    Total Hits + Total Misses higher than expectations Reduce the number of page reads it takes to satisfy requests involving this table.
    • Research long-running statements to reduce table scans
    • Research index design to reduce table scans
    Process Current SQL Statement Monitor to tune queries. To identify processes using the table you are analyzing, set long sample intervals and toggle between the Process Activity Monitor and Object Page I/O Monitor.

    Tuning Using the Cache Monitor

    If This is True Consider These Actions For More Detailed Research, Use
    Stored Procedure Cache Hit Percent and Page Hit Percent low Allocate more memory to Adaptive Server.

    Test the results carefully. Allocating more memory to Adaptive Server reduces available memory elsewhere, possibly slowing down some processes.

    Page Hit Percent low Increase size of the data cache or allocate more memory to Adaptive Server.

    Investigate configuration of named caches.

    Data Cache Monitor
    Stored Procedure Cache Hit Percent low Increase size of procedure cache or allocate more memory to Adaptive Server.

    Test the results carefully. Allocating more memory when a very large number of processes are running might have minimal gain.

    Tuning Using the Process Activity Monitor

    If This is True Consider These Actions For More Detailed Research, Use
    Process State is "Runnable" for an unacceptable amount of time or CPU Busy Percent is low Investigate engine activity. Engine Activity Monitor
    Investigate engine affinities, if any are assigned to this process or the stored procedure or application it is executing.

    Engine affinity reduces the chances of a process to gain a time slice. Critical processes should be free to run on any engine.

    Investigate execution classes of this and other concurrently running processes.

    Consider raising execution attributes of I/O bound applications, logins, and stored procedures and/or lowering execution attributes of cpu-bound applications, logins, and stored procedures.

    • Stored Procedure Activity Monitor
    • Application Activity Monitor
    Process State is "Sleeping" for an unacceptable amount of time Investigate the SQL statement to determine what the process is waiting for. Process Current SQL Statement Monitor
    If the process is waiting for I/O for an unreasonable amount of time, investigate device I/O contention issues. Device I/O Monitor
    Process State is "Recv Sleep" or "Send Sleep" for an unacceptable amount of time Investigate packet configuration and network activity. Network Activity Monitor
    Process State is "Lock Sleep" for an unacceptable amount of time Investigate blocking locks. Stored Procedure Activity Monitor
    Page I/O: Physical Reads high Investigate data cache issues. General trend for many processes:
    • Named Data Cache Monitor
    • Device I/O Monitor
    Locks Denied high or Contention Percent greater than 15% or Wait Time unacceptable or Blocking SPID is present or Number Blocked is high Investigate lock contention issues. For a specific process:
    • Stored Procedure Activity Monitor to identify blocking SPIDs
    • Object Lock Status Monitor to identify objects involved in lock contention

    General trend for many processes:

    • Object Lock Status Monitor
    • Object Lock Contention Monitor to see lock statistics by table.

    Tuning Using the Object Lock Status Monitor

    If This is True Consider These Actions For More Detailed Research, Use
    Locks Blocked high or Time Waited high Tune table to reduce lock contention.
    • Split a heavily used table into two tables to create the potential for more shared locking. (Separate frequently updated information from frequently accessed read-only columns.)
    • Decrease the number of rows stored per page by using fillfactor or max_rows_per_page.
    • In small tables or indexes experiencing heavy contention, use a low value for the max_rows_per_page option in the create table, create index or alter table command. (A value of 1 in max_rows_per_page makes a lock on a page a lock on only one row. While this technique will reduce lock contention for that table, it causes a page split for every insert.)
    Transaction Activity Monitor to monitor page splits.
    Examine blocking transactions to reduce the length of time they hold exclusive or update locks. Try to:
    • avoid user interactions within transactions.
    • make transactions short.
    • make sure update or delete transactions can use an index to locate rows.
    • avoid cursors that acquire exclusive locks within transactions. (Such locks are held for the duration of the transaction.)
    • make sure cursors within transactions include a close on endtran clause. (Without this clause, the cursor's locks are held beyond the transaction.)
    • avoid overusing holdlock.
    • avoid overusing transaction isolation level 3. (Isolation levels 0 or 1 are less restrictive.)
    • keep a transaction in a single batch. This reduces network latency time and thus releases locks quicker.
    Note the SPID and login name associated with the locks you want to research. Use the Process Current SQL Statement Monitor to see the text and query plan of the currently running statement for a process.
    The same Page Number appears many times Eliminate hot spots (many tasks requiring locks on the same page at the same time) in a table by:
    • Partitioning or increasing the number of partitions on heap tables. (Partitioning provides more than one last page, reducing contention for exclusive locks on the last page.)
    • Creating a clustered index.