Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMYv8-0005ck-OH for pgsql-performance@arkaria.postgresql.org; Thu, 09 Apr 2020 15:16:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jMYv6-0005eJ-4I for pgsql-performance@arkaria.postgresql.org; Thu, 09 Apr 2020 15:16:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMYv5-0005eC-OD for pgsql-performance@lists.postgresql.org; Thu, 09 Apr 2020 15:16:43 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jMYuy-0003LM-Uh for pgsql-performance@postgresql.org; Thu, 09 Apr 2020 15:16:42 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id b4so3289833qvw.8 for ; Thu, 09 Apr 2020 08:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=4PVi1LIgEzVGpUhwuR03BCf429gm3CE3tklOW7bUFlg=; b=fps2LVMaOzEZ5+bo69eD0N/Wb7mbvykUeuW/WlqJB+sz83vxSxA/oENM6NwGG4defi V5+ehaFqWYvkv3zxVdlxWV9rYg3R7nd3F5mn7cqvVFthCLfm7f4MWQvsCF3KILIKbPiP W0yyItY7lNLDFb2ciNeR8lJ2qvRq9+ijsa8cAyOUn1NxKqGQUsVlsKq0HD83jDxpfWEo GbZVn/vFp+dPhHT/Xfav+oUiaVCkNkhWbZF2OSZXEoMLG6hxkVCh/28/SDRcFBuQ4kRH h7sRMDCf2NzjCyKCEOZgsOW4GfHM/coqv8usQS5ttRo/ghgzDemEBXXsRgY3y8+2/xN2 8Nlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4PVi1LIgEzVGpUhwuR03BCf429gm3CE3tklOW7bUFlg=; b=nG4L5hQREMw0N/lrZKGdBGfAtm1OZr7FSk8VnNB6oMm8z+f8VhVA5Q7NGfC5WGYITy vR8C/0+EhSUpp4fQWiL8ozZXF0MYniXEmn1X/gZxhx/GNi3QnYoUzufQoahA9SWkDcwJ 7ySqm56fw536Lv40NNrEkGgMkQDc2ETEWYR2SnIXeFQew0RJmL7EAvATK2qD04aAnzTP c7iC9XWz1ZtHLgfIA2s/csq2OwOYSfAsDnDYwsAmSeeQi4VgBs3b9akPZBQL8IJoJNzA R+jhyqV+fIBPFkcKRvce2eA+7n2Vd3wz6rq2JYzGkYTOc369b9DJsqUwUx5rZFH+5IhA H8cA== X-Gm-Message-State: AGi0PuZCb/peDzbQAcdTdlocVB8vunP175LeDWJQBar5LEj84pUKsLSa htliK/sCgrioe0ZfILXTG7eFeQ== X-Google-Smtp-Source: APiQypKgbsDkaPGScQbMYrpBghSDNEYG5SevwEtKzwgPbEehRmlJW/sFi44HHdAkvellJy1e1dKsyw== X-Received: by 2002:a0c:b896:: with SMTP id y22mr540801qvf.182.1586445396001; Thu, 09 Apr 2020 08:16:36 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k2sm21513841qte.16.2020.04.09.08.16.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2020 08:16:35 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 63BAA8007F7; Thu, 9 Apr 2020 10:16:33 -0500 (CDT) Date: Thu, 9 Apr 2020 10:16:33 -0500 From: Justin Pryzby To: Maxim Boguk Cc: pgsql-performance@postgresql.org Subject: Re: High insert rate server, unstable insert latency and load peaks with buffer_content and XidGenLock LWlocks with Postgresql 12 version Message-ID: <20200409151633.GO2228@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Apr 10, 2020 at 12:51:03AM +1000, Maxim Boguk wrote: > With database on dedicated server I encountered unusual load profile: > multi thread (200 connections static size pool via pgbouncer) insert only > into single table around 15.000 insert/s. > > Usually insert took 0.025ms and amount active backends (via > pg_stat_activity) usually stay in 1-5-10 range. > But every so while (few times per minute actually) number of active backend > go up to all 200 allowed connections. > Which lead to serious latency in latency sensitive load. > > No problem with IO latency or CPU usage found during performance analyze. > syncronous_commit = off Can you share other settings ? shared_buffers, checkpoint_*, bgwriter_* and max_wal_size ? And version() > And always one backend in SLRUSync. > > If anyone can have any good idea whats going on in that case and how I can > fix it - any ideas welcome. > So far I out of ideas. This might be useful: pg_stat_bgwriter view. I suggest to follow others advice and make a cronjob to do this every ~5 minutes: | INSERT INTO jrn_pg_stat_bgwriter SELECT now(), * FROM pg_stat_bgwriter; and write a window function to show values/time, or rrd graphs or whatever. -- Justin