elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Queue config documentation is not clear #182

Closed Shayon closed 5 years ago

Shayon commented 5 years ago

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:

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.

Shayon commented 5 years ago

Thanks @josevalim :heart: Much easier to comprehend now!