I read the definition in the docs
https://hexdocs.pm/db_connection/DBConnection.html#start_link/2-queue-config
But I am confused as to what they mean and how do they work. The example given is confusing. Can someone explain me this?
I read the definition in the docs
https://hexdocs.pm/db_connection/DBConnection.html#start_link/2-queue-config
But I am confused as to what they mean and how do they work. The example given is confusing. Can someone explain me this?
This answer I wrote a while ago might help you.
This is an extremely late reply but would like to provide my own answer in case someone visits.
See timeout - Elixir: DBConnection queue_target and queue_interval explained - Stack Overflow
The timeouts you’re referring to are set with the
:timeout
option in execution functions (i.e.execute/4
),:queue_target
and:queue_interval
are only meant to affect the pool’s ability to begin new requests (for requests to checkout connections from the pool), not requests that have already checked out connections and are already being processed.
Keep in mind that all attempts to checkout connections during a
:queue_interval
must take longer than:queue_target
in order for these values to affect anything. Normally you’d test different values and monitor your database’s ability to keep up in order to find optimal values for your environment.