plum is a lightweight tool for investigating and exploring lock contention or deadlock in PostgreSQL.
Primarily supported by two libraries:
Several years ago, I was helping my friend learn coding for the first time. He was coding something like hello world in Java, and I was watching him do it. I noticed he named a Scanner variable as "plum", like this:
Scanner plum = new Scanner(System.in);
Me: Why did you name this variable plum?
Him: I like plums.
He likes making jokes, but this time he wasn't joking. I found this very entertaining, so that's how the name of this project came to be. If you prefer a more boring version, you can remember it as "Postgres Locks Uner Monitoring" or something (I made that out of "plum", honestly).
-
Actively monitor the PostgreSQL processes and the locks they're holding in realtime.
-
Record and replay the monitored session.
-
Drill down into a specific moment to gain insight of the locks held at that moment.
-
Control interval for realtime update, which tables to monitor, etc.
-
Monitor the total number of locks currently held by any processes.
- Configure your env.sh: Copy
env.sh.example
in the root directory toenv.sh
, and tweak the variables to fit your environment. - Run
make run-server
to run the plum server. - (first time only) In another console, change directory to
ui
and runnpm run install
. - Back to the root directory, run
make run-ui
. - The UI should start up at
localhost:3399
.
- The statistics data might not reflect the most up-to-date state, because it doesn't include the queries or transactions still in progress.
- Depending on the permissions of the Postgres user you're using for plum, you might see some null values if the user doesn't have enough permissions.