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.
- 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
- Python 3.11+
- genropy
msgpack,uvloop
pip install genro-daemonWith optional extras:
# Redis backend
pip install "genro-daemon[redis]"
# Prometheus metrics
pip install "genro-daemon[prometheus]"
# Both
pip install "genro-daemon[redis,prometheus]"Start the daemon on the default host/port (localhost:40404):
gnr web daemonStart with custom host and port:
gnr web daemon -H 0.0.0.0 -P 9000Start with Redis storage backend:
GNR_DAEMON_STORE=redis://localhost:6379/0 gnr web daemonStart with Prometheus metrics:
GNR_DAEMON_METRICS_PORT=9090 gnr web daemonThe daemon resolves configuration from these sources, in order of precedence:
- CLI flags (
-H,-P,-K, …) - Environment variables (
GNR_DAEMON_HOST,GNR_DAEMON_PORT,GNR_DAEMON_BIND,GNR_DAEMON_STORE, …) environment.xml— Genropy config file,<gnrdaemon>node- Built-in defaults (
localhost:40404, in-memory backend)
See docs/environment-variables.md for the full reference.
| 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.
Install genro-daemon[prometheus] and set GNR_DAEMON_METRICS_PORT:
GNR_DAEMON_METRICS_PORT=9090 gnr web daemonPrometheus scrapes http://<host>:9090/metrics.
A ready-made Grafana dashboard is documented in docs/grafana-dashboard.md.
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.
# 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/docs/environment-variables.md— all configuration optionsdocs/security.md— HMAC authentication, network hardening, deployment checklistdocs/benchmarking.md— stress-test tool and reference resultsdocs/grafana-dashboard.md— Prometheus + Grafana setup
Apache License 2.0 — see LICENSE.