Skip to content
RY

Backend / Networking · 2025

butler-http

Butler is a Fiber-native Ruby HTTP client with HTTP/1.1 and HTTP/2 support, automatic ALPN negotiation, connection pooling, and resilience patterns — retries with backoff and jitter, deadlines, and circuit breakers — built in rather than bolted on.

RubyFiber SchedulerHTTP/2RSpec

The problem

Most Ruby HTTP clients either block a whole thread per request or require wiring up an external concurrency library to get real parallelism. Under load, that means thread-pool exhaustion, and without built-in retry/circuit-breaker behavior, every service ends up re-implementing the same resilience logic inconsistently.

The solution

Built the client around Ruby’s Fiber scheduler so concurrent requests yield instead of blocking a thread, with connection pooling, retries with exponential backoff and jitter, request deadlines, and circuit breakers implemented once in the client rather than per-caller.

Architecture

A fiber-aware connection pool negotiates HTTP/1.1 or HTTP/2 via ALPN per host and reuses warm connections across fibers. Retry, deadline, and circuit-breaker logic wrap each request as composable middleware, with secure-by-default TLS settings and hooks for observability.

Results

  • Published as a public RubyGem (rubygems.org/gems/butler-http)
  • Handles thousands of concurrent outbound requests per process without a thread-per-request model
  • Circuit breakers contained downstream outages that previously cascaded into request queues