Optimistic vs. Pessimistic locking

前端 未结 10 1045
庸人自扰
庸人自扰 2020-11-21 22:35

I understand the differences between optimistic and pessimistic locking. Now could someone explain to me when I would use either one in general?

And does the answer

10条回答
  •  北恋
    北恋 (楼主)
    2020-11-21 23:00

    Lot of good things have been said above about optimistic and pessimistic locking. One important point to consider is as follows:

    When using optimistic locking, we need to cautious of the fact that how will application recover from these failures.

    Specially in asynchronous message driven architectures, this can lead of out of order message processing or lost updates.

    Failures scenarios need to be thought through.

提交回复
热议问题