elixir-ecto / db_connection

Database connection behaviour

Home Page:http://hexdocs.pm/db_connection/DBConnection.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Queue config documentation is not clear

Shayon opened this issue · comments

The documentation that explains the queue configurations is vague and unclear to the point that I don't know how to correctly configure them. The documentation is currently as follows:


Queue config

Handling requests is done through a queue. When DBConnection is started, there are two relevant options to control the queue:

  • :queue_target in milliseconds, defaults to 50
  • :queue_interval in milliseconds, defaults to 1000

Our goal is to stay under :queue_target for :queue_interval. In case we can’t reach that, then we double the :queue_target. If we go above that, then we start dropping messages.

For example, by default our queue time is 50ms. If we stay above 50ms for a whole second, we double the target to 100ms and we start dropping messages once it goes above the new limit.

This allows us to better plan for overloads as we can refuse requests before they are sent to the database, which would otherwise increase the burden on the database, making the overload worse.


I really don't think it is clearly explaining how the configurations work.

If we stay above 50ms for a whole second

What does it even mean to stay above a 50ms for 1 second? 50ms, by definition, is less than 1 second.
Does it mean that if ALL connections during a :queue_interval last longer than :queue_target then :queue_target is doubled? If that is what it means it is not clear, if that is not what it means it is not clear.

Thanks @josevalim ❤️ Much easier to comprehend now!