Two issuses about concurrency that’re difficult to handle:
1. offline concurrency(transcations among several databases or serveral requests)
2. multi-thread concurrency in application server side
Two basic ways of controlling concurrency
1. isolation
2. to make some data immutable
Optimistic Lock: detect conflictions and then solve them。 The lock is only held during the commit
Pessimistic Lock: prevent conflictions