Performance Tuning for TrueNAS SCALE

Optimizing TrueNAS SCALE for your specific workload can significantly improve performance and system responsiveness. Below are detailed tips and strategies for tuning your setup.


1. ZFS Optimization

ARC (Adaptive Replacement Cache):

  • ARC Memory Allocation:
    • ZFS uses system RAM as its primary cache (ARC). More RAM = better performance.
    • Allocate at least 1GB of RAM per 1TB of storage.
    • Monitor ARC usage via System > Reporting > ARC Size and adjust workloads accordingly.

L2ARC (Level 2 ARC):

  • Use SSDs for Read Cache:
    • Add high-speed SSDs to extend cache beyond RAM.
    • Suitable for read-heavy workloads like databases or VMs.
  • Avoid Over-Caching:
    • Ensure your SSDs can handle the additional IOPS to avoid introducing latency.

ZIL/SLOG (ZFS Intent Log):

  • Dedicated Write Cache:
    • Use enterprise-grade SSDs for SLOG devices to accelerate synchronous writes (e.g., for NFS/iSCSI).
    • Example: Optane drives or high-endurance NVMe SSDs.
  • Evaluate Workload Needs:
    • SLOG benefits only synchronous write-heavy workloads. General NAS use may not need it.

2. Pool Layout for Performance

RAID Configurations:

  • RAIDZ1/RAIDZ2 vs Mirrors:
    • Mirrors: Faster read/write but reduced capacity.
    • RAIDZ1/2: Higher capacity but slightly slower performance.
  • Choose based on your use case:
    • VMs/Databases: Prefer mirrors for IOPS.
    • Media Storage/Archives: RAIDZ1/2 for capacity.

Alignment:

  • Use disks with 4K sector sizes for modern drives.
  • Ensure pool alignment to avoid unnecessary read/write amplification.

Record Size:

  • Adjust Record Size for Workload:
    • Default: 128K (general purpose).
    • Databases: 8K-16K for transactional performance.
    • Large files: 1M for better throughput.

3. Network Performance

Interface Bonding:

  • Link Aggregation:
    • Aggregate multiple NICs for redundancy and higher bandwidth (e.g., LACP/802.3ad).
    • Suitable for SMB or NFS workloads with multiple clients.

MTU (Jumbo Frames):

  • Enable Jumbo Frames:
    • Set MTU to 9000 for networks supporting jumbo frames.
    • Confirm end-to-end support to avoid fragmentation.
    • Verify the network switch supports jumbo frame and match size to support.

Offloading Settings:

  • Enable/disable TCP offloading based on your NIC:
    • High-quality NICs (Intel): Enable offloading.
    • Consumer-grade NICs (Realtek): Test performance with offloading disabled.

4. Virtualization Tuning

Resource Allocation:

  • Assign sufficient CPU cores and memory to VMs/containers without starving the host system.
  • Enable CPU Pinning for dedicated cores to critical VMs.

Storage Backing:

  • Use SSD-based storage pools for VMs.
  • Thin-provision datasets to allocate only used space.

Hardware Passthrough:

  • Use PCIe passthrough for performance-critical devices (e.g., GPUs, NVMe).

5. App-Specific Tuning

Plex/Jellyfin/Media Servers:

  • Transcoding:
    • Use GPUs with hardware acceleration (e.g., NVIDIA or Intel Quick Sync).
    • Pass GPUs to apps using PCIe passthrough or container-specific configs.

Databases:

  • Use smaller record sizes (e.g., 16K).
  • Enable compression for space efficiency (e.g., LZ4).

Backup Workloads:

  • Optimize replication and backup schedules during off-peak hours to minimize system load.

6. System-Wide Enhancements

Compression:

  • Enable LZ4 compression for datasets to save space with minimal performance impact.

Deduplication:

  • Only enable deduplication for datasets with high duplicate content, as it is memory-intensive.

Periodic Scrubs:

  • Schedule scrubs during low-usage periods to ensure pool integrity without performance degradation.

7. Monitoring and Troubleshooting

Use Built-In Tools:

  • System > Reporting:
    • Monitor ARC usage, CPU, disk I/O, and network throughput.
  • Alerts:
    • Keep track of pool health, temperature, and disk errors.

Third-Party Tools:

  • Use Grafana and Prometheus for advanced monitoring.
  • Install plugins for dashboard visualization of metrics.

Testing Performance:

  • Use tools like fio or dd to benchmark read/write speeds.
  • Adjust settings based on observed bottlenecks.

By fine-tuning these aspects, you can extract maximum performance from your TrueNAS SCALE setup, ensuring it meets your workload demands efficiently.