10 unstable releases (3 breaking)

0.3.1 Apr 10, 2025
0.3.0 Apr 10, 2025
0.2.1 Nov 27, 2024
0.2.0 Oct 31, 2024
0.0.1 May 28, 2024

#243 in Database interfaces

Download history 65/week @ 2024-12-27 1125/week @ 2025-01-03 1609/week @ 2025-01-10 1327/week @ 2025-01-17 2037/week @ 2025-01-24 2013/week @ 2025-01-31 1320/week @ 2025-02-07 2084/week @ 2025-02-14 4261/week @ 2025-02-21 2915/week @ 2025-02-28 1499/week @ 2025-03-07 1797/week @ 2025-03-14 2462/week @ 2025-03-21 2174/week @ 2025-03-28 3263/week @ 2025-04-04 3360/week @ 2025-04-11

11,675 downloads per month

MPL-2.0 license

215KB
4.5K SLoC

:showtitle: :toc: left :icons: font

Qorb

Qorb is a work-in-progress Connection Pooling library, heavily inspired by the "Cueball" connection pooling library.

Overview

Qorb's main interface is the link:Pool object.

This pool relies on two interfaces that can be customized:

  • The link:Resolver interface identifies how to locate backend servers. link:DnsResolver provides a default implementation which queries DNS entries to access the set of backends.
  • The link:Connector interface identifies how to connect to a single backend. Within this method, the connect method is essential, but the is_valid and on_recycle methods can optionally be implemented to perform (respectively) health checks and perform cleanup actions before used connections are returned to the pool.

Examples

To get up and running with a client, server, and DNS system, link:examples/README.adoc[refer to the README in the examples directory].

In particular, the link:examples/tcp_echo_workload/main.rs[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.

Terminology

  • 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.

TODO List

Things I'd like to do before getting more eyes on this:

  • Add dtrace probes
  • Add a baseline test suite

Dependencies

~10–24MB
~353K SLoC