Performance Troubleshooting
Diagnose and fix performance problems on Pimeleon router
Performance Troubleshooting
"The speed of your system is inversely proportional to the urgency of your need." - Murphy's Law of Computing
Is your Pimeleon router running slower than expected? This guide helps identify and resolve performance issues.
Expected Performance
Typical Benchmarks
Raspberry Pi 4 / Pi 5:
- Throughput: Excellent performance for gigabit connections (wired)
- WiFi Speed: 50-100 Mbps (2.4 GHz)
- Latency: < 2ms (local), 10-30ms (internet)
- Max Clients: Typical home network device count
Raspberry Pi 3B+:
- Throughput: Suitable for broadband connections (wired, USB 2.0 bus limitation creates a performance ceiling)
- WiFi Speed: 40-80 Mbps (2.4 GHz)
- Latency: < 5ms (local), 10-30ms (internet)
- Max Clients: Typical home network device count
Quick Performance Check
Run these commands to assess current performance:
ssh pi@your-router-ip
# Check system load
uptime
# Load should be < 1.0 per CPU core
# Check temperature
vcgencmd measure_temp
# Should be < 70°C
# Check memory
free -h
# Should have > 100MB free
# Check CPU throttling
vcgencmd get_throttled
# 0x0 = no throttling
Slow Internet Speed
Test Your Speed
From client device:
# Install speedtest-cli
pip install speedtest-cli
# Run speed test
speedtest-cli
From router:
ssh pi@your-router-ip
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -
Common Causes
1. ISP Speed Limitation
- Test speed directly from modem (bypass router)
- If similar speeds, ISP is the bottleneck
2. WiFi Interference
# Scan for nearby networks
iwlist wlan0 scan | grep -E "Channel|Signal"
# Switch to less crowded channel (1, 6, or 11)
sudo nano /etc/hostapd/hostapd.conf
# Change channel= line
sudo systemctl restart hostapd
3. Too Many Connected Devices
# Count active connections
arp -n | grep -v incomplete | wc -l
# View bandwidth usage by device
sudo iftop -i eth1
4. CPU Bottleneck
# Check CPU usage
top
# If consistently > 80%, identify culprit
ps aux --sort=-%cpu | head -10
High Latency (Lag)
Measure Latency
# To router (should be < 5ms)
ping -c 100 192.168.76.1
# To internet gateway (should be < 20ms)
ping -c 100 your-isp-gateway
# To internet (varies by distance)
ping -c 100 8.8.8.8
Diagnose High Latency
If high latency to router itself:
- Check WiFi signal strength
# On device if Linux iwconfig wlan0 # Look for Signal level - Check for buffer bloat
# Test with bufferbloat test # Visit: https://www.waveform.com/tools/bufferbloat - Check CPU load
uptime # If load > CPU cores, system is overloaded
If high latency only to internet:
- Trace route to identify problem
mtr --report 8.8.8.8 # Look for hop with high latency - Check your ISP's gateway
ping your-isp-gateway # If high here, contact ISP
WiFi Performance Issues
Slow WiFi Speed
Test WiFi speed:
# From device connected to WiFi
speedtest-cli
Compare to wired speed:
- Connect same device via Ethernet
- Run speed test again
- WiFi should be 50-70% of wired speed
Optimization steps:
- Change WiFi channel
sudo nano /etc/hostapd/hostapd.conf # Set channel to 1, 6, or 11 channel=6 sudo systemctl restart hostapd - Improve signal strength
- Move router to central location
- Remove obstructions (walls, metal objects)
- Keep away from microwave, cordless phones
- Enable 802.11n optimizations (advanced)
sudo nano /etc/hostapd/hostapd.conf # Add these lines ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40] sudo systemctl restart hostapd
Note: Test thoroughly - may cause compatibility issues with older devices.
WiFi Keeps Dropping
Check connection stability:
# On WiFi device, continuous ping
ping -i 1 192.168.76.1
# Watch for dropped packets
Common fixes:
- iOS device disconnecting (very common)
sudo nano /etc/hostapd/hostapd.conf # Add/verify these lines exist: beacon_int=100 dtim_period=2 ap_max_inactivity=300 skip_inactivity_poll=1 disassoc_low_ack=0 sudo systemctl restart hostapd - Power management issues
# Check WiFi power management iwconfig wlan0 | grep "Power Management" # Disable if enabled sudo iwconfig wlan0 power off - Too many clients
# Count WiFi clients iw dev wlan0 station dump | grep Station | wc -l # If > 30, consider upgrading Pi model
Overheating Issues
Check Temperature
# Current temperature
vcgencmd measure_temp
# Monitor continuously
watch -n 1 vcgencmd measure_temp
Temperature Guidelines:
- < 60°C: Excellent
- 60-70°C: Good
- 70-80°C: Warm (add cooling)
- > 80°C: Hot (throttling likely)
- > 85°C: Critical (add cooling immediately)
Check for Throttling
vcgencmd get_throttled
Output meanings:
0x0: No issues0x1: Under-voltage detected0x2: ARM frequency capped0x4: Currently throttled0x8: Soft temperature limit
Cooling Solutions
- Passive cooling:
- Add heatsinks to CPU and chips
- Use metal case with thermal contact
- Active cooling:
- Install 30mm or 40mm fan
- Use official Pi 4 case with fan
- Improve airflow:
- Don't enclose in tight space
- Keep vents clear
- Position with components facing up
Memory Issues
Check Memory Usage
# Current memory status
free -h
# Processes using most memory
ps aux --sort=-%mem | head -10
Warning signs:
- Swap usage > 100MB
- Available memory < 100MB
- OOM (Out of Memory) errors in logs
Free Up Memory
# Clear caches
sync
echo 3 | sudo tee /proc/sys/vm/drop_caches
# Stop unnecessary services
sudo systemctl stop service-name
# Check for memory leaks
# Monitor process memory over time
watch -n 5 'ps aux | grep process-name'
Disk Performance
Check SD Card Speed
# Write speed test
dd if=/dev/zero of=/tmp/test bs=8k count=10k
# Should be > 10 MB/s
# Read speed test
dd if=/tmp/test of=/dev/null bs=8k
# Should be > 20 MB/s
# Clean up
rm /tmp/test
If slow:
- SD card may be fake or low-quality
- SD card may be failing
- Try different SD card (SanDisk, Samsung recommended)
Check Disk Space
# Overall disk usage
df -h
# Find large directories
du -sh /* 2>/dev/null | sort -h
# Clean up if needed
sudo apt clean
sudo apt autoremove
sudo journalctl --vacuum-time=7d
Network Bandwidth Saturation
Monitor Real-Time Traffic
# Install monitoring tools
sudo apt install iftop nethogs
# Monitor interface bandwidth
sudo iftop -i eth1
# Monitor by process
sudo nethogs
Identify Bandwidth Hogs
# Active connections
ss -tuanp | grep ESTAB
# Connections by IP
ss -tan | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
# Check for excessive connections
conntrack -C
Limit Bandwidth (QoS)
# Basic traffic shaping
sudo apt install wondershaper
# Limit interface to 50 Mbps down, 10 Mbps up
sudo wondershaper eth1 51200 10240
# Remove limits
sudo wondershaper clear eth1
DNS Performance
Test DNS Speed
# Measure DNS query time
time nslookup google.com
# Should be < 100ms
Optimize DNS
DNS Filtering:
# Update gravity database
pihole -g
# Clear cache
pihole restartdns
# Check blocked queries aren't slowing down
pihole -c
If using BIND:
# Flush cache
sudo rndc flush
# Check forwarders are responsive
dig @8.8.8.8 google.com
# Consider changing forwarders
sudo nano /etc/bind/named.conf.options
Multiple Devices Slow
Check Connection Limit
# Current connections
conntrack -C
# Maximum connections
cat /proc/sys/net/netfilter/nf_conntrack_max
# Increase if needed (requires reboot)
echo "net.netfilter.nf_conntrack_max=65536" | sudo tee -a /etc/sysctl.conf
Verify DHCP Isn't Exhausted
# Check active leases
sudo cat /var/lib/dhcp/dhcpd.leases | grep lease | wc -l
# Check configured range
sudo grep range /etc/dhcp/dhcpd.conf
# Expand range if needed
Optimization Tips
System Optimizations
# Disable unnecessary services
sudo systemctl disable bluetooth
sudo systemctl disable hciuart
# Optimize network stack
sudo sysctl -w net.core.rmem_max=134217728
sudo sysctl -w net.core.wmem_max=134217728
# Make permanent
echo "net.core.rmem_max=134217728" | sudo tee -a /etc/sysctl.conf
echo "net.core.wmem_max=134217728" | sudo tee -a /etc/sysctl.conf
WiFi Optimizations
sudo nano /etc/hostapd/hostapd.conf
# Optimize for performance
wmm_enabled=1
ieee80211n=1
require_ht=1
# Restart to apply
sudo systemctl restart hostapd
Hardware Upgrades
When to Upgrade
Consider upgrading if:
- Consistently maxing out CPU (load > cores)
- Regular thermal throttling
- Need high throughput for gigabit connections
- Supporting large network device counts
Recommended Upgrades
- From Pi 3B+ to Pi 4:
- 3x faster CPU
- Gigabit Ethernet (not USB-limited)
- Better thermal performance
- From Pi 4 to Pi 5:
- 2x faster CPU
- Better I/O performance
- Improved thermal management
- SD Card to SSD:
- 10-20x faster disk I/O
- More reliable
- Better for heavy logging
Monitoring Performance
Setup Continuous Monitoring
# Create monitoring script
cat > ~/monitor.sh << 'EOF'
#!/bin/bash
while true; do
clear
echo "=== System Monitor ==="
echo "Time: $(date)"
echo ""
echo "Load: $(uptime | awk -F'load average:' '{print $2}')"
echo "Temp: $(vcgencmd measure_temp)"
echo "Memory: $(free -h | grep Mem | awk '{print $3 "/" $2}')"
echo "Throttled: $(vcgencmd get_throttled)"
echo ""
echo "Top Processes (CPU):"
ps aux --sort=-%cpu | head -5 | awk '{print $11" "$3"%"}'
echo ""
echo "Network:"
ifconfig eth1 | grep "RX packets"
ifconfig eth1 | grep "TX packets"
sleep 5
done
EOF
chmod +x ~/monitor.sh
~/monitor.sh
Getting Help
Collect Performance Data
# Generate performance report
cat > ~/perf-report.txt << EOF
Date: $(date)
Uptime: $(uptime)
Temperature: $(vcgencmd measure_temp)
Throttling: $(vcgencmd get_throttled)
Memory: $(free -h)
Disk: $(df -h /)
Load Average: $(uptime | awk -F'load average:' '{print $2}')
Top CPU Processes:
$(ps aux --sort=-%cpu | head -10)
Top Memory Processes:
$(ps aux --sort=-%mem | head -10)
Network Interfaces:
$(ip -s link show)
Active Connections:
$(ss -s)
EOF
cat ~/perf-report.txt
Related Documentation
- Network Monitoring - Monitor network performance
- System Health - System monitoring
- Common Issues - General troubleshooting
Support
For questions or issues:
- Documentation: docs.pimeleon.com
- Community Forum: community.pimeleon.com
- Discord: Join our support channel