Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TGBYX-00008i-Bb for pgsql-admin@postgresql.org; Mon, 24 Sep 2012 16:30:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TGBYV-00062T-PO for pgsql-admin@postgresql.org; Mon, 24 Sep 2012 16:30:48 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q8OGUjRr016884; Mon, 24 Sep 2012 12:30:45 -0400 (EDT) From: Tom Lane To: Dennis Brouwer cc: pgsql-admin@postgresql.org Subject: Re: CPU causes 100% load in user space when ntp client runs and postgresql is under heavy load In-reply-to: References: Comments: In-reply-to Dennis Brouwer message dated "Mon, 24 Sep 2012 15:53:10 +0200" Date: Mon, 24 Sep 2012 12:30:45 -0400 Message-ID: <16883.1348504245@sss.pgh.pa.us> X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201209/134 X-Sequence-Number: 40075 Dennis Brouwer writes: > Last week I was repeatedly able to run all these tests on the database > without any issue but recently, all of a sudden at random, some of the > queries performed a factor 100 less. It may take hours to complete the > transaction. At the same moment we see a dramatic decrease in IO and the > CPU is nearly 100% busy in user space. > After days of testing I may have found the cause: the ntp client. If I stop > the ntp client the problem vanishes. > I have started reading on spinlocks and other related material but this all > is rather complicated stuff and kindly ask in what direction I should > search. The issue can be reproduced for both postgresql-9.1 and > postgresql-9.2 and perhaps can be rephrased as: Very high CPU load in user > space (at random) with ntp enabled and (long?) running transactions. That's really bizarre. What "ntp client" are you using exactly? Is it configured to adjust the system clock by slewing, or by stepping? Can you identify what part of the code is eating CPU (try perf or oprofile)? regards, tom lane