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 1q7WXX-0005dP-To for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Jun 2023 07:28:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q7WXW-0003df-Pa for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Jun 2023 07:28:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7WXW-0003dO-Ec for pgsql-hackers@lists.postgresql.org; Fri, 09 Jun 2023 07:28:06 +0000 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q7WXU-001Ape-Iv for pgsql-hackers@postgresql.org; Fri, 09 Jun 2023 07:28:05 +0000 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-75d4b85b3ccso142375085a.2 for ; Fri, 09 Jun 2023 00:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686295682; x=1688887682; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fojyldsvs1fCnqZ5E3VTuUWU/yglJZp+H3t57z+YPTI=; b=JrymJvsu9lj0nPpW4JPx/keIiw1DbmWJfWeYKr10KkPSHSeJ/IyLzx7LkA7XPjqjyr mGTrLnR2SXbkzt7ym7DDB2J3UKbnwR6Pz9U8WcbPW2kRZYO4rLF1XtKiVejMqjXnOngl TuQYBiM49rGK5zb4YZJUNAxoyf5mWCo7r1qoZplL46WfMJgdAMFrXrnPboTaLEeb+E8K GHu+b3I5K+NzuS4jOYUhGyVBf1ARVqo7ex4XctS3i9eQQOPJ3v/qAALkv15ueZ3c7bbb WmElvz2Hb1vZcAqsQxTg96VlwGx9RvPEvk/Hwpau7V7AG7/VmFNQ32R6GNVEdLJZsEW5 c+Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686295682; x=1688887682; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fojyldsvs1fCnqZ5E3VTuUWU/yglJZp+H3t57z+YPTI=; b=Yf78VuT3zjeNjtQvfiU0R7R9aRfy3Q9iNiS9bfAvaU8aU2qH6OGx52lv/LoCGF5elJ dO9jLR7xcwKB7cnfoLNSWkmcBe0Zq8dOFPQ2JuzwNgn8WkS0HVM52b/UhJmeWPvXaaTM GIV7ifdoY9BM7IKHzyUo0W4ldZ8LJFVOS512t+Bdu7vn+OO68PHVGyMGUBdffcJvJM/C H7c5lJtYtJV677FKTmVtD8APpmEDGHd+iUIA1DlvCr57t7GwUthHz36Ecg0qvPJljeh9 lAIj0H3+RXkzT6uC9XN+uLZzN7qJUn9TZfAagnLvq55ymCXHfytSBn1V9TFjiqYSz12y uP3A== X-Gm-Message-State: AC+VfDw32K3m/uCbazy36bzqTQeHUnk/SGXPghRZCPgDQBeg9PSabHq8 sYqnQbyTDH6MiUZOd5xiW4xn1ha3bdsAG+T5aLCqv1Fi36J1Ei69TK9noA== X-Google-Smtp-Source: ACHHUZ7HJ/pXR//K+GsJhJOq3TewxSMPA8sGuP9CqGTKmW282ZGdAk3Zp5cy2kelfZ5kl68gKualaH5+4Quh7g6ivFo= X-Received: by 2002:a05:620a:6846:b0:75b:23a1:3620 with SMTP id ru6-20020a05620a684600b0075b23a13620mr461500qkn.49.1686295682207; Fri, 09 Jun 2023 00:28:02 -0700 (PDT) MIME-Version: 1.0 References: <20230608221807.p77h43zotlfvkg65@awork3.anarazel.de> <20230609012147.5j3gw2dikjf76fti@awork3.anarazel.de> In-Reply-To: <20230609012147.5j3gw2dikjf76fti@awork3.anarazel.de> From: Gregory Smith Date: Fri, 9 Jun 2023 03:27:51 -0400 Message-ID: Subject: Re: Major pgbench synthetic SELECT workload regression, Ubuntu 23.04+PG15 To: Andres Freund Cc: PostgreSQL-development Content-Type: multipart/alternative; boundary="0000000000001fd32505fdad4fe8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001fd32505fdad4fe8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Let me start with the happy ending to this thread: $ pgbench -S -T 10 -c 32 -j 32 -M prepared -P 1 pgbench pgbench (15.3 (Ubuntu 15.3-1.pgdg23.04+1)) progress: 1.0 s, 1015713.0 tps, lat 0.031 ms stddev 0.007, 0 failed progress: 2.0 s, 1083780.4 tps, lat 0.029 ms stddev 0.007, 0 failed... progress: 8.0 s, 1084574.1 tps, lat 0.029 ms stddev 0.001, 0 failed progress: 9.0 s, 1082665.1 tps, lat 0.029 ms stddev 0.001, 0 failed tps =3D 1077739.910163 (without initial connection time) Which even seems a whole 0.9% faster than 14 on this hardware! The wonders never cease. On Thu, Jun 8, 2023 at 9:21=E2=80=AFPM Andres Freund w= rote: > You might need to add --no-children to the perf report invocation, > otherwise > it'll show you the call graph inverted. > My problem was not writing kernel symbols out, I was only getting addresses for some reason. This worked: sudo perf record -g --call-graph dwarf -d --phys-data -a sleep 1 perf report --stdio And once I looked at the stack trace I immediately saw the problem, fixed the config option, and this report is now closed as PEBKAC on my part. Somehow I didn't notice the 15 installs on both systems had log_min_duration_statement=3D0, and that's why the performance kept droppin= g *only* on the fastest runs. What I've learned today then is that if someone sees osq_lock in simple perf top out on oddly slow server, it's possible they are overloading a device writing out log file data, and leaving out the boring parts the call trace you might see is: EmitErrorReport __GI___libc_write ksys_write __fdget_pos mutex_lock __mutex_lock_slowpath __mutex_lock.constprop.0 71.20% osq_lock Everyone was stuck trying to find the end of the log file to write to it, and that was the entirety of the problem. Hope that call trace and info helps out some future goofball making the same mistake. I'd wager this will come up again. Thanks to everyone who helped out and I'm looking forward to PG16 testing now that I have this rusty, embarrassing warm-up out of the way. -- Greg Smith greg.smith@crunchydata.com Director of Open Source Strategy --0000000000001fd32505fdad4fe8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Let me start with the happy ending to this thread:

