I have a method that can have 1000 requests per second. I need to pause request until one finishes the method. I used Lock Pessimistic Write but It slows response(time about 10 seconds ) What can do the same task with Pessimistic Write but more faster ?
I added composite index id,status for my query ( @Lock(LockModeType.PESSIMISTIC_WRITE) @Query("FROM Wallet w WHERE w.id=:id AND w.status = 'ACTIVE'") Optional findActiveWalletForUpdate(UUID id);) But it slowed the query