> On Apr 5, 2018, at 11:03, Konstantin Knizhnik <k.knizh...@postgrespro.ru> > wrote: > > From the other side, the fact that any of this > > a) increasing deadlock timeout > b) avoid concurrent execution of deadlock check > c) perform first stage of deadlock check under shared lock > > have very noticeable effect on the observed behavior and some of them allow > to completely eliminate the problem, > makes me think that deadlock detection is not a symptom but the main source > of the problem.
It seems to me that instead of running deadlock detection one-by-one you can use exponential backoff. It should provide "good" degradation during high contention and does not make things bad on low contention. Maybe you should combine it with Yura's patch for additional benefit and benchmark it on different contentions.