José Valim
José Valim
Those sudden drops are most likely reflecting lost of connectivity to the database itself. We ping connections every second or so and, if the database does not respond, or does...
Fork `postgrex` and send a PR to instrument `Postgrex.Protocol.ping`. :) Run it in prod and if you get good data from it, we can include it by default most likely....
Actually, looking at the code, if the ping fails, we already emit `[:db_connection, :disconnected]` if you are using `DBConnection.TelemetryListener`. Can you try that instead?
Ok, so try changing this function instead (it would be the same as changing Postgrex): https://github.com/elixir-ecto/db_connection/blob/master/lib/db_connection/connection.ex#L172 Emit one telemetry on each branch, saying if the ping succeed or failed.
Ok, I just read the remaining of your comment. Something else to consider is if the machine is overloaded. If you are having bursts and those are causing a bunch...
Measure the run queues for the overloading bits. And make sure that the VM is getting as many cores as available by the machine (see erlang:system_info or your Phoenix dashboard)....
Yes, all options passed to your repository are eventually passed down to DBConnection.