moonpool resource pools

Simulator

The pool,
under load

A synthetic client borrows and returns against a real pool from this package, built for the browser. Every lane, every retirement and every refusal below was decided by the library; the page only draws what came back.

Twenty-four seconds of traffic

running…
busy · lent or being made idle · waiting in the pool share of new connections refused
clock —

What the picture is

Each column is one tenth of a second. The pool answers, the client acts, and the next column is what the pool counted afterwards.

Two heights

busy lent or being made. idle waiting to be lent again. The two always add up to live, and live never passes size.

When the busy area touches the top, the pool is full: the next request is answered Wait, not made to queue inside the pool.

Where the idle goes

keep retires an idle resource. life retires any resource, however busy it has been.

Both are measured from the timestamps the caller passes in. A resource past its age comes back as Stale from take even if the eviction timer never ran.

Where the refusals come from

breaker in front: failed makes raise its refusal rate, and take answers Shed.

Turn on a failing backend and watch the red line climb: the pool stops asking the backend for connections instead of waiting on each one.