db_connection v1.1.3 DBConnection.Sojourn.Broker View Source

A :sbroker callback module using a timeout strategy for the client queue and a CoDel strategy for the connection queue.

Queue options

  • :queue_timeout - The time to wait for control of the connection’s state (default: 5_000)
  • :queue_out - Either :out for a FIFO queue or :out_r for a LIFO queue (default: :out)
  • :queue_drop - Either :drop for head drop on max size or :drop_r for tail drop (default: :drop)
  • :queue_size - The maximum size of the queue (default: 1024)
  • :queue_min - The minimum number of requests in the queue before the queue will timeout requests (default: 0)

Queue protector options

  • :protector - Either true to enable the queue protector or false not to (default: false)
  • :protector_interval - The time interval in milliseconds before the protector will start dropping requests, ideally the 95-99 percentile response time for a failure response to an end user, e.g. 95 percent response time for a HTTP 500 response to a mobile user (default: 5_000)
  • :protector_target - The target queue time in milliseconds, ideally 5%-10% of the :protector_interval for the queue to feel responsive, (default: div(protector_interval, 10))
  • :protector_size - The maximum number of requests the protector will try to allow in the message queue (default: 64)
  • :protector_min - The minimum number of requests in the message queue before the protector will drop requests (default: 0)

Queue overload alarm options

  • :overload_alarm - Either true to set an alarm on overload or false not to - a protector should prevent overload so defaults to false when using a protector, otherwise true (default: not protector)
  • :overload_target - The target time in milliseconds for messages in the message queue (default: 500)
  • :overload_interval - The interval in milliseconds for an alarm to be set when messages are spending longer than the target time in the message queue (default: 5_000)

Idle connection options

  • :idle_out - Either :out for a FIFO queue or :out_r for a LIFO queue (default: if pool_overflow == 0 :out, otherwise :out_r)
  • :idle_interval - The time interval in milliseconds before the pool will start pinging or dropping connections, ideally the 95-99 percentile the connection and handshake time for a database connection (default: 100)
  • :idle_min - The minimum number of idle connections before the pool will ping or drop idle connections (default: div(pool_size, 4))

Regulator options

  • :regulator_update - The average interval in milliseconds to update the regulator (default: 100)