Hi Guys,
I’m have a performance issue after an elixir upgrade:
before:
elixir 1.6.4
erlang 20.3
phoenix 1.3.2
now:
elixir 1.9.0
erlang 22.0.4
phoenix 1.4.10
2000 requests/sec, 100 DB Connections (Postgres)
Before the 2000 requests executed in about 4 - 5 min, but the average time for each request was like 6s (I know this number is high and I need to cache some results to lower the request execution time, but that is not the problem I’m facing)
After the upgrade the total time is less about 2 - 3 min, but the average time for each request is 40s. It was a surprise to me that the new Elixir with the same settings as before was performing worse, even more, I’m losing some requests the HAProxy (working as reverse proxy) shows 2000 and my elixir backend app shows 1600. I even had to tweak some configuration values (to be able to finish most of the request) that I didn’t have to tweak before.
When I look at the logs locally, I see that the DBConnection Pool is switching too much between request and it is trying to execute close to 1 query on each request. So, it means that I have close to 2000 request executing little by little (I think because of this new CoDel alg). I would prefer to use a setting (If there was one) to assign a DBConnection to a request till the request finishes executing. I was looking also into DBConnection.Ownership to play with the :ownership_timeout but I also read that DBConnection.Ownership is more for tests (might have misinterpreted this)
My current settings:
config :myapp, BeaconWeb.Endpoint,
http: [
...
protocol_options: [
idle_timeout: 1_200_000,
inactivity_timeout: 1_200_000
]
]
config :myapp, Beacon.Repo,
...
pool_size: 100,
timeout: 100_000_000,
queue_target: 100_000_000
As additional information I’m getting this message frequently on localhost:
With DBConnection.ConnectionPool:
[info] [] Postgrex.Protocol (#PID<0.2384.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.4135.0> exited
With DBConnection.Ownership:
[error] [] Postgrex.Protocol (#PID<0.2384.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.4135.0> exited
Documentation I have checked:
https://hexdocs.pm/db_connection/DBConnection.html
https://hexdocs.pm/db_connection/DBConnection.Ownership.html
https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
https://ninenines.eu/docs/en/cowboy/2.5/manual/cowboy_http/
https://ninenines.eu/docs/en/ranch/1.6/manual/ranch/
Any help will be appreciated. Thanks in advance.