Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ab933-0006pi-MR for pgsql-performance@arkaria.postgresql.org; Wed, 02 Mar 2016 15:50:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ab933-0007Hk-7i for pgsql-performance@arkaria.postgresql.org; Wed, 02 Mar 2016 15:50:49 +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 1ab91M-0003RF-8s; Wed, 02 Mar 2016 15:49:04 +0000 Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ab91J-0002CL-7a; Wed, 02 Mar 2016 15:49:03 +0000 Received: by mail-io0-x22e.google.com with SMTP id g203so263654907iof.2; Wed, 02 Mar 2016 07:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=Ozsba5myylMtRZhWBb2NgL5idUr/U086K3s3zsbOf9g=; b=zCTXy+VCTJv+TTtw+p8rsnXoTmm0ieZGldf/XAx/1uxpuAR+EhNjkK26lwDEW00r0v ST7ho3jKIlnwAi3QS6YTGrrlRyBjzAIJiV/rllqwPiDe57O+sMav2y7BcGZV7eWgrmWO 8b8+BP085uaZ420ST3s6oGaRc7WeejIsus2uO20eAkKp/7zT97f7y9Yu07pB1CAHj3TZ JRaS58Hi1sBVUiRsaT+LPTG5B9a4Epd3vRGnmdWwPf0q6kGpVvRd6Y08r1OmSNh/2uvf FFte+gWQOqzbuhQhtVywm3EJwPUU8HmGBlmDVCxpBIk/WsAChFyNL0iS3eaOve/ibBTB v3Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=Ozsba5myylMtRZhWBb2NgL5idUr/U086K3s3zsbOf9g=; b=lxfAMSGRildogvguGJjiTVCDMM36CUOLl9Cony47lG10q911dJ9RP55FfCef8nzYxC mpOZeyXCqAn65JuRDuMhTlOOnPAj9BABESQB8IVcKJKwGfaacqwSppQxlUWAe2XgA5SY SuBWlieBtY6FOjoB9lFeAdDSoLf68fo45ppEzLubj3a8yrfSmxCnUjgGUj9VlVzRPyWf Alug/z3DodufrSgUGcvzmYwx9HuEkHasSkw1U7e5/FpCIpfr92qDdxPVwt7NysyU9H/y VzVcJn3cyzpfYDb3C68pJC4bj8MedOfm6M9vrTyBeQl+E0mdgPTr09Nz1SId8ikLRQ2a 9yUw== X-Gm-Message-State: AG10YOS6K4wlA4C1ouFHgXrsqg6qePFIa5/DbtHFolpG0RskqyIROCY1MxGErry0qAwFFKOCI53unm/FS0QwIA== MIME-Version: 1.0 X-Received: by 10.107.46.34 with SMTP id i34mr35136339ioo.67.1456933740252; Wed, 02 Mar 2016 07:49:00 -0800 (PST) Received: by 10.36.51.204 with HTTP; Wed, 2 Mar 2016 07:49:00 -0800 (PST) In-Reply-To: References: Date: Wed, 2 Mar 2016 08:49:00 -0700 Message-ID: Subject: Re: autovacuum disk IO From: Scott Marlowe To: Artem Tomyuk Cc: "pgsql-admin@postgresql.org" , "pgsql-performance@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) 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 Wed, Mar 2, 2016 at 8:45 AM, Scott Marlowe wrote: > On Wed, Mar 2, 2016 at 8:25 AM, Artem Tomyuk wrote: >> Hi. >> >> I've noticed that autovac. process worked more than 10 minutes, during this >> zabbix logged more than 90% IO disk utilization on db volume.... >> >> ===========>29237 2016-03-02 15:17:23 EET 00000 [24-1]LOG: automatic >> vacuum of table "lb_upr.public._reference32": index scans: 1 >> pages: 0 removed, 263307 remain >> tuples: 298 removed, 1944753 remain, 0 are dead but not yet removable >> buffer usage: 67814 hits, 265465 misses, 15647 dirtied >> avg read rate: 3.183 MB/s, avg write rate: 0.188 MB/s >> system usage: CPU 5.34s/6.27u sec elapsed 651.57 sec >> >> Is it possible to log autovac. io impact during it execution? >> Is there any way to limit or "nice" autovac. process? > > I'll assume you're running a fairly recent version of postgresql. > > There are a few settings that adjust how hard autovacuum works when > it's working. > > autovacuum_max_workers tells autovacuum how many threads to vacuum > with. Lowering this will limit the impact of autovacuum, but generally > the default setting of 3 is reasonable on most machines. > > autovacuum_vacuum_cost_delay sets how to wail between internal rounds. > Raising this makes autovacuum take bigger pauses internally. The > default of 20ms is usually large enough to keep you out of trouble, > but feel free to raise it and see if your IO utilization lowers. > > autovacuum_vacuum_cost_limit sets a limit to how much work to do > between the pauses set by the cost delay above. Lowering this will > cause autovac to do less work between pauses. > > Most of the time I'm adjusting these I'm making vacuum more > aggressive, not less aggressive because vacuum falling behind is a > problem on the large, fast production systems I work on. In your case > you want to watch for when autovacuum IS running, and using a tool > like vmstat or iostat or iotop, watch it for % utilization. You can > then adjust cost delay and cost limit to make it less aggressive and > see if your io util goes down. > > Note though that 90% utilization isn't 100% so it's not likely > flooding the IO. But if you say raise cost delay from 20 to 40ms, it > might drop to 75% or so. The primary goal here is to arrive at numbers > that left autovacuum keep up with reclaiming the discarded tuples in > the database without getting in the way of the workload. > > If your workload isn't slowing down, or isn't slowing down very much, > during autobvacuum then you're OK. Just to add a point here. If you're machine can't keep up with production load AND the job of vacuuming, then your IO subsystem is too slow and needs upgrading. The difference between a pair of spinning 7200RPM drives and a pair of enterprise class SSDs (always with power off safe writing etc, consumer SSDs can eat your data on power off) can be truly huge. I've seen improvements from a few hundred transactions per second to thousands of transactions per second by a simple upgrade like that. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance