The performance bottleneck in LWLockRelease()method goes through an array one by one to see which lock was released with O(N). As soon as the lock is found it performs an array to remove the lock.
As linear search and compaction delays the release of the lock forcing the other Postgres instances WAiting for the lock to be released
Is any possible solution like
1. LWLockRelease() releases the lock first and then remove held lock from the array
2. Binary search (like non-linear structure) to reduce on high searching and remove all held locks