Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bp078-0001UH-RN for pgsql-performance@arkaria.postgresql.org; Tue, 27 Sep 2016 21:40:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bp078-0006j9-Ao for pgsql-performance@arkaria.postgresql.org; Tue, 27 Sep 2016 21:40:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bp05R-0002gx-WA for pgsql-performance@postgresql.org; Tue, 27 Sep 2016 21:38:50 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bp05O-0001up-C5 for pgsql-performance@postgresql.org; Tue, 27 Sep 2016 21:38:49 +0000 Received: by mail-wm0-x236.google.com with SMTP id w84so200555607wmg.1 for ; Tue, 27 Sep 2016 14:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=/1vqu28fVpiikpp9zumBW8/AnBTQ7ReSGlK4DKfi4+s=; b=LbQw84JYNxNpw07CbNg/GcBduHL/iI+MglQa+vEZNDQMKnM06ai++8CkpyPLGjytJx qylqaCtN1K5mgcof5ebNIADs9sY29y3aykxdHJcpFuSH4ju8wMRvnoHR6cUiGV2Lt88V CbRmJe8Vwhkr3FzTrC4ybQJSpuio46qY4mHYmZVmsBO1KOTxGtIdx/FHWp5ECBKMJOrg 0jullexNLI3biWC1rksYY0dbI6K/HyEWZjEWWVJffWgqokop3NVcBQcmj+UyaElccCtN QiiR4gtorh+E7qvo/b3klCK60MPlLIj7DYFgle4aDsGRn36LaxA/MFB+0BiKNFzqMCs/ g9eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/1vqu28fVpiikpp9zumBW8/AnBTQ7ReSGlK4DKfi4+s=; b=lgp25bQ3E6Ob3szM7Q4GmK9y7498xNYb7bRVTK+R8TaTXNxhwG3CbMyG3BpAHLhnao Yp4W6hMIKB5ZxhVdvA6VPZNXy6S5TDKyiJti9T+Evn4N7suc4UVVxboGXbKJUKiyUtT4 4wraPQ7yF5atdlplsJlMKqzTDpnb4Ny/RVDzXgxWS0SLCsPJMC6kDgSszZPqObAIpRxA qa8ds8pNLXMnnFBAY3cxPnGFZZjC3LGGbQPxOoSUeCLgls/T2HeDhGyzP0tNZ5UqkrAE oUz+k1Bsz0TrU5ozHbFZbV9rDAh7tIUWb7mM0RbGOPs3XO/ZJgt+EdSwPzMmgu+XK/fP dPlQ== X-Gm-Message-State: AA6/9RlZ+0r0RGct9uXuC5WBi5PFE7Btj1z91587am3dLZkg+w93Q3XycUMCjbuaMVHNI80oEfXzQYk4q43OQ+dXnMYyRoWT6TpnJxyqH9PM0R/Gha9yciYbOnifmDqobsFWy2j3CfJF2Tgbg/JxH3niQOcR5qvO2fDqmqt+g0Ov1VVgrUkmct05VjD1j72gMr4btol66CdnZLzH3w== X-Received: by 10.194.73.5 with SMTP id h5mr2973533wjv.217.1475012325206; Tue, 27 Sep 2016 14:38:45 -0700 (PDT) Received: from [10.137.2.17] (ip-89-177-44-58.net.upcbroadband.cz. [89.177.44.58]) by smtp.gmail.com with ESMTPSA id n5sm4705000wjv.35.2016.09.27.14.38.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2016 14:38:44 -0700 (PDT) Subject: Re: PostgreSQL on ZFS: performance tuning To: Torsten Zuehlsdorff , pgsql-performance@postgresql.org References: <1cdf08f7-de8f-c55f-c1ec-29a5f15d5011@mail.ru> <5974493a-6785-1d7f-3b06-ba36468763ae@toco-domains.de> From: Tomas Vondra Message-ID: <2a522e5a-c79b-9bd5-46c8-441e8e762a87@2ndquadrant.com> Date: Tue, 27 Sep 2016 23:38:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Thunderbird/46.0a2 MIME-Version: 1.0 In-Reply-To: <5974493a-6785-1d7f-3b06-ba36468763ae@toco-domains.de> Content-Type: text/plain; charset=utf-8; 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-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 09/27/2016 06:00 PM, Torsten Zuehlsdorff wrote: > > > On 29.07.2016 08:30, Tomas Vondra wrote: >> >> >> On 07/29/2016 08:04 AM, trafdev wrote: >>> Hi. >>> >>> I have an OLAP-oriented DB (light occasional bulk writes and heavy >>> aggregated selects over large periods of data) based on Postgres 9.5.3. >>> >>> Server is a FreeBSD 10.3 with 64GB of RAM and 2x500GB SSD (root on ZFS, >>> mirror). >>> >>> The largest table is 13GB (with a 4GB index on it), other tables are 4, >>> 2 and less than 1GB. >>> >>> After reading a lot of articles and "howto-s" I've collected following >>> set of tweaks and hints: >>> >>> >>> ZFS pools creation: >>> zfs create zroot/ara/sqldb >>> zfs create -o recordsize=8k -o primarycache=all zroot/ara/sqldb/pgsql >>> >>> >>> zfs get primarycache,recordsize,logbias,compression >>> zroot/ara/sqldb/pgsql >>> NAME PROPERTY VALUE SOURCE >>> zroot/ara/sqldb/pgsql primarycache all local >>> zroot/ara/sqldb/pgsql recordsize 8K local >>> zroot/ara/sqldb/pgsql logbias latency local >>> zroot/ara/sqldb/pgsql compression lz4 inherited from zroot >>> >>> L2ARC is disabled >>> VDEV cache is disabled >>> >>> >>> pgsql -c "mkdir /ara/sqldb/pgsql/data_ix" >>> pgsql -c "initdb --locale=en_US.UTF-8 -E UTF-8 -D /ara/sqldb/pgsql/data" >>> >>> >>> /etc/sysctl.conf >>> vfs.zfs.metaslab.lba_weighting_enabled=0 >>> >>> >>> postgresql.conf: >>> listen_addresses = '*' >>> max_connections = 100 >>> shared_buffers = 16GB >>> effective_cache_size = 48GB >> >> It may not be a problem for your workload, but this effective_cache_size >> value is far too high. > > May i asked why? ZFS in default caches your size of RAM minus 1 GB. > Getting the shared buffer from the 64 GB RAM i would asume 47 GB > would be a better value. But this would not be far too high. So > please can you explain this? Because it's not a global value, but an estimate of how much RAM is available as a cache for a single query. So if you're running 10 queries at the same time, they'll have to share the memory. It's a bit trickier as there's often a fair amount of cross-backend sharing (backends accessing the same data, so it's likely one backend loads data into cache, and then other backends access it too). It also ignores that memory may get allocated for other reasons - some queries may allocate quite a bit of memory for sorts/aggregations, so not only is effective_cache_size = RAM - shared_buffers excessive as it ignores the per-query nature, but also because it neglects these other allocations. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance