spring-projects / spring-projects/spring-modulith

Minimising contention on event_publish table and pessimistic lock exceptions

Open
#544 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.2k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

In our system we have a lot of small events flying (one of the reason the are small rather than batching is because indices cannot be created on large events - as you may remember modulith creates index on body of the event itself which causes issues on e.g. on postgress)

Event_Publication table is therefore very often updated which leads to pessimistic locks exceptions spamming output. Issues arise especially on completing a given event. I have questions here:

  • what is most common way to deal with those problems?
  • is it caused by longer than expected running transactions on our side?
  • are these events that caused pessimistic lock issues on retried by modulith or spring framework?
  • is there any way to supress output with all those warning if events are retried once locks free up?
  • have you observed such behaviour in various systems you working on or others?
  • anything else that maybe useful to help to deal with those contention issues, e.g. tips?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining contention around the Event_Publication table when events are completed, especially the pessimistic lock exceptions described in the issue. Investigate whether transaction duration, event retries, and warning output contribute to the behavior. Done would require a clear explanation of the cause and documented guidance for handling or suppressing expected lock retries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql, spring-boot
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.