From 3d0c943e5542d9a28fe5796fc4e4fff37cb71d7a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 29 Apr 2020 16:34:05 +0300 Subject: [PATCH] decreasing default max_connections option --- config/config.exs | 2 +- config/description.exs | 2 +- docs/configuration/cheatsheet.md | 4 ++-- lib/pleroma/gun/conn.ex | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/config.exs b/config/config.exs index ee953c6c8..34cb02034 100644 --- a/config/config.exs +++ b/config/config.exs @@ -606,7 +606,7 @@ config :pleroma, Pleroma.Repo, prepare: :unnamed config :pleroma, :connections_pool, - max_connections: 250, + max_connections: 125, max_idle_time: 1, closing_idle_conns_interval: 1, retry: 1, diff --git a/config/description.exs b/config/description.exs index 71a16c26c..d503b64e6 100644 --- a/config/description.exs +++ b/config/description.exs @@ -2932,7 +2932,7 @@ config :pleroma, :config_description, [ %{ key: :max_connections, type: :integer, - description: "Maximum number of connections in the pool. Default: 250 connections.", + description: "Maximum number of connections in the pool. Default: 125 connections.", suggestions: [250] }, %{ diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 6f7012af2..b324bb183 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -394,9 +394,9 @@ For each pool, the options are: Advanced settings for connections pool. Pool with opened connections. These connections can be reused in worker pools. -For big instances it's recommended to increase `max_connections` up to 500-1000. It will increase memory usage, but federation would work faster. +For big instances it's recommended to increase `max_connections` up to 250-500. It will increase memory usage, but federation would work faster. -* `:max_connections` - maximum number of connections in the pool. Default: 250 connections. +* `:max_connections` - maximum number of opened connections in the pool. Default: 125 connections. * `:max_idle_time` - maximum of time in minutes, while connection can be idle. Default: 1 minute. * `:closing_idle_conns_interval` - interval between cleaning pool in minutes from idle connections. Default: 1 minute. * `:retry` - number of retries, while `gun` will try to reconnect if connection goes down. Default: 1. diff --git a/lib/pleroma/gun/conn.ex b/lib/pleroma/gun/conn.ex index 52b80cc85..de3173351 100644 --- a/lib/pleroma/gun/conn.ex +++ b/lib/pleroma/gun/conn.ex @@ -51,7 +51,7 @@ defmodule Pleroma.Gun.Conn do key = "#{uri.scheme}:#{uri.host}:#{uri.port}" - max_connections = pool_opts[:max_connections] || 250 + max_connections = pool_opts[:max_connections] || 125 with {:ok, conn_pid} <- try_open(name, uri, opts, max_connections) do :ok = Gun.set_owner(conn_pid, Process.whereis(name))