Skip to content

genropy/genro-daemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

genro-daemon

A high-performance TCP daemon for the Genropy web framework. It replaces the legacy Pyro4-based daemon with a modern asyncio + uvloop stack using msgpack for efficient binary serialisation.

It's designed as a drop-in replacement for the old daemon. It needs genropy installed. Once you install this package, it's going to replace the 'gnr.web.daemon' with the new implementation, so switching from the old to the new it's transparente. By disinstalling genro-daemon, you'll be able to continue to use the old implementation.

Features

  • Single-port multi-tenant — one daemon hosts all site registers on one TCP port
  • Pluggable storage — in-memory (default) or Redis for distributed / persistent deployments
  • Optional Prometheus metrics — zero-cost when disabled, full histogram + counter suite when enabled
  • Process management — cron and worker pools per site, with automatic restart on failure
  • Production-ready — SIGTERM handling, connection pooling, configurable cleanup

Requirements

  • Python 3.11+
  • genropy
  • msgpack, uvloop

Installation

pip install genro-daemon

With optional extras:

# Redis backend
pip install "genro-daemon[redis]"

# Prometheus metrics
pip install "genro-daemon[prometheus]"

# Both
pip install "genro-daemon[redis,prometheus]"

Quickstart

Start the daemon on the default host/port (localhost:40404):

gnr web daemon

Start with custom host and port:

gnr web daemon -H 0.0.0.0 -P 9000

Start with Redis storage backend:

GNR_DAEMON_STORE=redis://localhost:6379/0 gnr web daemon

Start with Prometheus metrics:

GNR_DAEMON_METRICS_PORT=9090 gnr web daemon

Configuration

The daemon resolves configuration from these sources, in order of precedence:

  1. CLI flags (-H, -P, -K, …)
  2. Environment variables (GNR_DAEMON_HOST, GNR_DAEMON_PORT, GNR_DAEMON_BIND, GNR_DAEMON_STORE, …)
  3. environment.xml — Genropy config file, <gnrdaemon> node
  4. Built-in defaults (localhost:40404, in-memory backend)

See docs/environment-variables.md for the full reference.

Storage backends

Backend URL format Use case
In-memory (default) memory: Single-process, no persistence
Redis redis://host:port/db Multi-process, persistence, HA

Set via the GNR_DAEMON_STORE environment variable or the store key in environment.xml.

Prometheus metrics

Install genro-daemon[prometheus] and set GNR_DAEMON_METRICS_PORT:

GNR_DAEMON_METRICS_PORT=9090 gnr web daemon

Prometheus scrapes http://<host>:9090/metrics. A ready-made Grafana dashboard is documented in docs/grafana-dashboard.md.

Performance

Reference benchmarks on a single process with in-memory backend:

Scenario Throughput p99 latency
1 client, sequential ~4,500 req/s ~0.4 ms
10 clients, concurrent ~6,300 req/s ~3 ms

See docs/benchmarking.md for full methodology and results.

Development

# Install in editable mode with all extras
pip install -e ".[redis,prometheus]"

# Run tests (requires a Redis instance on localhost:6379)
pytest

# Lint
ruff check src/ tests/
ruff format --check src/ tests/

Documentation

License

Apache License 2.0 — see LICENSE.

About

Genropy Daemon Implementation

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages