Wednesday, February 16, 2005

Concurrency Control and Application Performance

Concurrency Control is one of the most common phrases used in the world of resource sharing. In WebSphere its for sharing data resources. There are two major schemes used in concurrency contorl: pessimistic and optimistic. The pessimistic approach locks the resources early in the transaction i.e. at the start of a transaction. So the resource will almost be locked for the period of this transaction. For long transactions this approach is not generally desirable. In optimistic approach the resource is locked only at the final phase of the transaction. In this approach during the commital phase check is made to see if the data hasn't changed since the begining of the transaction. If no change is made then lock is acquired and transaction is commited or else the transcation is rolled back. To read more about Concurrency scheme in IBM WebSphere click here.

The locked resource cannot be accessed by other contending requests hence affects the avalabiltiy of the resource. Since the lock period is long in the pessimistic approach it would greatly affect the speed of the application interms of user experience. It is a good idea to set investigate and change the access intents in a method level fashion and not just leave in the default PessimisticUpdate intent.

No comments:

Disqus for techtalk