Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZXHw1-0001u0-Qp for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2015 23:59:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZXHw1-00069i-Cp for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2015 23:59:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZXHw0-00067a-H4 for pgsql-hackers@postgresql.org; Wed, 02 Sep 2015 23:59:20 +0000 Received: from mail-wi0-f181.google.com ([209.85.212.181]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZXHvx-00023X-Q7 for pgsql-hackers@postgresql.org; Wed, 02 Sep 2015 23:59:19 +0000 Received: by wicfx3 with SMTP id fx3so2689679wic.1 for ; Wed, 02 Sep 2015 16:59:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=qYz+yG3DbZYN4B6eELpByxLtggDGbL8g6updsgSgrHc=; b=iJ6qDUDmULTSqljqXI5keCEw+P81g0RKq1mnlpi9F82hWsEJGkNpQNq52lGpXXz9pr NbURfDut5btU22AUHKlwJsTIbmwc+5zski1PJou1CpiibudfGRCmRZOIvS8/VzzmVhg5 rBGb4OfleSKL1kt6EU/N5t0Hqw2DUga2ky3OOU7qL7v/xWqPoJcwYoRpCsoqqOHTOQDH UL000jsV+wKC9uoekM4lKhNlGRt8houmkZjDxLeXXg62fPDAJX8nJoAxh3+bi/WCLeKO V4ab6ZDgsj3QNDxdj9MhW3Q44PJnktbOn97/DJmQuWJQruUaHpLBAjW747MWXU135/Ww Bg/g== X-Gm-Message-State: ALoCoQkyjd/90InIl6FJBAOlyfU6gbHaeZQdu6dD8eKkkATghl23HIifPL+zHwu3AFoXxwYoQUORMhqCKiF9G7Q98mqotEf/GocNLAqUAZrm8jjiVNgNOxlN1clqHmt9nyFgHCIcJUENqkSIgtD+Rs1atkSbo/5YJPFTF31KvHfYXCzDxgDzQLab2fo1Nyy52g9P+Uo+gaiB X-Received: by 10.180.72.35 with SMTP id a3mr8253639wiv.21.1441238356223; Wed, 02 Sep 2015 16:59:16 -0700 (PDT) Received: from [10.137.2.12] (ip-78-45-216-26.net.upcbroadband.cz. [78.45.216.26]) by smtp.gmail.com with ESMTPSA id gt10sm5973942wib.20.2015.09.02.16.59.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 16:59:15 -0700 (PDT) Message-ID: <55E78D51.9050004@2ndquadrant.com> Date: Thu, 03 Sep 2015 01:59:13 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Andres Freund , Josh Berkus CC: pgsql-hackers@postgresql.org Subject: Re: Allow a per-tablespace effective_io_concurrency setting References: <20141209204337.GC24488@momjian.us> <55AA2469.20306@dalibo.com> <55AA27C3.7060009@dalibo.com> <20150902135351.GA5286@alap3.anarazel.de> <55E76950.2070403@2ndquadrant.com> <55E76AB7.4030306@agliodbs.com> <20150902222329.GD8555@awork2.anarazel.de> In-Reply-To: <20150902222329.GD8555@awork2.anarazel.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 09/03/2015 12:23 AM, Andres Freund wrote: > On 2015-09-02 14:31:35 -0700, Josh Berkus wrote: >> On 09/02/2015 02:25 PM, Tomas Vondra wrote: >>> >>> As I explained, spindles have very little to do with it - you need >>> multiple I/O requests per device, to get the benefit. Sure, the DBAs >>> should know how many spindles they have and should be able to determine >>> optimal IO depth. But we actually say this in the docs: >> >> My experience with performance tuning is that values above 3 have no >> real effect on how queries are executed. > > I saw pretty much the opposite - the benefits seldomly were > significant below 30 or so. Even on single disks. That's a bit surprising, especially considering that e_i_c=30 means ~100 pages to prefetch if I'm doing the math right. AFAIK queue depth for SATA drives generally is 32 (so prefetching 100 pages should not make a difference), 256 for SAS drives and ~1000 for most current RAID controllers. I'm not entirely surprised that values beyond 30 make a difference, but that you seldomly saw significant improvements below this value. No doubt there are workloads like that, but I'd expect them to be quite rare and not prevalent as you're claiming. > Which actually isn't that surprising - to be actually beneficial > (that is, turn an IO into a CPU bound workload) the prefetched buffer > needs to actually have been read in by the time its needed. In many > queries processing a single heap page takes far shorter than > prefetching the data from storage, even if it's on good SSDs. > > Therefore what you actually need is a queue of prefetches for the > next XX buffers so that between starting a prefetch and actually > needing the buffer ienough time has passed that the data is > completely read in. And the point is that that's the case even for a > single rotating disk! So instead of "How many blocks I need to prefetch to saturate the devices?" you're asking "How many blocks I need to prefetch to never actually wait for the I/O?" I do like this view, but I'm not really sure how could we determine the right value? It seems to be very dependent on hardware and workload. For spinning drives the speedup comes from optimizing random seeks to a more optimal path (thanks to NCQ/TCQ), and on SSDs thanks to using the parallel channels (and possibly faster access to the same block). I guess the best thing we could do at this level is simply keep the on-device queues fully saturated, no? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers