Beam
Performance Guide

Performance Optimization

Beam offers three tunnel modes to balance speed and privacy. Choose the right mode for your use case and optimize performance with caching, circuit prebuilding, and geographic relay selection.

Tunnel Modes

Fast Mode
Direct P2P connection
~30-50ms
Privacy Level

Low - IP visible to peer

Requires Tor

No

beam 3000 --mode=fast
Best for: Local development, trusted team environments, real-time applications, WebSocket testing
Balanced Mode
Single-hop Tor (default)
~80-150ms
Privacy Level

Medium - Server exposed, clients hidden

Requires Tor

Yes

beam 3000 --mode=balanced
Best for: Webhook testing, API development, client demos, general tunneling
Private Mode
Full 3-hop Tor onion routing
~200-500ms
Privacy Level

High - Full anonymity

Requires Tor

Yes

beam 3000 --mode=private
Best for: Sensitive data, journalist/activist use, censorship circumvention, maximum privacy needs

Comparison with Other Tools

ToolTypeEncryptionLatencyPrivacy
Beam (fast)Direct P2PE2E~30-50msLow
Beam (balanced)Single-hop TorE2E + Tor~80-150msMedium
Beam (private)3-hop TorE2E + Tor~200-500msHigh
ngrokCentralizedTLS~50-100msLow
Cloudflare TunnelEdge NetworkTLS + WAF~20-50msLow
TailscaleMesh VPNWireGuard~30-80msMedium
LocalTunnelCentralizedTLS~100-200msLow

Performance Optimizations

Circuit Prebuilding

Pre-establishes Tor circuits before they're needed, eliminating the 2-3 second circuit build time on first request.

beam 3000 --prebuild-circuits=5

Default: 3 circuits. More circuits = faster failover but higher memory.

Response Caching

Caches static assets (JS, CSS, images, fonts) to reduce round-trips through Tor. Especially effective for balanced and private modes.

beam 3000 --cache-size=200beam 3000 --cache-ttl=600

Default: 100MB cache, 300s TTL. Disable with --no-cache.

Geographic Relay Selection

Select Tor relays closer to your location for reduced latency. Uses ISO 3166-1 country codes.

beam 3000 --geo-prefer=US,CA,MX

Not recommended for private mode - reduces anonymity by constraining relay selection.

Persistent Circuits

Keeps Tor circuits alive between requests, avoiding reconnection overhead. Enabled by default in balanced and private modes.

# Automatic - circuits persist for session duration

Circuits automatically rebuild on failure or after extended idle periods.

Best Practices by Use Case

Webhook Development

beam 3000 --mode=balanced --prebuild-circuits=3 --cache-ttl=60

Balanced mode provides .onion address for webhooks while keeping latency reasonable. Lower cache TTL since webhook payloads change frequently.

Real-time Applications

beam 3000 --mode=fast --no-cache

Fast mode with disabled caching for WebSocket and real-time data. Lowest latency but requires trusted network.

Privacy-Sensitive Testing

beam 3000 --mode=private --prebuild-circuits=5 --no-cache

Full Tor anonymity with extra prebuilt circuits for reliability. Caching disabled to prevent data persistence.

High-Traffic Static Sites

beam 3000 --mode=balanced --cache-size=500 --cache-ttl=3600 --geo-prefer=US

Large cache with long TTL for static assets. Geographic optimization for US-based users. Great for demos and presentations.

Performance Troubleshooting

High Latency in Balanced/Private Mode

  • Increase prebuild circuit count: --prebuild-circuits=5
  • Try geographic optimization: --geo-prefer=YOUR_COUNTRY
  • Enable verbose logging to identify bottlenecks: -v
  • Check if Tor is running properly: tor --verify-config

Slow First Request

  • Circuit building takes 2-3 seconds on first connection
  • Enable circuit prebuilding (default) to eliminate this delay
  • Consider fast mode for development where privacy isn't critical

Cache Not Working

  • Only static assets are cached (JS, CSS, images, fonts)
  • Check if your responses include proper Cache-Control headers
  • Private mode disables caching by default for security
  • Increase cache size if serving large assets: --cache-size=200

Performance CLI Options

OptionDefaultDescription
--modebalancedTunnel mode: fast, balanced, or private
--cache-size100Cache size in MB
--cache-ttl300Cache TTL in seconds
--no-cachefalseDisable response caching
--geo-prefer-Preferred relay countries (ISO codes)
--prebuild-circuits3Number of circuits to prebuild
--no-prebuildfalseDisable circuit prebuilding