Performance Optimization Guide
This guide helps you optimize netboot.xyz performance for faster boot times, quicker downloads, and better user experience.
Boot Time Optimization
Network Boot Speed
Reduce PXE Boot Time:
-
Optimize DHCP Response Time:
# In DHCP server configuration:default-lease-time 86400;max-lease-time 86400;# Reduce timeout values:timeout 10;retry 5; -
Use Local TFTP Server:
# Instead of boot.netboot.xyz, use local server:option next-server 192.168.1.100; # Your local serveroption bootfile-name "netboot.xyz.kpxe"; -
Preload Network Drivers:
# Use appropriate bootloader for your hardware:- netboot.xyz.kpxe (includes common drivers)- netboot.xyz-undionly.kpxe (uses BIOS network drivers)- netboot.xyz.efi (UEFI with SNP support)
Menu Loading Optimization
Faster Menu Display:
-
Enable HTTP Compression:
# Nginx configuration:location / {gzip on;gzip_types text/plain application/json text/css application/javascript;gzip_min_length 1000;} -
Use CDN for Static Assets:
# Configure custom endpoints with CDN:https://your-cdn.com/netboot/menus/ -
Optimize Network MTU:
# Test optimal MTU size:ping -f -l 1472 boot.netboot.xyz # Windowsping -M do -s 1472 boot.netboot.xyz # Linux# Set optimal MTU (usually 1500 for Ethernet):sudo ip link set dev eth0 mtu 1500
Download Speed Optimization
Bandwidth Management
Optimize Download Performance:
-
Choose Optimal Mirror:
# Test mirror speeds:curl -w "@curl-format.txt" -o /dev/null https://boot.netboot.xyz/curl -w "@curl-format.txt" -o /dev/null https://github.netboot.xyz/# curl-format.txt content:# time_namelookup: %{time_namelookup}\n# time_connect: %{time_connect}\n# time_total: %{time_total}\n# speed_download: %{speed_download}\n -
Parallel Downloads:
# For custom implementations, use parallel downloads:wget --parallel=4 --continue url1 url2 url3 url4 -
Local Caching:
# Set up local cache with nginx:proxy_cache_path /var/cache/nginx/netbootlevels=1:2keys_zone=netboot:10mmax_size=10ginactive=60muse_temp_path=off;location / {proxy_pass https://boot.netboot.xyz;proxy_cache netboot;proxy_cache_valid 200 24h;proxy_cache_use_stale error timeout updating;}
Self-Hosting Optimization
Local netboot.xyz Instance:
-
Docker Performance Tuning:
# docker-compose.yml optimizations:version: '3.8'services:netbootxyz:image: netbootxyz/netboot.xyzrestart: unless-stoppedenvironment:- MENU_VERSION=2.0.59ports:- "80:80"- "69:69/udp"volumes:- ./config:/config- ./assets:/assets# Performance optimizations:deploy:resources:limits:memory: 2Greservations:memory: 512Msysctls:- net.core.somaxconn=65535 -
Nginx Configuration:
# /config/nginx/site-confs/defaultserver {listen 80;server_name _;# Performance optimizations:sendfile on;tcp_nopush on;tcp_nodelay on;keepalive_timeout 30;# Compression:gzip on;gzip_vary on;gzip_types text/plain text/css application/json application/javascript;# Caching:location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg)$ {expires 1y;add_header Cache-Control "public, immutable";}# Assets location:location /assets/ {alias /assets/;autoindex on;}}
Memory Optimization
RAM Usage Optimization
Reduce Memory Footprint:
-
Choose Lightweight Distributions:
Minimal RAM Requirements:- Alpine Linux: 128MB- Tiny Core Linux: 64MB- Puppy Linux: 256MB- Debian Netinstall: 512MB -
Optimize iPXE Memory Usage:
# Use smaller bootloaders when possible:- netboot.xyz.lkrn: ~500KB (Linux kernel format)- netboot.xyz.kpxe: ~100KB (PXE format)- netboot.xyz.efi: ~200KB (UEFI format) -
Configure Swap for Low-Memory Systems:
# Create swap file for systems with limited RAM:sudo fallocate -l 2G /swapfilesudo chmod 600 /swapfilesudo mkswap /swapfilesudo swapon /swapfile# Make permanent:echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Storage Optimization
Disk Usage Optimization:
-
Clean Downloaded Assets:
# Regularly clean temporary downloads:find /tmp -name "*.iso" -mtime +1 -deletefind /var/cache -name "*.deb" -mtime +7 -delete -
Optimize Asset Storage:
# Use compression for stored ISOs:find /assets -name "*.iso" -exec gzip {} \;# Configure automatic decompression in nginx:location ~ \.iso$ {gzip_static on;}
Network Optimization
Network Stack Tuning
Optimize Network Performance:
-
TCP Optimization:
# /etc/sysctl.conf optimizations:net.core.rmem_max = 134217728net.core.wmem_max = 134217728net.ipv4.tcp_rmem = 4096 65536 134217728net.ipv4.tcp_wmem = 4096 65536 134217728net.core.netdev_max_backlog = 5000net.ipv4.tcp_window_scaling = 1# Apply changes:sudo sysctl -p -
Network Interface Optimization:
# Optimize network interface settings:sudo ethtool -G eth0 rx 4096 tx 4096 # Increase ring buffersudo ethtool -K eth0 tso on gso on # Enable offloading
DNS Optimization
Improve DNS Resolution:
-
Use Fast DNS Servers:
# /etc/resolv.conf:nameserver 1.1.1.1 # Cloudflarenameserver 8.8.8.8 # Googlenameserver 9.9.9.9 # Quad9 -
Local DNS Caching:
# Install and configure dnsmasq:sudo apt-get install dnsmasq# /etc/dnsmasq.conf:cache-size=1000local-ttl=300
Self-Hosting Performance
Hardware Recommendations
Optimal Hardware for Self-Hosting:
-
Minimum Specifications:
CPU: 2 cores, 2GHzRAM: 4GBStorage: 50GB SSDNetwork: Gigabit Ethernet -
Recommended Specifications:
CPU: 4+ cores, 3GHz+RAM: 8GB+Storage: 100GB+ NVMe SSDNetwork: Gigabit Ethernet with QoS -
Enterprise Specifications:
CPU: 8+ cores, 3.5GHz+RAM: 16GB+Storage: 500GB+ NVMe SSD in RAID 1Network: 10Gbps with redundancy
Docker Optimization
Container Performance Tuning:
-
Resource Limits:
services:netbootxyz:deploy:resources:limits:cpus: '2.0'memory: 4Greservations:cpus: '1.0'memory: 2G -
Volume Optimization:
volumes:# Use bind mounts for better performance:- type: bindsource: ./assetstarget: /assets- type: bindsource: ./configtarget: /config
Monitoring and Metrics
Performance Monitoring
Track Performance Metrics:
-
Network Monitoring:
# Monitor network usage:iftop -i eth0 # Real-time bandwidthnethogs # Per-process network usagess -tuln # Active connections -
System Performance:
# Monitor system resources:htop # CPU and memory usageiotop # Disk I/Ovmstat 1 # System statistics -
Docker Monitoring:
# Monitor container performance:docker stats netbootxyz # Resource usagedocker logs netbootxyz # Container logs
Log Analysis
Performance Log Analysis:
-
Nginx Access Logs:
# Analyze slow requests:awk '$9 >= 400 {print $0}' /var/log/nginx/access.log# Top requesting IPs:awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head -20 -
System Logs:
# Check for performance issues:journalctl -p err -b # Error messages from current bootdmesg | grep -i error # Kernel errors
Troubleshooting Slow Performance
Common Performance Issues
Identify and Fix Slow Performance:
-
Network Bottlenecks:
# Test network speed:iperf3 -c server_ip # Bandwidth testmtr boot.netboot.xyz # Network path analysistcpdump -i eth0 port 80 # Monitor HTTP traffic -
Storage Issues:
# Test disk performance:hdparm -tT /dev/sda # Hard drive speed testdd if=/dev/zero of=/tmp/test bs=1M count=1024 # Write speed test -
Memory Pressure:
# Check memory usage:free -h # Available memorycat /proc/meminfo # Detailed memory infops aux --sort=-%mem # Top memory consumers
Remember: Performance optimization is an iterative process. Monitor your metrics, make incremental changes, and measure the impact of each optimization.