On Thu, Aug 12, 2021 at 8:03 AM Peter Smith <smithpb2...@gmail.com> wrote: > > That base data is showing there are similar numbers of keepalives sent > as there are calls made to WalSndWaitForWal. IIUC it means that mostly > the loop is sending the special keepalives on the *first* iteration, > but by the time of the *second* iteration the ProcessRepliesIfAny() > will have some status already received, and so mostly sending another > keepalive will be deemed unnecessary. > > Based on this, our idea was to simply skip sending the > WalSndKeepalive(false) for the FIRST iteration of the loop only! PSA > the patch 0002 which does this skip. >
I think we should also keep in mind that there are cases where it seems we are not able to send keep-alive at the appropriate frequency. See the discussion [1]. This is to ensure that we shouldn't unintentionally hamper some other workloads by fixing the workload being discussed here. [1] - https://www.postgresql.org/message-id/20210913.103107.813489310351696839.horikyota.ntt%40gmail.com -- With Regards, Amit Kapila.