jeudi 13 août 2015

Alternative to pessimistic locking to objects that are constantly/concurrently updated

Currently we are developing a credit transaction system on Grails 2.4.4.

We have a Credit model that holds the amount of credits of a User.

class Credit {
    BigDecimal amount
    User user
}

Problem is the amount is constantly debited/credited as the users transact.

We tried to do pessimistic locking on it to maintain integrity of it. But we realized that it bottle necks transactions since that user can only transact one at a time.

Any alternative to this? Any design patterns we can use? We are open to altering the model, or taking other approaches.

Aucun commentaire:

Enregistrer un commentaire