package resource-pooling

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This module is built around Resource_pool. While a pool of type Resource_pool.t manages a number of resources, here we manage a cluster of such pools. A typical use case would be a cluster of servers, where for each server we maintain a number of connections. A user of this module can call use to access one of the connections, which are served in a round-robin fashion.

Whenever the Resource_invalid exception is raised during use the server is considered dysfunctional which leads to the following measures:

  • All connections to the server are closed.
  • The server is marked as suspended and will not be used anymore.
  • If the safe flage of the Resource_invalid exception was true, then the function supplied to f is reexecuted using a different connection on a different server.
  • Every check_delay seconds a check_server will be executed in order to see whether the server is useable. In this case the suspended-label is removed from the server and it will be used again.
val section : Lwt_log.section
module type CONF = sig ... end
module Make (Conf : CONF) : sig ... end