Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VBLtw-0002na-9T for pgsql-admin@arkaria.postgresql.org; Mon, 19 Aug 2013 09:37:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VBLtv-00005u-Pn for pgsql-admin@arkaria.postgresql.org; Mon, 19 Aug 2013 09:37:27 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VBLtu-00005l-QK for pgsql-admin@postgresql.org; Mon, 19 Aug 2013 09:37:27 +0000 Received: from mail-qe0-x230.google.com ([2607:f8b0:400d:c02::230]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VBLtr-0002Di-5R for pgsql-admin@postgresql.org; Mon, 19 Aug 2013 09:37:26 +0000 Received: by mail-qe0-f48.google.com with SMTP id 3so793692qea.21 for ; Mon, 19 Aug 2013 02:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:date:subject:from:to:message-id:thread-topic:in-reply-to :mime-version:content-type:content-transfer-encoding; bh=AnBMOOGnbR/hI2AJHC+L3FCOOggOkoHtXbfOW+DrMoc=; b=HBYxgmPfOt3O0NNji2P1EU5c/BURfzl88525nH2PWhYPtHK1Pt4svAbqbfHaxTrjSD Ws5lYIr44gCvg5G5wlHPui4Z9wXqcfQiYXTOIMtH8hp9rzxGLy17xewi1Yb4haVpy465 eMJO/RfA6oUydcUG28T3bCfs1/P2uQ+vxNgeaUEb1UvviB+niktZ6IV4ruNoNBx5JmHe NfYzwRxMmtyGW1MPq8hV+U451KgQhAjqAIBl4YXZy/MudXwhtmC2jVsbYRTXxfdG+fkz rZSqDN+oVs6/++ZPMbi9ECkQ0BOYyuX3KQ7ppZUGOn70Sbg+njYHnaWoGvxm8vUN7TJz vstw== X-Received: by 10.224.4.2 with SMTP id 2mr13986068qap.55.1376905041817; Mon, 19 Aug 2013 02:37:21 -0700 (PDT) Received: from [10.8.1.62] (40.166.255.173.client.static.strong-in91.as13926.net. [173.255.166.40]) by mx.google.com with ESMTPSA id a2sm15418178qek.7.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 19 Aug 2013 02:37:21 -0700 (PDT) User-Agent: Microsoft-MacOutlook/14.2.3.120616 Date: Mon, 19 Aug 2013 12:37:16 +0300 Subject: Re: postgres crashes on insert in 40 different threads From: Dzmitry To: Albe Laurenz , =?ISO-8859-1?B?U3TpcGhhbmU=?= Schildknecht , "pgsql-admin@postgresql.org" Message-ID: Thread-Topic: [ADMIN] postgres crashes on insert in 40 different threads In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="windows-1254" Content-transfer-encoding: quoted-printable X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Do you mean postgres log file(in postgres.conf) log_filename =3D 'postgresql-%Y-%m-%d_%H%M%S.log' log_min_messages =3D warning Or /var/log/messages ? Because I haven't this file :( Thanks, Dzmitry On 8/19/13 12:26 PM, "Albe Laurenz" wrote: >Dzmitry wrote: >> On 8/19/13 11:36 AM, "St=E9phane Schildknecht" >> wrote: >>> Le 19/08/2013 10:07, Dzmitry a =E9crit : >>>> I have postgres server running on ubuntu 12,Intel Xeon 8 CPUs 29 GB >>>>RAM. >>>> With following settings: >>>> max_connections =3D 550 >>>> shared_buffers =3D 12GB >>>> temp_buffers =3D 8MB >>>> max_prepared_transactions =3D 0 >>>> work_mem =3D 50MB >>>> maintenance_work_mem =3D 1GB >>>> fsync =3D on >>>> wal_buffers =3D 16MB >>>> commit_delay =3D 50 >>>> commit_siblings =3D 7 >>>> checkpoint_segments =3D 32 >>>> checkpoint_completion_target =3D 0.9 >>>> effective_cache_size =3D 22GB >>>> autovacuum =3D on >>>> autovacuum_vacuum_threshold =3D 1800 >>>> autovacuum_analyze_threshold =3D 900 >>>> >>>> I am doing a lot of writes to DB in 40 different threads =AD so every >>>>thread >>>> check if record exists =AD if not =3D> insert record, if exists =3D> u= pdate >>>>record. >>>> During this update, my disk IO almost always =AD 100% and sometimes it >>>>crash my >>>> DB with following message: >>>> >>>> 2013-08-19 03:18:00 UTC LOG: checkpointer process (PID 28354) was >>>>terminated by signal 9: Killed >[...] >>>> >>>> My DB size is not very big =AD 169GB. >>>> >>>> Anyone know how can I get rid of DB crash ? > >>> The fact that the checkpointer was killed -9 let me think the >>>OOMKiller has >>> detected you were out of memory. >>> >>> Could that be the case? >>> >>> 12GB of shared_buffers on a 29Gb box is too high. You should try to >>>lower that >>> value to 6GB, for instance. >>> 550*50MB, that is 27GB of RAM that PostgreSQL could try to adress. >>> >>> I can imagine your system is swapping a lot, and you exhaust swap >>>memory before crash. > >> I don't think it's the case. I am using newrelic for monitoring my DB >> servers(I have one master and 2 slaves - all use the same >>configuration) - >> memory is not going above 12.5GB, so I have a good reserve, also I don't >> see any swapping there :( > >You can check by examining /var/log/messages to see if the OOM >killer is at fault, which is highly likely. > >The OOM killer uses heuristics, so it does the wrong thing occasionally. > >The documentation is helpful: >http://www.postgresql.org/docs/9.2/static/kernel-resources.html#LINUX-MEMO >RY-OVERCOMMIT > >Yours, >Laurenz Albe --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin