Advanced Topics¶
Advanced configuration and usage patterns for experienced qBitrr users.
Architecture¶
System Design¶
qBitrr uses a multi-process architecture:
- Main Process - Orchestrates worker processes
- WebUI Process - Serves the web interface
- Arr Manager Processes - One per configured Arr instance
- Background Threads - For network monitoring, auto-updates, etc.
Data Flow¶
qBittorrent → qBitrr → Process Torrents → Arr Instance
↓ ↓ ↓
Torrent Data Health Checks Import to Library
Database¶
qBitrr uses SQLite for persistent state:
- Location:
~/config/qBitrr.db - Tables:
downloads- Tracked torrent informationsearches- Search activity historyexpiry- Entry expiration tracking
Backup:
Performance Tuning¶
Optimize Check Intervals¶
Balance responsiveness vs. resource usage:
[Settings]
# How often to check torrents (seconds)
CheckInterval = 60 # Default
# Reduce for faster response (more CPU)
CheckInterval = 30
# Increase for lower resource usage
CheckInterval = 300
Concurrent Operations¶
Limit concurrent health checks:
Memory Usage¶
For systems with limited RAM:
[Settings]
# Reduce log retention
LogRetentionDays = 7
# Limit torrent history
TorrentHistoryDays = 30
Custom Tracker Configuration¶
Tracker-Specific Settings¶
Configure behavior per tracker:
[[Settings.TrackerRules]]
Tracker = "tracker.example.com"
MaxETA = 3600 # 1 hour in seconds
MinRatio = 1.0
MinSeedTime = 86400 # 24 hours
Private Tracker Optimization¶
For private trackers with strict requirements:
[[Settings.TrackerRules]]
Tracker = "privatehd.tracker"
MaxETA = 7200 # Allow longer download times
MinRatio = 1.5 # Higher ratio requirement
MinSeedTime = 259200 # 3 days minimum seed
AutoDelete = false # Never auto-delete
FFprobe Integration¶
Media Validation¶
qBitrr can validate media files before import:
Benefits: - Detect corrupt files before import - Verify codec compatibility - Check for audio/video tracks - Validate container format
FFprobe Rules¶
Configure what qBitrr checks:
[Settings.FFprobe]
CheckVideoCodec = true
CheckAudioCodec = true
CheckDuration = true
MinDuration = 60 # Reject files shorter than 1 minute
Event Loops¶
Understanding the Event Loop¶
Each Arr instance runs its own event loop:
- Check Phase - Query torrents from qBittorrent
- Process Phase - Evaluate health, check status
- Action Phase - Import, blacklist, or re-search
- Sleep Phase - Wait for next check interval
Loop Delays¶
Control delays between operations:
[[Radarr]]
DelayAfterImport = 60 # Wait 60s after import
DelayAfterSearch = 300 # Wait 5m after search
Multi-Instance Patterns¶
Quality Tiers¶
Separate instances for different quality levels:
[[Radarr]]
Name = "Radarr-4K"
URI = "http://localhost:7878"
APIKey = "key1"
Category = "movies-4k"
QualityProfile = "Ultra HD"
[[Radarr]]
Name = "Radarr-1080p"
URI = "http://localhost:7879"
APIKey = "key2"
Category = "movies-1080p"
QualityProfile = "HD-1080p"
Content Separation¶
Different instances for different content types:
[[Sonarr]]
Name = "Sonarr-TV"
URI = "http://localhost:8989"
Category = "tv"
[[Sonarr]]
Name = "Sonarr-Anime"
URI = "http://localhost:8990"
Category = "anime"
AnimeMode = true # Special anime handling
Database Maintenance¶
Automatic Cleanup¶
qBitrr automatically cleans old data:
[Settings]
RetentionDays = 30 # Keep data for 30 days
AutoVacuum = true # Automatically vacuum database
Manual Vacuum¶
Optimize database size:
Recovery¶
If database becomes corrupt:
# qBitrr has automatic recovery
# Check logs for recovery messages
# Or manually delete and regenerate:
rm ~/config/qBitrr.db
Network Optimization¶
Connection Pooling¶
qBitrr reuses HTTP connections:
Retry Logic¶
Configure retry behavior:
[Settings]
MaxRetries = 3
RetryDelay = 5 # Seconds between retries
BackoffMultiplier = 2 # Exponential backoff
Security Hardening¶
API Security¶
Protect the WebUI with authentication:
Generate a secure token:
Network Security¶
Bind to specific interfaces:
Or for Docker:
Logging Configuration¶
Log Levels¶
Levels: - DEBUG - Everything (very verbose) - INFO - Normal operations - WARNING - Potential issues - ERROR - Errors that don't stop execution - CRITICAL - Fatal errors
Log Rotation¶
Separate Log Files¶
Each Arr instance gets its own log file:
~/config/logs/
├── Main.log
├── WebUI.log
├── Radarr-Main.log
├── Sonarr-TV.log
└── Lidarr-Music.log
Custom Scripts¶
Pre/Post Hooks¶
Run custom scripts before or after operations:
Script receives: - $1 - Torrent hash - $2 - Torrent name - $3 - Arr instance name - $4 - Media ID
Monitoring & Alerting¶
Health Checks¶
External monitoring can check:
# Check if qBitrr is running
curl http://localhost:6969/api/health
# Expected response:
{"status": "healthy", "version": "5.5.5"}
Metrics¶
Future feature: Prometheus metrics endpoint
Experimental Features¶
Features Under Development¶
Check configuration for experimental flags:
Warning: Experimental features may change or be removed in future versions.
Performance Monitoring¶
Built-in Profiling¶
Enable profiling for performance analysis:
Resource Monitoring¶
Monitor resource usage:
Disaster Recovery¶
Backup Strategy¶
What to backup:
- Configuration:
~/config/config.toml - Database:
~/config/qBitrr.db - Logs (optional):
~/config/logs/
Restore Procedure¶
- Stop qBitrr
- Restore config and database
- Start qBitrr
- Verify in logs that restore was successful
Advanced Troubleshooting¶
Enable Debug Logging¶
Trace Specific Torrents¶
Follow a torrent through the system:
Database Inspection¶
Query the database directly:
sqlite3 ~/config/qBitrr.db
sqlite> SELECT * FROM downloads WHERE hash = 'torrent_hash';
sqlite> .quit
Contributing¶
Want to add advanced features?
- See Development Guide
- Review AGENTS.md
- Join discussions on GitHub