Local Development Deployment
Running Felix directly on your machine: build it, start a broker, point clients at it, and switch between the configurations development actually needs.
Prerequisites
Section titled “Prerequisites”Before running Felix locally, ensure you have:
- Rust 1.97.1 or later: Install via rustup
- Git: For cloning the repository
- Optional: Task for convenience commands
- At least 4GB RAM: Recommended for comfortable development
- Ports available: Default ports 5000 (QUIC) and 8080 (metrics)
Quick Start
Section titled “Quick Start”Clone and Build
Section titled “Clone and Build”# Clone the repositorygit clone https://github.com/gabloe/felix.gitcd felix
# Build the workspace in release modecargo build --workspace --releaseStart the Broker
Section titled “Start the Broker”Run the broker with default settings:
cargo run --release -p brokerExpected output:
2026-01-25T10:00:00.000Z INFO felix_broker: Starting Felix broker2026-01-25T10:00:00.001Z INFO felix_broker: QUIC listening on 0.0.0.0:50002026-01-25T10:00:00.001Z INFO felix_broker: Metrics server on 0.0.0.0:8080The broker is now accepting connections on:
- QUIC data plane:
0.0.0.0:5000(UDP) - Metrics/health HTTP:
0.0.0.0:8080(TCP)
Verify the Broker
Section titled “Verify the Broker”Check that the broker is running:
# Check QUIC listener (requires lsof or ss)lsof -i UDP:5000
# Check metrics endpointcurl http://localhost:8080/healthzConfiguration Methods
Section titled “Configuration Methods”Felix supports three configuration methods, applied in this order (later sources override earlier ones):
- Built-in defaults: Sensible defaults for local development
- Environment variables: Quick overrides via
FELIX_*variables - YAML config file: Structured configuration for complex setups
Using Environment Variables
Section titled “Using Environment Variables”The simplest way to configure Felix locally:
# Change broker portsexport FELIX_QUIC_BIND="0.0.0.0:5001"export FELIX_BROKER_METRICS_BIND="0.0.0.0:8081"
# Enable publish acknowledgementsexport FELIX_ACK_ON_COMMIT="true"
# Tune batching for lower latencyexport FELIX_EVENT_BATCH_MAX_DELAY_US="100"
# Run broker with custom configcargo run --release -p brokerUsing a Config File
Section titled “Using a Config File”For more complex configurations, create a YAML file:
/tmp/felix-dev.yml:
# Network bindingsquic_bind: "0.0.0.0:5000"metrics_bind: "0.0.0.0:8080"
# Optional control planecontrolplane_url: "http://localhost:8443"controlplane_sync_interval_ms: 2000
# Publishing behaviorack_on_commit: falsemax_frame_bytes: 16777216 # 16 MiB
# Timeoutspublish_queue_wait_timeout_ms: 2000ack_wait_timeout_ms: 2000control_stream_drain_timeout_ms: 50
# Cache flow controlcache_conn_recv_window: 268435456 # 256 MiBcache_stream_recv_window: 67108864 # 64 MiBcache_send_window: 268435456 # 256 MiB
# Event batchingevent_batch_max_events: 64event_batch_max_bytes: 65536 # 64 KiBevent_batch_max_delay_us: 250
# Fanout and workersfanout_batch_size: 64pub_workers_per_conn: 4pub_queue_depth: 64subscriber_queue_capacity: 512subscriber_writer_lanes: 4subscriber_lane_queue_depth: 64max_subscriber_writer_lanes: 8subscriber_lane_shard: auto
# Performancedisable_timings: falseRun with custom config:
FELIX_BROKER_CONFIG=/tmp/felix-dev.yml cargo run --release -p brokerCommon Development Scenarios
Section titled “Common Development Scenarios”Scenario 1: Low-Latency Testing
Section titled “Scenario 1: Low-Latency Testing”Optimize for minimum latency (single subscriber, small batches):
export FELIX_EVENT_BATCH_MAX_DELAY_US="50"export FELIX_EVENT_BATCH_MAX_EVENTS="1"export FELIX_FANOUT_BATCH="1"export FELIX_DISABLE_TIMINGS="1"
cargo run --release -p brokerScenario 2: High-Throughput Testing
Section titled “Scenario 2: High-Throughput Testing”Optimize for maximum throughput (large batches, higher fanout):
export FELIX_EVENT_BATCH_MAX_DELAY_US="1000"export FELIX_EVENT_BATCH_MAX_EVENTS="256"export FELIX_EVENT_BATCH_MAX_BYTES="1048576" # 1 MiBexport FELIX_FANOUT_BATCH="128"
cargo run --release -p brokerScenario 3: Multi-Client Development
Section titled “Scenario 3: Multi-Client Development”Run multiple clients connecting to the same broker:
# Terminal 1: Start brokercargo run --release -p broker
# Terminal 2: Run subscriber democargo run --release -p broker --bin pubsub-demo-simple
# Terminal 3: Run another clientcargo run --release -p broker --bin cache-demoScenario 4: Testing Control Plane Integration
Section titled “Scenario 4: Testing Control Plane Integration”Set up broker to connect to a local control plane:
export FELIX_CONTROLPLANE_URL="http://localhost:8443"export FELIX_CONTROLPLANE_SYNC_INTERVAL_MS="1000"# A Felix token carrying node.view:cluster:*; the metadata feeds refuse# anything else. See "Broker credential" on the Docker Compose page for how# bootstrap and token exchange produce one.export FELIX_NODE_TOKEN="<felix token>"
cargo run --release -p brokerPerformance Profiles
Section titled “Performance Profiles”Felix includes pre-tuned performance profiles for different use cases:
Balanced Profile (Default)
Section titled “Balanced Profile (Default)”Good starting point for mixed workloads:
export FELIX_EVENT_CONN_POOL="8"export FELIX_EVENT_CONN_RECV_WINDOW="268435456"export FELIX_EVENT_STREAM_RECV_WINDOW="67108864"export FELIX_EVENT_SEND_WINDOW="268435456"export FELIX_EVENT_BATCH_MAX_DELAY_US="250"export FELIX_CACHE_CONN_POOL="8"export FELIX_CACHE_STREAMS_PER_CONN="4"
cargo run --release -p brokerHigh-Memory Profile
Section titled “High-Memory Profile”For burst tolerance with more memory:
export FELIX_EVENT_CONN_POOL="8"export FELIX_EVENT_CONN_RECV_WINDOW="536870912" # 512 MiBexport FELIX_EVENT_STREAM_RECV_WINDOW="134217728" # 128 MiBexport FELIX_EVENT_SEND_WINDOW="536870912" # 512 MiBexport FELIX_EVENT_BATCH_MAX_DELAY_US="250"export FELIX_CACHE_CONN_POOL="8"export FELIX_CACHE_STREAMS_PER_CONN="4"export FELIX_DISABLE_TIMINGS="1"
cargo run --release -p brokerRunning Demos
Section titled “Running Demos”Felix includes several demonstration programs:
Pub/Sub Demo
Section titled “Pub/Sub Demo”cargo run --release -p broker --bin pubsub-demo-simpleDemonstrates:
- Subscribing to a stream
- Publishing messages
- Receiving events with fanout
Cache Demo
Section titled “Cache Demo”cargo run --release -p broker --bin cache-demoBenchmarks cache operations:
putwith TTLget_hit(key exists)get_miss(key doesn’t exist)
Latency Demo
Section titled “Latency Demo”# Basic runcargo run --release -p broker --bin latency-demo
# Custom configurationcargo run --release -p broker --bin latency-demo -- \ --binary \ --fanout 10 \ --batch 64 \ --payload 4096 \ --total 10000 \ --warmup 500Parameters:
--binary: Use binary batch encoding (higher throughput)--fanout N: Number of concurrent subscribers--batch N: Messages per batch--payload N: Payload size in bytes--total N: Total messages to publish--warmup N: Warmup messages before measurement
Scenario Demos
Section titled “Scenario Demos”Notifications (Multi-tenant alerts)
Section titled “Notifications (Multi-tenant alerts)”cargo run --release -p broker --bin pubsub-demo-notificationsOptional flags: --alerts=10, --last-n=5, --drop-subscriber.
Orders/Payments Pipeline
Section titled “Orders/Payments Pipeline”cargo run --release -p broker --bin pubsub-demo-ordersOptional flags: --orders=12, --duplicate-every=5, --kill-worker=payments.
Live RBAC Policy Change
Section titled “Live RBAC Policy Change”cargo run --manifest-path demos/rbac-live/Cargo.tomlDemonstrates live RBAC updates via the control plane with real token exchange and broker authorization. Uses an in-memory control-plane store (no Postgres required).
Cross-Tenant Isolation
Section titled “Cross-Tenant Isolation”cargo run --manifest-path demos/cross_tenant_isolation/Cargo.tomlDemonstrates that tokens minted for one tenant cannot access another tenant’s
resources, even when the same upstream identity is used.
Uses a Postgres-backed control plane (requires task pg:up or an external DB).
Using Task Commands
Section titled “Using Task Commands”If you have Task installed:
# Build workspacetask build
# Run teststask test
# Run lintertask lint
# Format codetask fmt
# Run demostask demo:pubsubtask demo:cachetask demo:latencytask demo:notificationstask demo:orderstask demo:rbac-livetask demo:cross-tenant-isolation
# Run conformance teststask conformance
# Generate coverage reporttask coverageSee Taskfile.yml for all available tasks.
Monitoring Local Development
Section titled “Monitoring Local Development”Metrics Endpoint
Section titled “Metrics Endpoint”The broker exposes metrics on the HTTP port:
# Health checkcurl http://localhost:8080/healthz
# Prometheus metrics (if enabled)curl http://localhost:8080/metricsStructured Logging
Section titled “Structured Logging”Felix logs in structured format to stdout:
2026-01-25T10:00:01.123Z INFO felix_broker: Connection accepted remote_addr=127.0.0.1:543212026-01-25T10:00:01.456Z INFO felix_broker: Subscription created tenant=dev namespace=test stream=events2026-01-25T10:00:02.789Z WARN felix_broker: Publish queue pressure queue_depth=512Control log verbosity with RUST_LOG:
# Debug level (verbose)export RUST_LOG="debug"
# Info level (default)export RUST_LOG="info"
# Specific moduleexport RUST_LOG="felix_broker=debug,felix_wire=trace"
cargo run --release -p brokerTroubleshooting
Section titled “Troubleshooting”Port Already in Use
Section titled “Port Already in Use”Error: Address already in use (os error 48)
Solution: Change the ports:
export FELIX_QUIC_BIND="0.0.0.0:5001"export FELIX_BROKER_METRICS_BIND="0.0.0.0:8081"Build Failures
Section titled “Build Failures”Error: Compilation errors or missing dependencies
Solution: Ensure correct Rust version:
rustc --version # Should be 1.97.1 or laterrustup updatecargo cleancargo build --releaseConnection Refused
Section titled “Connection Refused”Error: Client cannot connect to broker
Solution: Verify broker is running and listening:
# Check processesps aux | grep broker
# Check UDP listenerlsof -i UDP:5000
# Check logsRUST_LOG=debug cargo run --release -p brokerHigh Memory Usage
Section titled “High Memory Usage”Issue: Broker consuming excessive memory
Solution: Reduce window sizes:
export FELIX_EVENT_CONN_RECV_WINDOW="134217728" # 128 MiBexport FELIX_EVENT_STREAM_RECV_WINDOW="33554432" # 32 MiBexport FELIX_CACHE_CONN_RECV_WINDOW="134217728"Slow Performance
Section titled “Slow Performance”Issue: Unexpectedly high latency
Solution:
- Use release builds: Debug builds are 10-100x slower
- Disable timings:
export FELIX_DISABLE_TIMINGS="1" - Check batching: Increase batch sizes for throughput
- Profile with
perf: Identify hot paths
cargo build --releaseFELIX_DISABLE_TIMINGS=1 cargo run --release -p brokerNext Steps
Section titled “Next Steps”- Learn the client API: Client SDK Guide
- Deploy with Docker: Docker Compose Setup
- Production deployment: Kubernetes Guide
- Tune performance: Performance Guide
- Configure fully: Configuration Reference
