Project

gruf-queue

0.0
No release in over 3 years
Gruf::Queue provides enhanced thread pool management and intelligent request handling for Gruf gRPC servers. Features include automatic resource exhaustion protection, smart ActiveRecord connection management, and zero-configuration plugin architecture for improved performance and reliability in high-throughput environments.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.0
~> 13.0
~> 3.12
~> 1.57
~> 0.22
~> 0.9

Runtime

~> 1.0
~> 2.21
 Project Readme

Gruf::Queue

Gem Version Ruby License: MIT

Simple GRPC::Pool enhancement that replaces worker-based capacity checking with job count based threshold.

What it does

  • Simplifies GRPC::Pool by removing complex worker queue management
  • Direct job scheduling to @jobs queue with idle thread processing
  • Uses jobs_waiting < threshold for capacity management
  • Configurable threshold via GRUF_MAX_WAITING_REQUESTS (default: 60)
  • Supports graceful shutdown

Installation

gem 'gruf-queue'

Usage

require 'gruf-queue'

# Optional: Set threshold (default is 60)
ENV['GRUF_MAX_WAITING_REQUESTS'] = '100'

# Start server normally
Gruf::Server.new(
  hostname: '0.0.0.0:9001',
  services: [YourService]
).start

Configuration

# Disable auto-installation
ENV['GRUF_QUEUE_NO_AUTO_INSTALL'] = 'true'

# Manual installation
Gruf::Queue::Plugin.install!

How it works

# Before: GRPC::Pool tracks actual worker availability
pool.ready_for_work? # Complex worker state checking

# After: Simple job count threshold
pool.ready_for_work? # jobs_waiting < max_waiting_requests

Requirements

  • Ruby >= 3.2.0
  • Gruf >= 2.21.0
  • gRPC >= 1.0

License

MIT License