Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nRHm1-0006f2-ML for pgsql-performance@arkaria.postgresql.org; Mon, 07 Mar 2022 18:07:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nRHm0-00018C-LL for pgsql-performance@arkaria.postgresql.org; Mon, 07 Mar 2022 18:07:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nRHlz-000176-WB for pgsql-performance@lists.postgresql.org; Mon, 07 Mar 2022 18:07:56 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nRHlv-0003Vq-90 for pgsql-performance@lists.postgresql.org; Mon, 07 Mar 2022 18:07:55 +0000 Received: by mail-wr1-x433.google.com with SMTP id x15so24633125wru.13 for ; Mon, 07 Mar 2022 10:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=/0r9Q/fl3wEp/YFXN8Py/rv3t6MK8j7ftOH/cwsTAf4=; b=Zm3yYigejSz/tRCwC9kEPHQjA0ZnlPw7zacu0ZRGk/IB68ToOqkBW57ZM56m+ygG5s IZVe7cI3N5dWnZYx65bAuv1DQIrVh84zaIuSifWkyIwxK1OrNRl8P0Qkx0Vs01YQoASx RcZdqOeTmIkta1p5B1E01etf66HoI3HP8mQso6Ph6iWqXJHWv7IfO3W9jxDuVXFd7MIq EsUFTdp1Zn6pyE50Lgit5IyrsP8QDnJyfAl07fZCRP+TqgJrxina/5UBZtiiBmjnLYMo BcrxdwlaE91aLAoSjJW8NKWj0aPXTZq1EItz6Q8w6dmYLOTzpSEc6e/nTFwdIBDnHT1Y 4Cvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=/0r9Q/fl3wEp/YFXN8Py/rv3t6MK8j7ftOH/cwsTAf4=; b=VCBTMgSwveNhEEDV5d/Rk+hN7MFAF76F4Dr76sVaALJEpjxjSGYKVxvF6JHl0Oy84P 1tPB6MT+mvAFp6v2f9G4OjPxd6hx0hEpZFOq4JHcblE/gt7/i7No9ck3i/JdXS442eh5 fabmQsfBmJolTdRt2T8rWpg53iw59tBttIg4PQRuUJLQyAbI0NEdxogjuxI9ufqDk7D/ 0lkWzjrxY/S8Q1l8EIo9xH4wJCG+F0r7ZdZjp5wi55x8363uwzk4Hvig6/IkanfrfSiR wlZCHrKr++KBgglmx9A/Xr+zQhFVAdqCZfI1WdsrdaS4C4a3OLPoq0P0vTYVEUm0md32 h7KA== X-Gm-Message-State: AOAM531EbZ7yY4Y8vpwtXNEMkfl92hDy0/YPNlQYKsfxnsjOTIPWR210 FadLLrBVaIx7U5z6ZdsbLXlqEisdRP/YHyVQzvJSOxFR1F1lafKHaSVQTDUPxR4i6smBt+GmncK WbcAhkYMZi3hQLaZdcpEZ4mYy/OjvRrCw5q0onakLw6SyfMFHXpJcJNhcAHxKk2OiLWUmgpd5X9 LCWVoGLpL/pXCo/UikD0WQFkja3sX4hyF7sag5um1ojFaNm0frbnHrurPZ1SmbDZ4= X-Google-Smtp-Source: ABdhPJwmlTxQt4ELiIR3UUY11AQ1uyr5X1lfL9s0T9IBKK438u8errmmrWx7cUCgieBL8+JBezkjmw== X-Received: by 2002:adf:e289:0:b0:1e3:14ad:75fe with SMTP id v9-20020adfe289000000b001e314ad75femr9552622wri.685.1646676468913; Mon, 07 Mar 2022 10:07:48 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-251-241.net.upcbroadband.cz. [86.49.251.241]) by smtp.gmail.com with ESMTPSA id o22-20020a05600c4fd600b0038133076dcesm66024wmq.16.2022.03.07.10.07.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Mar 2022 10:07:48 -0800 (PST) Message-ID: Date: Mon, 7 Mar 2022 19:07:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Optimal configuration for server Content-Language: en-US To: Luiz Felipph , pgsql-performance@lists.postgresql.org References: From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/7/22 12:51, Luiz Felipph wrote: > Hi everybody! > > I have a big application running on premise. One of my main database > servers has the following configuration: > > 72 CPUs(2 chips, 18 physical cores per chip, 2 threads) Xeon Gold 6240 > 1TB of ram or 786GB (5 servers at all) > A huge storage( I don't know for sure what kind is, but is very powerful) > > A consulting company recommended the following configuration for theses > main servers(let me know if something important was left behind): > > maxx_connections = 2000 > shared_buffers = 32GB > temp_buffers = 1024 > max_prepared_transactions = 3000 > work_men = 32MB > effective_io_concurrency = 200 > max_worker_processes = 24 > checkpoint_timeout = 15min > max_wal_size = 64GB > min_wall_size = 2GB > effective_cache_size = 96GB > (...) > > I Think this is too low memory setting for de size of server... The > number of connections, I'm still measuring to reduce this value( I think > it's too high for the needs of application, but untill hit a value too > high to justfy any memory issue, I think is not a problem) > Hard to judge, not knowing your workload. We don't know what information was provided to the consulting company, you'll have to ask them for justification of the values they recommended. I'd say it looks OK, but max_connections/max_prepared_transactions are rather high, considering you only have 72 threads. But it depends ... > My current problem: > > under heavyload, i'm getting "connection closed" on the application > level(java-jdbc, jboss ds) > Most likely a java/jboss connection pool config. The database won't just arbitrarily close connections (unless there are timeouts set, but you haven't included any such info). > The server never spikes more the 200GB of used ram(that's why I thing > the configuration is too low) > Unlikely. If needed, the system would use memory for page cache, to cache filesystem data. So most likely this is due to the database not being large enough to need more memory. You're optimizing the wrong thing - the goal is not to use as much memory as possible. The goal is to give good performance given the available amount of memory. You need to monitor shared buffers cache hit rate (from pg_stat_database view) - if that's low, increase shared buffers. Then monitor and tune slow queries - if a slow query benefits from higher work_mem values, do increase that value. It's nonsense to just increase the parameters to consume more memory. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company