Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V2IS0-0008MG-3N for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jul 2013 10:07:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1V2IRy-00040a-MY for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jul 2013 10:07:10 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V2IRw-00040T-W2 for pgsql-hackers@postgresql.org; Thu, 25 Jul 2013 10:07:09 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V2IRr-0007gx-RQ for pgsql-hackers@postgresql.org; Thu, 25 Jul 2013 10:07:07 +0000 Received: from mfs5.rdh.ecl.ntt.co.jp (mfs5.rdh.ecl.ntt.co.jp [129.60.39.144]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id r6PA6ln4007879; Thu, 25 Jul 2013 19:06:47 +0900 Received: from mfs5.rdh.ecl.ntt.co.jp (localhost.localdomain [127.0.0.1]) by mfs5.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id C3EDAE012A; Thu, 25 Jul 2013 19:06:47 +0900 (JST) Received: from imail3.m.ecl.ntt.co.jp (imail3.m.ecl.ntt.co.jp [129.60.5.248]) by mfs5.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id B82A5E0128; Thu, 25 Jul 2013 19:06:47 +0900 (JST) Received: from [129.60.241.67] ([129.60.241.67]) by imail3.m.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id r6PA6l5h004434; Thu, 25 Jul 2013 19:06:47 +0900 Message-ID: <51F0F9C1.9080207@lab.ntt.co.jp> Date: Thu, 25 Jul 2013 19:11:13 +0900 From: KONDO Mitsumasa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Greg Smith , Robert Haas , Heikki Linnakangas , didier CC: PostgreSQL-development Subject: Re: Improvement of checkpoint IO scheduler for stable transaction responses References: <51B5AFB1.5030404@lab.ntt.co.jp> <51BDCB6C.1090507@vmware.com> <51BEB6F5.7070907@lab.ntt.co.jp> <51C40EF4.1080201@lab.ntt.co.jp> <51C9D03B.10107@vmware.com> <51C9FD5C.5050706@vmware.com> <51E2F865.8030406@2ndQuadrant.com> <51E80CBC.10204@2ndQuadrant.com> <51E8F080.4040506@lab.ntt.co.jp> <51E943A1.9030702@2ndQuadrant.com> <51ECF2CF.6080109@lab.ntt.co.jp> <51EDF01A.4050006@2ndQuadrant.com> In-Reply-To: <51EDF01A.4050006@2ndQuadrant.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: No X-Pg-Spam-Score: -0.0 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi, I understand why my patch is faster than original, by executing Heikki's patch. His patch execute write() and fsync() in each relation files in write-phase in checkpoint. Therefore, I expected that write-phase would be slow, and fsync-phase would be fast. Because disk-write had executed in write-phase. But fsync time in postgresql with his patch is almost same time as original. It's very mysterious! I checked /proc/meminfo in executing benchmark and other resources. As a result, this was caused by separating checkpointer process and writer process. In 9.1 or older, checkpoint and background-write are executed in writer process by serial schedule. But in 9.2 or later, it is executed by parallel schedule, regardless executing checkpoint. Therefore, less fsync and long-term fsync schedule method which likes my patch are so faster. Because waste disk-write was descend by thease method. In worst case his patch, same peges disk-write are executed twice in one checkpoint, moreover it might be random disk-write. By the way, when dirty buffers which have always under dirty_background_ratio * physical memory / 100, write-phase does not disk-write at all. Therefore, in fsync-phase disk-write all of dirty buffer. So when this case, write-schedule is not making sense. It's very heavy and waste, but it might not change by OS and postgres parameters. I set small dirty_backjground_ratio, but the result was very miserable... Now, I am confirming my theory by dbt-2 benchmark in lru_max_pages = 0. And I will be told about OS background-writing mechanism by my colleague who is kernel hacker next week. What do you think? Best regards, -- Mitsumasa KONDO NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers