Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fgUf3-00044Z-B2 for pgsql-admin@arkaria.postgresql.org; Fri, 20 Jul 2018 12:37:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fgUf1-0006or-C4 for pgsql-admin@arkaria.postgresql.org; Fri, 20 Jul 2018 12:37:27 +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.89) (envelope-from ) id 1fgUf0-0006oi-S7 for pgsql-admin@lists.postgresql.org; Fri, 20 Jul 2018 12:37:27 +0000 Received: from smtp205-pc.aruba.it ([62.149.157.205] helo=smtpg-pc.aruba.it) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fgUex-0001Po-AB for pgsql-admin@lists.postgresql.org; Fri, 20 Jul 2018 12:37:25 +0000 Received: from DT02 ([93.63.211.242]) by smtpcm2-pc.aruba.it with bizsmtp id D0dL1y00X5ELnP9010dMZp; Fri, 20 Jul 2018 14:37:21 +0200 From: "Alfonso Moscato" To: "'Campbell, Lance'" Cc: References: <00a601d4201a$e2291a10$a67b4e30$@merqurio.it> In-Reply-To: Subject: R: repeated out of shared memory error - not related to max_locks_per_transaction Date: Fri, 20 Jul 2018 14:37:21 +0200 Message-ID: <00e201d42026$67f91450$37eb3cf0$@merqurio.it> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJyTRksqbTjmmAqDGBi/OX9BtlRvgJ6PMbvo0ff/fA= Content-Language: it DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aruba.it; s=a1; t=1532090241; bh=AgBNZA7MvDC9/W7TKeTXoZPpMXqR6OEtEwPOQlw+2yI=; h=From:To:Subject:Date:MIME-Version:Content-Type; b=cML4GXfnrKhTq2qYO6FgCdYy+lviinYxcPlrEphMyIe5SOOoERbc2HW5yWN8nMPp7 zvNBfXQn8qv5psNNT73r7yqC/iz0Sz9rAHkrWMfT4YpjWId8oA0ZHyWhzJKP2a6b3x QI4U4vonpzVx5BSN5ywdEpNEqoSC66tcXiP2oIY0FlEd5hQb3V3khK0MRn7S0C+hV5 OQ9gadGhTlNF/aHi6DsK1J0otDVCDA5eH4YzrBFbF9WSfyAvcZuy3NLDuPfyCxp6UL NeMCYlcpICcDpmjFdl1ZaMvV5KVKZoChTkPIL0WNbOR4TliZW6jCjEqx9c4ZOqxeit /P7m0U05fgNkw== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I experimented a lot with shared buffers, but I haven't seen any = difference. With shared_buffers set to 16 gb I start seeing errors after one day and half, and with 40gb they start exactly at the same moment. One would expect that if something is consuming shared memory, setting = it to more than double should make some difference, but this isn't the case. Alfonso -----Messaggio originale----- Da: Campbell, Lance =20 Inviato: venerd=EC 20 luglio 2018 14:33 A: Alfonso Moscato Cc: pgsql-admin@lists.postgresql.org Oggetto: Re: repeated out of shared memory error - not related to max_locks_per_transaction I would also lookup the definition of shared buffers and effective = cache. If I remember correctly you can think of shared buffers as how much = memory total PostgreSQL has to work with. Effective cache is how much memory = is available for PostgreSQL to run, shared buffers, as well as an estimate = of how much memory is available to the OS to cache files in memory. So effective cache should be equal to or larger than shared buffers. = Effective cache is used to help with the SQL planning. Double check the documentation. =20 Lance Sent from my iPad > On Jul 20, 2018, at 6:15 AM, Alfonso Moscato = wrote: >=20 > We are getting crazy with "out of shared memory" errors, and we can't=20 > figure the reason. > We have postgresql "PostgreSQL 9.6.9 on x86_64-pc-linux-gnu (Ubuntu=20 > 9.6.9-2.pgdg16.04+1), compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9)=20 > 5.4.0 20160609, 64-bit", the server has 92gb of ram, it is a mixed=20 > environment (mostly OLTP, with some DW), with 100 sessions constantly=20 > open (a CRM) and some long queries run every half an hour. > Everything works fine, except that after 1 day and half we start=20 > receiving a lot of "out of shared memory" messages. > I am sure it is not related with the usual max_locks_per_transaction=20 > issue, because we have set max_locks_per_transaction to 384, and when=20 > we receive these messages we have no more than 50/100 locks totally. > Restarting the server usually works fine for one day and hal more, and = > then messages restart. > Looking at the log, we see that this error starts casually, sometimes=20 > on very small queries, returning some kbytes of data. > We have tried a lot of different configurations. we have tried with=20 > pgtune and pgconfig 2.0. >=20 > Currently, we have:=20 > max_connections =3D 200 > shared_buffers =3D 23GB > effective_cache_size =3D 69GB > maintenance_work_mem =3D 2GB > checkpoint_completion_target =3D 0.9 > wal_buffers =3D 16MB > default_statistics_target =3D 100 > random_page_cost =3D 4 > effective_io_concurrency =3D 2 > work_mem =3D 60293kB > min_wal_size =3D 2GB > max_wal_size =3D 4GB > max_worker_processes =3D 4 > max_parallel_workers_per_gather =3D 2 > max_locks_per_transaction =3D 384 > but we tried with work_mem to 130mb, shared_buffer to a maximum fo=20 > 40gb, effective_cache to 4gb >=20 > shared memory limits are very big:=20 > max number of segments =3D 4096 > max seg size (kbytes) =3D 18014398509465599 max total shared memory=20 > (kbytes) =3D 18014398442373116 min seg size (bytes) =3D 1 >=20 > thanks >=20 >=20 >=20