Pushing the Limits of Network Traffic With Open Source (cloudflare.com)
An anonymous reader writes: CloudFlare's content delivery network relies on their ability to shuffle data around. As they've scaled up, they've run into some interesting technical limits on how fast they can manage this. Last month they explained how the unmodified Linux kernel can only handle about 1 million packets per second, when easily-available NICs can manage 10 times that. So, they did what you're supposed to do when you encounter a problem with open source software: they developed a patch for the Netmap project to increase throughput. "Usually, when a network card goes into the Netmap mode, all the RX queues get disconnected from the kernel and are available to the Netmap applications. We don't want that. We want to keep most of the RX queues back in the kernel mode, and enable Netmap mode only on selected RX queues. We call this functionality: 'single RX queue mode.'" With their changes, Netmap was able to receive about 5.8 million packets per second. Their patch is currently awaiting review.
If I have a 100Mb/s NIC, I'm only getting 10 MB/s on Linux? I doubt that.
must be thoroughly considered. CloudFlare is the greatest Man-in-the-Middle on the Internet, and don't think for a second they're not collaborating with U.S agencies who wants to get at sensitive data going through their systems.
If they only need to "shuffle" packets around (ie, not crack open the frames and actually interpret the data beyond making routing decisions) then routers/switches are better suited for this. If they actually need to do something more with the data then that quoted 5.8 million packets/sec. rate will drop very quickly for each single line of code they add that does anything with the data.
Both created and heavily funded by the CIA/NSA
Wouldn't it just be easier to put this in systemd?
As they've scaled up, they've run into some interesting technical limits on how fast they can manage this.
Yeah, no kidding. Anyone who's tried to use 4chan in the last few weeks has experienced Cloudflare's technical limitations first-hand.
My employer deals with this on their multi-core MIPS processors. What we do is we can run Linux on one set of cores and dedicated applications on other cores. These applications offload most of the TCP/IP stack and only pass the relevant traffic to the kernel. The Ubiquiti EdgeRouter Lite uses one of our lowest-end chips and handles 1M packets/second. Our higher-end chips can easily handle far more packets. Then again, the dedicated cores are also able to take much better advantage of the hardware offload support for forwarding and filtering. Even without using the dedicated special application we can handle 40Gbps or more of traffic on the high-end chips. We can also handle stuff like IPSec at these rates due to built-in encryption and hashing instructions if coded properly.
Having the right NIC card can also help since some NIC cards can offload things like TCP/IP segmentation and reassembly. I've also dealt with small gigabit switch chips that can offload stuff like NAT but Linux can't really take advantage of that as-is.
There's a lot of room for improvement. Some years ago I was doing performance analysis for Atheros with respect to CPU cache utilization. The biggest bottleneck was the fact that the transmit path in the Linux networking stack would only pass a single packet at a time. Batch processing of packets for WiFi makes a HUGE difference since groups of packets need to be aggregated for 802.11N. It also would allow for more efficient packet processing for non-wireless as well. There are a lot of other areas that also could be improved.
This post is encrypted twice with ROT-13. Documenting or attempting to crack this encryption is illegal.
My understanding is limited. But this sounds very similar to the earlier Slashdot story about the BBC bypassing the kernel to improve UHD throughput. It's a different, even opposite, solution intended to overcome similar or same limitation.
A recent blog post from Red Hat details how they're able to get three times those numbers on a single CPU and able to process over 12 million packets per second (http://rhelblog.redhat.com/2015/09/29/pushing-the-limits-of-kernel-networking/). What is so different about the workloads?
I'm sure Luca Deri would license it to them.
Why not use FreeBSD?
Real switching, high speed carrier grade stuff, is more about hardware asics than software. Its comparatively exhaustingly expensive to route subnet or vlan traffic because the CPU on most machines isn't quick enough with bus overhead. Cisco and others own a monopoly on ultra high speed asic enabled hardware used by cloudflare and others. Modern virtual switching hardware is fast enough to crush practically any consumer hardware.
Good people go to bed earlier.
From TFA:
... which implies that NICs can easily manage more than 10 million packets per second, right?
5.8 million packets per second might be fast, but it is still _ much lower _ than the theoretical >10 million packets per second max speed ...
I am curious, has any software (no matter if it's open source, or proprietary) successfully achieved the >10 million packets per second threshold yet?
Muchas Gracias, Señor Edward Snowden !