Qorb is a work-in-progress Connection Pooling library, heavily inspired by the "Cueball" connection pooling library.
Qorb’s main interface is the Pool object.
This pool relies on two interfaces that can be customized:
-
The Resolver interface identifies how to locate backend servers. DnsResolver provides a default implementation which queries DNS entries to access the set of backends.
-
The Connector interface identifies how to connect to a single backend. Within this method, the
connect
method is essential, but theis_valid
andon_recycle
methods can optionally be implemented to perform (respectively) health checks and perform cleanup actions before used connections are returned to the pool.
To get up and running with a client, server, and DNS system, refer to the README in the examples directory.
In particular, the TCP echo workload example demonstrates how to create a connection pool with a custom TCP connection.
This provides a setup for generating a workload to an arbitrary number of backends, and then walks through the tools to inspect the connection pool.
-
Service: A named entity which refers to a program that is running with one or more instantiations as distinct backends.
-
Backend: An specific instance of a program running a service. Each backend should provide the same interface, such that a client can access any one of the backends implementing a service interchangeably.
-
Resolver: A client-side entity responsible for translating service name into backend location. A common example of a resolver is "DNS".
-
Slot: An allocated commitment to create a connection to a particular backend. A slot may be "connected" if the connection has been established, or "connecting" if the backend hasn’t yet been reached.
-
Slot Set: A group of slots all attempting to access a particular backend. The number of slots which are allocated for each backend is controlled by qorb, but may be adjusted via user-configurable policy.
-
Pool: The a group of connections to one or more backends, from which a client of qorb can "claim" a connection. The pool manages resolvers, finds backends, creates slots for backends, and vends out connected slots to clients.