Network traffic analysis is essential for capacity planning, anomaly detection, and security monitoring. While NetFlow and IPFIX dominate enterprise environments, sFlow (sampled Flow) offers a lightweight alternative that works across switches, routers, and servers at line rate. This guide compares three open-source sFlow collectors you can self-host: GoFlow2, Akvorado, and pmacct.
What Is sFlow?
sFlow is a multi-vendor, standards-based technology for monitoring high-speed switched and routed networks. Unlike NetFlow/IPFIX which export every flow record, sFlow uses statistical packet sampling — typically 1 in N packets — combined with interface counter polling. This makes it:
- Scalable: Handles 10/40/100 Gbps links without overwhelming the collector
- Vendor-agnostic: Supported by Arista, Juniper, Cisco, HPE, MikroTik, and most Linux NICs
- Low overhead: Sampling reduces CPU and bandwidth usage on monitored devices
- Layer 2-7 visibility: Captures Ethernet, IP, TCP/UDP headers and application-layer metadata
sFlow vs NetFlow/IPFIX
| Feature | sFlow | NetFlow v9 | IPFIX |
|---|---|---|---|
| Sampling | Statistical (1 in N) | Flow-based (all flows) | Flow-based (all flows) |
| Overhead | Very low | Medium | Medium |
| Layer 2 visibility | Yes | No | Partial |
| Counter polling | Yes (interface stats) | No | No |
| Standard | RFC 3176 | Cisco proprietary | IETF RFC 7011 |
| Switch support | Broad (most vendors) | Cisco-centric | Cisco/Juniper |
1. GoFlow2
GoFlow2 is a high-performance, multi-protocol flow collector written in Go. Originally created by Cloudflare, it supports sFlow v5, NetFlow v5/v9, and IPFIX.
Key features:
- Multi-protocol: sFlow, NetFlow v5/v9, IPFIX in a single binary
- High throughput: Processes millions of flows per second
- Kafka/protobuf output: Streams data to downstream consumers
- Prometheus metrics: Built-in metrics endpoint for monitoring
- Kubernetes-native: Designed for cloud-native deployments
Docker Compose Setup
| |
Installation on Ubuntu
| |
Prometheus Configuration
| |
2. Akvorado
Akvorado is a modern flow collector, enricher, and visualizer built by OVHcloud. It provides a complete pipeline from flow ingestion to dashboard visualization.
Key features:
- All-in-one: Collector, enricher, console, and clickhouse storage
- ClickHouse backend: Fast analytics on billions of flow records
- GeoIP enrichment: Automatic ASN and geolocation data
- Built-in dashboard: No need for separate Grafana
- sFlow + NetFlow + IPFIX: Multi-protocol support
Docker Compose Setup
| |
Reverse Proxy Configuration (Nginx)
| |
3. pmacct
pmacct is a Swiss Army knife for network monitoring, supporting sFlow, NetFlow, IPFIX, BGP, BMP, and more. It has been in development since 2003 and is one of the most mature open-source flow tools.
Key features:
- Multi-purpose: Flow collection, BGP monitoring, RPKI validation
- Multiple backends: MySQL, PostgreSQL, MongoDB, Kafka, RabbitMQ, memory
- BGP integration: Correlates flow data with BGP routing information
- Traffic accounting: Per-host, per-protocol, per-AS aggregation
- Active development: Regular releases since 2003
Docker Compose Setup
| |
pmacct Configuration (pmacct.conf)
| |
Comparison Table
| Feature | GoFlow2 | Akvorado | pmacct |
|---|---|---|---|
| sFlow v5 | Yes | Yes | Yes |
| NetFlow v5/v9 | Yes | Yes | Yes |
| IPFIX | Yes | Yes | Yes |
| BGP monitoring | No | No | Yes |
| Built-in dashboard | No (Grafana) | Yes | No |
| Storage backend | Kafka/Protobuf | ClickHouse | SQL/NoSQL/Kafka |
| GeoIP enrichment | External | Built-in | External |
| Kubernetes-ready | Yes | Yes | Limited |
| Active development | Yes | Yes | Yes |
| GitHub stars | 771 | 2,214 | 1,211 |
| Best for | Cloud-native pipelines | End-to-end analytics | Multi-purpose monitoring |
Choosing the Right sFlow Collector
- GoFlow2 — Best for cloud-native deployments where you want to pipe flow data into Kafka and process it with downstream consumers (Elasticsearch, custom analytics). Its stateless design makes it easy to scale horizontally.
- Akvorado — Best for teams that want an all-in-one solution with a built-in dashboard and ClickHouse storage. The ClickHouse backend enables fast queries across billions of flow records.
- pmacct — Best for network engineers who need BGP correlation, RPKI validation, and the ability to aggregate flow data in multiple dimensions simultaneously. It is the most mature and feature-rich option.
Why Self-Host sFlow Collection?
Running your own sFlow collector gives you complete visibility into network traffic without sending sensitive flow data to third-party services. Self-hosted sFlow collection enables:
- Data sovereignty: All flow data stays within your infrastructure, meeting compliance requirements for regulated industries
- Cost control: Commercial flow analytics platforms charge per exporter or per Gbps of sampled traffic. Open-source collectors eliminate these recurring costs
- Custom analytics: Store raw flow data in your preferred backend (ClickHouse, PostgreSQL, Elasticsearch) and build custom queries for your specific use cases
- Real-time alerting: Trigger alerts on traffic anomalies, DDoS patterns, or policy violations without cloud API latency
- Historical analysis: Retain flow data for months or years for capacity planning and forensic investigations
- Integration with existing monitoring: Feed flow metrics into your existing Prometheus/Grafana stack alongside server and application metrics
For network topology mapping, see our network topology discovery guide. If you need DNS traffic analysis, check our DNS traffic analysis comparison. For general network monitoring, our network monitoring comparison covers broader infrastructure visibility.
FAQ
What is the difference between sFlow and NetFlow?
sFlow uses statistical packet sampling (1 in N packets) which scales to high-speed links with minimal overhead. NetFlow tracks every flow, providing complete visibility but higher CPU and bandwidth usage on both the exporter and collector. sFlow works across vendors (Layer 2 visibility), while NetFlow is Cisco-centric.
Which sFlow collector should I choose for a small network?
For small networks (under 10 exporters), GoFlow2 is the simplest to deploy — it runs as a single container and outputs to a file or Prometheus. If you want built-in visualization, Akvorado provides a complete stack, though it requires ClickHouse and Kafka.
Can sFlow detect DDoS attacks?
Yes. sFlow sampling captures the source/destination IPs, ports, and protocols of sampled packets, which is sufficient to identify volumetric DDoS patterns, SYN floods, and DNS amplification attacks. The key advantage is that sFlow works at line rate even on 100 Gbps links where full-flow capture would be impractical.
How does sFlow sampling rate affect accuracy?
A sampling rate of 1:1000 (1 in 1000 packets) provides good accuracy for high-volume flows (web, video, bulk transfers) but may miss low-volume flows. For networks with many small flows, consider 1:100 or 1:200. Most switches default to 1:2048 or 1:4096, which is adequate for capacity planning but may miss ephemeral connections.
Does sFlow work with virtual machines and containers?
Yes. The host-sflow daemon runs on Linux hosts and captures traffic from virtual interfaces (veth, bridge, VXLAN). This makes it ideal for monitoring Kubernetes pod-to-pod traffic, Docker container communication, and virtual machine traffic on hypervisors.
Can I combine sFlow with SNMP monitoring?
Absolutely. sFlow provides flow-level visibility (who is talking to whom, what protocols), while SNMP provides interface-level statistics (bandwidth utilization, error rates, link status). Together they give a complete picture: SNMP tells you that a link is saturated, and sFlow tells you why.