Adobe ColdFusion 8

Considering lock granularity

When you design your locking strategy, consider whether you should have multiple locks containing small amounts of code or few locks with larger blocks of code. There is no simple rule for making such a decision, and you might do performance testing with different options to help make your decision. However, you must consider the following issues:

  • If the code block is larger, ColdFusion will spend more time inside the block, which might increase the number of times an application waits for the lock to released.
  • Each lock requires processor time. The more locks you have, the more processor time is spent on locking code.