$ pgbench -S -T 10 -c 32 -j 32 -M prepared -P 1 pgbench
pgbench (15.3 (Ubuntu 15.3-1.pgdg23.04+1))<= br>progress: 1.0 s, 1015713.0 tps, lat 0.031 ms stddev 0.007, 0 failed
p= rogress: 2.0 s, 1083780.4 tps, lat 0.029 ms stddev 0.007, 0 failed...
pr= ogress: 8.0 s, 1084574.1 tps, lat 0.029 ms stddev 0.001, 0 failed
progre= ss: 9.0 s, 1082665.1 tps, lat 0.029 ms stddev 0.001, 0 failed
<= div>tps =3D 1077739.910163 (without i= nitial connection time)

Which even seems a = whole 0.9% faster than 14 on this hardware!=C2=A0 The wonders never cease.<= /div>

On Thu, Jun 8, 2023 at 9:21=E2=80=AFPM Andres Freund &l= t;andres@anarazel.de> wrote:
You might need to add --no-children to the perf report invocation, ot= herwise
it'll show you the call graph inverted.

=
My problem was not writing kernel symbols out, I was only getting addr= esses for some reason.=C2=A0 This worked:

=C2=A0 sudo perf record -g --call-graph dwarf= -d --phys-data -a sleep 1
=C2=A0 perf report --stdio

And o= nce I looked at the stack trace I immediately saw the problem, fixed the co= nfig option, and this report is now closed as PEBKAC on my part.=C2=A0 Some= how I didn't notice the 15 installs on both systems had log_min_duratio= n_statement=3D0, and that's why the performance kept dropping *only* on= the fastest runs.

What I've learned today= then is that if someone sees osq_lock in simple perf top out on oddly slow= server, it's possible they are overloading a device writing out log fi= le data, and leaving out the boring parts the call trace you might see is:<= br>

EmitErrorReport
=C2=A0__GI___libc_write
= =C2=A0 ksys_write
=C2=A0 =C2=A0__fdget_pos
=C2=A0 =C2=A0 mutex_lock=C2=A0 =C2=A0 =C2=A0__mutex_lock_slowpath
=C2=A0 =C2=A0 =C2=A0 __mutex= _lock.constprop.0
=C2=A0 =C2=A0 =C2=A0 =C2=A071.20% osq_lock
<= br>
Everyone was stuck trying to find the end of the log file to = write to it, and that was the entirety of the problem.=C2=A0 Hope that call= trace and info helps out some future goofball making the same mistake.=C2= =A0 I'd wager this will come up again.

Thanks t= o everyone who helped out and I'm looking forward to PG16 testing now t= hat I have this rusty, embarrassing warm-up out of the way.

--
Greg Smith=C2= =A0 greg.smith@crunchydata.co= m
Director of Open Source Strategy
--0000000000001fd32505fdad4fe8--