Previous Topic

Next Topic

Performance During Concurrency

When multiple users are performing selects, updates, inserts, and deletes on the same set of tables concurrently, consider the following when evaluating performance:

Previous Topic

Next Topic

Approaches for Handling Heavy Concurrent Usage

In a heavy concurrent usage situation, there are two approaches:

Previous Topic

Next Topic

The Never Escalate Approach

The "never-escalate" approach is appropriate when the users are working in different parts of the table, they are running simple queries and updates, and making full use of primary and secondary indexes. The goal is to have users coexist as much as possible in the same tables, where no one impedes another user's performance by acquiring table locks.

Considerations of the "never escalate" approach include:

When choosing storage structures while using the "never escalate" approach, the basic principle is that ISAM or hash structures with little or no overflow are better than small B-trees in a concurrent environment. The reason is that growing B-trees involve some locking when index pages split.

However, as the percentage of overflow builds up in the hash or ISAM structure, they become inferior to B-trees, because locks are held down overflow chains. In particular, if any overflow chain being visited is greater than maxlocks, escalation to table locks can occur. This increases the risk of deadlocks when there are multiple users in the same table.

At what point the trade-off occurs depends on the circumstances, such as how frequently modify statements can be performed. Experimentation is advised. Overflow buildup must be checked in secondary indexes as well as primaries.

Concurrent performance analysis is much more difficult to analyze than single user performance. Be prepared to experiment using the guidelines presented.

Previous Topic

Next Topic

The Table Lock Approach

The "table lock" approach is used only when there are unsolvable bottlenecks. The philosophy behind the approach says that it is better to have users queue up in an orderly manner to get into a table, thereby avoiding the risk of deadlock, than have them waste time backing out of deadlock situations.

Important! Before using this approach, ensure that lock escalation and transaction size are minimized.

This approach is appropriate when extensive table scanning is needed, as with set functions such as max and min. In these cases it is advisable to keep an extra table around containing max and min values, or to search for max and min values directly in a secondary index without reference to the base table.

In multiple query transactions, table-level locks reduce the likelihood of deadlocks but do not eliminate them. The following statement reduces the likelihood of deadlock in a multiple query transaction:

set lockmode on tablename
where level = table;

This also applies to B-tree tables when they are small.

Under some circumstances setting readlock = exclusive is useful. For example, when running a select followed by an update statement.


© 2007 Ingres Corporation. All rights reserved.