Performance Troubleshooting¶
This guide covers performance optimization, resource usage tuning, and troubleshooting slow or resource-heavy Torrentarr deployments.
Overview¶
Torrentarr is designed to be lightweight and efficient, but performance can degrade with:
- Large libraries (10,000+ movies/series/albums)
- High torrent counts (500+ active torrents)
- Frequent search loops (aggressive automation)
- Resource-constrained environments (Raspberry Pi, low-memory VPS)
- Network latency (slow Arr API responses)
This guide helps identify bottlenecks and optimize Torrentarr for your environment.
Performance Symptoms¶
CPU Usage Issues¶
High CPU (> 50% single core constantly):
- Event loops running too frequently
- Complex regex operations on large file lists
- Database queries without proper indexes
- FFprobe verification on many files simultaneously
CPU Spikes:
- Database updates (normal during library refreshes)
- RSS sync operations
- Search loops triggering simultaneously
- Process restarts
Memory Usage Issues¶
High Memory (> 500 MB):
- Large library metadata cached in memory
- Many concurrent Arr API requests
- Database result sets not paginated
- Log buffer accumulation
Memory Leaks:
- Gradual memory growth over days/weeks
- Not releasing completed torrent references
- WebUI connections not closed properly
Network Issues¶
Slow Arr API Responses:
- Network latency to Arr instances
- Arr instances overloaded (shared with other tools)
- Large API payloads (full library dumps)
Rate Limiting:
- qBittorrent API rate limits
- Arr API throttling (429 errors)
Loop Timer Optimization¶
Event Loop Timers¶
Torrentarr has multiple event loops with configurable timers:
| Loop | Purpose | Config Key | Default | Recommended Range |
|---|---|---|---|---|
| Main Loop | Check torrents, trigger imports | LoopSleepTimer | 5s | 5-60s |
| Search Loop | Delay between individual searches | SearchLoopDelay | -1 (30s) | 10-120s |
| RSS Sync | Refresh RSS feeds | RssSyncTimer | 15min | 5-60min |
| Refresh Downloads | Update queue status | RefreshDownloadsTimer | 1min | 1-15min |
| Stalled Check | Detect stalled torrents | StalledDelay | 15min | 10-60min |
Torrent scan interval and database refresh¶
TorrentScanIntervalSeconds controls completion/import detection and routine torrent policy work for each client. Choose only 5, 15, 30, 60, 90, or 120 seconds; new clients default to 30. Faster scans issue more API requests. Slow operations and backoff can extend the actual interval.
[TorrentClient.local]
TorrentScanIntervalSeconds = 30
[Settings]
LoopSleepTimer = 3600 # Periodic Arr catalog refresh into SQLite
LoopSleepTimer affects catalog refresh cost and catalog freshness independently of torrent response time. Operational writes remain immediate. On migration, missing client scan intervals use the closest allowed interval to the saved legacy timer, capped at 120 seconds.
Search Loop Delay¶
Controls: Delay between individual search commands when processing a batch of searches.
How it works: - When processing multiple missing items (e.g., 10 missing movies), this sets the delay between each individual search - -1 (default): Uses 30 seconds between searches - Positive values: Uses that many seconds between searches
Tuning Guidance:
| Use Case | Recommended Value |
|---|---|
| Most setups (balanced) | -1 (30s default) |
| Fast request processing | 10-15s |
| Rate-limited indexers | 60-120s |
Impact:
- Lower values (5-15s):
- ✅ Faster batch search completion
- ❌ May trigger indexer rate limits
-
❌ Higher indexer API usage
-
Higher values (60-120s):
- ✅ Respects indexer rate limits
- ✅ Lower API usage
- ❌ Slower batch search completion
Example: Processing 10 missing movies: - SearchLoopDelay = -1 → 30s × 10 = 5 minutes total - SearchLoopDelay = 10 → 10s × 10 = 1.7 minutes total - SearchLoopDelay = 60 → 60s × 10 = 10 minutes total
Search Frequency vs Search Delay
SearchLoopDelay controls the delay between individual searches in a batch. To control how often search loops run, use per-Arr SearchRequestsEvery settings.
Trigger searches manually via:
- WebUI "Search" buttons
- Arr instance manual search
- External automation (cron, scripts)
RSS Sync Timer¶
Controls: How often Torrentarr triggers RSS feed refreshes in Arr instances.
Tuning Guidance:
| Use Case | Recommended Timer |
|---|---|
| High-priority (new releases) | 5-10 min |
| Normal priority | 15-30 min |
| Low priority (backlog only) | 60 min |
| Disabled (Arr handles RSS) | 0 (disabled) |
Impact:
- Lower values:
- ✅ Faster new release detection
- ❌ More Arr API requests
-
❌ Higher CPU during sync
-
Higher values:
- ✅ Reduced Arr API load
- ❌ Slower new release detection
Let Arr Handle RSS
If your Arr instance already has RSS configured with its own timer, you can disable Torrentarr's RSS sync:
```toml [Radarr-Movies] RssSyncTimer = 0
```
Refresh Downloads Timer¶
Controls: How often Torrentarr refreshes the download queue in Arr.
Tuning Guidance:
| Queue Activity | Recommended Timer |
|---|---|
| High (many downloads) | 1-2 min |
| Moderate | 5 min |
| Low (few downloads) | 10-15 min |
| Disabled (instant imports only) | 0 |
Impact:
- Lower values:
- ✅ Faster queue status updates
-
❌ More Arr API requests
-
Higher values:
- ✅ Reduced Arr API load
- ❌ Slower queue status updates
Resource Optimization¶
CPU Optimization¶
1. Reduce Loop Frequency¶
[Settings]
LoopSleepTimer = 30 # Increase from default 5s
SearchLoopDelay = 60 # Increase delay between searches to 60s
[Radarr-Movies]
RssSyncTimer = 30 # Increase from default 15 min
RefreshDownloadsTimer = 5 # Increase from default 1 min
SearchMissing = false # Disable automated missing searches
2. Limit Concurrent Operations¶
Reduces CPU spikes during request processing.
3. Disable Expensive Features¶
Caution: Disabling FFprobe allows corrupted files to import.
4. Optimize Regex¶
Complex regex patterns in file exclusions can slow down file processing:
# ❌ Slow: Multiple complex patterns
[Settings.Files]
FileNameExclusionRegEx = [
'(?i)\\b(sample|trailer|extra|bonus|featurette)\\b.*',
'(?i).*\\b(behind[\\s.-]*the[\\s.-]*scenes|deleted[\\s.-]*scenes)\\b.*',
# ... many more
]
# ✅ Fast: Simplified patterns
Use FileExtensionAllowlist to filter by extension first (faster):
Memory Optimization¶
1. Limit Log Retention¶
[Settings]
LogLevel = "INFO" # Reduce from DEBUG
MaximumRollingLogFiles = 5 # Default 10
MaximumRollingLogSize = 10485760 # 10MB (default 50MB)
2. Disable WebUI Live Updates¶
Reduces memory used by WebUI caching.
3. Use Docker Memory Limits¶
4. Restart Torrentarr Periodically¶
For long-running instances (weeks/months), restart Torrentarr to clear accumulated memory:
Network Optimization¶
1. Use Docker Network¶
Place Torrentarr, qBittorrent, and Arr instances in the same Docker network:
networks:
mediastack:
services:
qbittorrent:
networks:
- mediastack
radarr:
networks:
- mediastack
torrentarr:
networks:
- mediastack
Benefits:
- ✅ Low latency (internal network)
- ✅ No external network overhead
- ✅ Faster API responses
2. Increase API Timeouts¶
If Arr instances are slow, increase timeouts:
3. Reduce Concurrent Requests¶
Limit simultaneous searches to avoid overwhelming Arr:
Database Optimization¶
VACUUM Database¶
Reclaim space and optimize SQLite:
# Stop Torrentarr
docker stop torrentarr
# Vacuum database
docker run --rm -v /path/to/config:/config -it alpine sh -c "apk add sqlite && sqlite3 /config/torrentarr.db 'VACUUM;'"
# Restart
docker start torrentarr
Run monthly for large libraries.
ANALYZE Statistics¶
Update query planner statistics:
Run after major library changes (1000+ new entries).
Database Size Monitoring¶
# Check database size
docker exec torrentarr ls -lh /config/torrentarr.db
# Check WAL size
docker exec torrentarr ls -lh /config/torrentarr.db-wal
If database exceeds 500 MB, consider:
- Vacuuming to reclaim space
- Checking for duplicate entries
- Reviewing historical data retention
Large Library Handling¶
10,000+ Items¶
Symptoms:
- Database updates take minutes
- High memory usage (> 300 MB)
- Slow WebUI Arr views
Optimizations:
[Settings]
LoopSleepTimer = 30 # Less frequent catalog refreshes
SearchLoopDelay = 60 # Increase delay between searches
[Radarr-Movies]
RssSyncTimer = 60 # Slower RSS sync
RefreshDownloadsTimer = 10 # Slower queue refresh
SearchMissing = false # Disable automated searches
WebUI:
Disable live Arr views:
Database:
- Run
VACUUMmonthly - Run
ANALYZEafter major updates - Monitor database size
500+ Active Torrents¶
Symptoms:
- qBittorrent API slow (> 1s responses)
- High CPU during torrent checks
- Frequent loop delays
Optimizations:
[Settings]
LoopSleepTimer = 60 # Refresh the Arr catalog once per minute
NoInternetSleepTimer = 300 # Longer delay on connection issues
qBittorrent:
- Enable "Limit upload rate" in qBit to reduce network overhead
- Use categories to organize torrents
- Remove completed torrents promptly
Multiple Arr Instances¶
Symptoms:
- Event loops overlap, causing CPU spikes
- Database lock contention
- Memory usage proportional to instance count
Optimizations:
Stagger timers across instances:
[Radarr-Movies]
RssSyncTimer = 15 # Sync at :00, :15, :30, :45
[Sonarr-TV]
RssSyncTimer = 20 # Sync at :00, :20, :40
[Lidarr-Music]
RssSyncTimer = 25 # Sync at :00, :25, :50
This prevents all instances syncing simultaneously.
Monitoring Performance¶
CPU and Memory¶
# Docker stats
docker stats torrentarr
# Output:
# CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM %
# abc123... torrentarr 5.2% 256MiB / 2GiB 12.5%
Expected Values:
| Metric | Idle | Active | High Load |
|---|---|---|---|
| CPU | < 5% | 10-20% | 30-50% |
| Memory | 50-150 MB | 150-300 MB | 300-500 MB |
Alerts:
- CPU > 50% sustained → Reduce loop frequency
- Memory > 500 MB → Check for leaks, restart Torrentarr
- Memory growth > 10 MB/hour → Potential memory leak
Event Loop Delays¶
Check logs for delay messages:
Example Output:
[Radarr-Movies] Delaying loop by 300 seconds (qbit connection error)
[Sonarr-TV] Delaying search loop by 600 seconds (no internet)
Causes:
type=qbit→ qBittorrent connection issuestype=internet→ Network connectivity problemstype=delay→ Manual delay (e.g., rate limiting)type=no_downloads→ No active downloads (idle)
API Response Times¶
Enable debug logging to see API timings:
Example:
[Radarr-Movies] API request: GET /api/v3/movie (1.2s)
[Sonarr-TV] API request: GET /api/v3/queue (0.8s)
Normal Response Times:
- < 1s: Healthy
- 1-3s: Acceptable (large libraries)
-
3s: Slow (consider optimizing Arr or network)
Troubleshooting Slow Performance¶
Step 1: Identify Bottleneck¶
- Check CPU usage:
If CPU > 30%, proceed to "CPU Optimization"
- Check memory usage:
If memory > 400 MB, proceed to "Memory Optimization"
- Check event loop delays:
If frequent delays, check qBittorrent/Arr connectivity
- Check database size:
If > 500 MB, run VACUUM
Step 2: Apply Optimizations¶
Based on bottleneck:
CPU:
- Increase
LoopSleepTimerto 30-60s - Increase
SearchLoopDelayto 60-120s - Disable automated searches (
SearchMissing = false) - Increase
RssSyncTimerto 30-60 min
Memory:
- Set
LogLevel = "INFO" - Disable
WebUI.LiveArr - Restart Torrentarr
Network:
- Check Arr API response times
- Use Docker network (same host)
- Increase timeouts
Database:
- Run
VACUUM - Run
ANALYZE - Check for duplicate entries
Step 3: Monitor Improvement¶
After changes, monitor for 1-2 hours:
# Watch CPU/memory in real-time
docker stats torrentarr
# Tail logs for errors
docker logs -f torrentarr
Expected improvements:
- CPU drops by 50-70%
- Memory stabilizes (no growth)
- Fewer delay messages in logs
Resource-Constrained Environments¶
Raspberry Pi¶
Hardware:
- Raspberry Pi 4 (2GB+ RAM)
- SD card or USB SSD (faster I/O)
Configuration:
[Settings]
LoopSleepTimer = 60 # Less frequent catalog refreshes
SearchLoopDelay = 120 # Long delay between searches
LogLevel = "INFO" # Minimal logging
FFprobeAutoUpdate = false # Skip verification
[Radarr-Movies]
RssSyncTimer = 60 # Slow RSS sync
RefreshDownloadsTimer = 15 # Slow queue refresh
SearchMissing = false # Disable automated searches
[WebUI]
LiveArr = false # Disable live updates
Docker Memory Limit:
Low-Memory VPS¶
Hardware:
- 512 MB - 1 GB RAM
- Shared CPU
Configuration:
[Settings]
LoopSleepTimer = 30
SearchLoopDelay = 60 # Moderate delay between searches
MaximumRollingLogFiles = 3 # Reduce log storage
MaximumRollingLogSize = 5242880 # 5MB logs
[Radarr-Movies]
SearchMissing = false # Disable automated searches
[WebUI]
LiveArr = false
Swap Configuration:
# Add swap file (1GB)
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Advanced Tuning¶
Multi-Core Utilization¶
Torrentarr uses pathos.multiprocessing to run each Arr instance in a separate process:
- 1 Arr instance → 1 process (single core)
- 3 Arr instances → 3 processes (up to 3 cores)
CPU Limit:
Process Priority¶
Lower Torrentarr's process priority:
I/O Scheduling¶
For systems with high disk I/O:
Performance Benchmarks¶
Baseline Performance¶
Typical resource usage (default config):
| Library Size | CPU (idle) | CPU (active) | Memory | DB Size |
|---|---|---|---|---|
| 500 items | 2-5% | 10-15% | 80-120 MB | 5-10 MB |
| 5,000 items | 3-8% | 15-25% | 150-200 MB | 50-100 MB |
| 50,000 items | 5-15% | 25-40% | 300-400 MB | 500 MB - 1 GB |
Optimized Performance¶
After tuning (slow timers, disabled features):
| Library Size | CPU (idle) | CPU (active) | Memory | DB Size |
|---|---|---|---|---|
| 500 items | 1-2% | 5-8% | 60-80 MB | 5-10 MB |
| 5,000 items | 1-3% | 8-12% | 100-150 MB | 50-100 MB |
| 50,000 items | 2-5% | 12-20% | 200-300 MB | 500 MB - 1 GB |
Quick Reference¶
Performance Checklist¶
-
LoopSleepTimerappropriate for library size -
SearchLoopDelayset to 30-120s (or use default -1) - Automated searches disabled if not needed (
SearchMissing = false) -
RssSyncTimerset to 30-60 min -
RefreshDownloadsTimerset to 5-15 min -
LogLevelset to INFO (not DEBUG) -
WebUI.LiveArrdisabled for large libraries - Database vacuumed monthly
- Docker memory limits configured
- Docker network used (same host setup)
Recommended Configurations¶
Small Library (< 1,000 items, < 50 torrents)¶
[Settings]
LoopSleepTimer = 5
SearchLoopDelay = -1 # Default 30s between searches
LogLevel = "INFO"
[Radarr-Movies]
RssSyncTimer = 15
RefreshDownloadsTimer = 1
Medium Library (1,000-10,000 items, 50-200 torrents)¶
[Settings]
LoopSleepTimer = 15
SearchLoopDelay = 60 # 60s between searches
LogLevel = "INFO"
[Radarr-Movies]
RssSyncTimer = 30
RefreshDownloadsTimer = 5
Large Library (> 10,000 items, > 200 torrents)¶
[Settings]
LoopSleepTimer = 60
SearchLoopDelay = 120 # 120s between searches
LogLevel = "INFO"
MaximumRollingLogFiles = 5
[Radarr-Movies]
RssSyncTimer = 60
RefreshDownloadsTimer = 10
SearchMissing = false # Disable automated searches
[WebUI]
LiveArr = false
Related Documentation¶
- Debug Logging - Log analysis for performance issues
- Database Troubleshooting - Database optimization
- Common Issues - General troubleshooting
- Configuration Reference - Full config options
External Resources¶
- SQLite Performance Tuning - Official SQLite docs
- Docker Resource Limits - Docker documentation