News for hackers. Stuff that matters.
Re:Bypassing the Linux kernel for high-performance packet fi... by acdha on Monday September 07, 2015 @10:23AM (#10181516)
One thing to remember is that high-speed packet filtering is an unusual workflow and CloudFlare operates at a much greater scale than most of us see: most Linux devices are not connected to 10G, much less 100G, networks and they're usually doing more work than looking at a packet to decide whether to accept or reject it. The fact that the APIs and the kernel stack were designed many years before those kind of speeds were possible doesn't matter because most sites don't have that much traffic and most server applications will bottleneck at doing other work well before that point.

The example in the article found a single core handling 1.4M packets per second. If you're running a web-server shoveling data out to clients those packets are going to be close to the maximum size which, if I haven't screwed up the math, looks something like this:

1.4M * 1400 bytes (assuming a low MTU) * 8 (bytes -> bits) = 15Gbps

That's not to say that there isn't still plenty of room to improve and, as lukego noted, there's a lot of work in progress (see e.g. https://lwn.net/Articles/615238/ on work to batch operations to avoid paying some of the processing costs for every packet) but for the average server you'd find bottlenecks on something like a database, application logic, request handling, client network capacity, etc. before the network stack overhead is your greatest challenge. The people who encounter this tend to be CDN vendors like CloudFlare and security people who need to filter, analyze, or generate traffic on levels which are at least the the scale of a large company (e.g. https://github.com/robertdavidgraham/masscan).

Re:Bypassing the Linux kernel for high-performance packet fi... by X-Istence on Monday September 07, 2015 @01:25PM (#10182212)
I work at an ISP, we are starting to connect stuff at 40G (times 2 for redundancy) because we want a single machine to do more work.

Improving the kernel would greatly speed up many of our applications with no real downsides.

With 40G to the edge, we also need to be able to properly firewall/filter/and all that fun stuff the traffic!

Re:Bypassing the Linux kernel for high-performance packet fi... by lukego on Monday September 07, 2015 @10:54AM (#10181615)
People are also spending hundreds of billions of dollars on equipment like routers ever year. These could be Linux boxes if the kernel had sensible performance.

I am kind of amazed that the Linux kernel did not become the dominant data-plane for the networking industry ahead of proprietary implementations from Cisco, Juniper, etc.

Hopefully Snabb Switch will have better luck there... ;-)

Re:Bypassing the Linux kernel for high-performance packet fi... by asdfaoeu on Monday September 07, 2015 @11:06AM (#10181669)
ASICs are always going to be way faster than a Linux kernel.
Re:Bypassing the Linux kernel for high-performance packet fi... by __d on Monday September 07, 2015 @05:45PM (#10183203)
Most switch/router dataplane processing is done in hardware, with control by custom drivers in the control-plane OS.

Cisco IOS is variously hosted on a proprietary real-time OS, QNX or Linux. Juniper JunOS is FreeBSD-based. Arista AOS is Linux-based.

With the advent of SDN, the packet-rate limitations of a general-purpose OS lead to things like DPDK and Snabb, but they both run within a Linux host environment (DPDK can use FreeBSD as well; not sure re: Snabb).

Re:Bypassing the Linux kernel for high-performance packet fi... by zurn on Monday September 07, 2015 @11:12AM (#10181692)
When 100M ethernet was introduced in the 90s, PCs had Pentiums, at < 100 M instructions per second. Both x86 CPUs and Ethernet have gotten ~1000x faster in the same time - cf 100G Ethernet and processors with 30x frequency, ~2x more IPC, and 20x more cores.
Re:Bypassing the Linux kernel for high-performance packet fi... by tedunangst on Monday September 07, 2015 @11:22AM (#10181736)
You haven't accounted for memory bandwidth and latency. And counting increased core count means you can't actually assume the same old single threaded algorithm will scale linearly.
Re:Bypassing the Linux kernel for high-performance packet fi... by zurn on Monday September 07, 2015 @01:09PM (#10182156)
Those are real-world speed bumps that make sense when you want to do stateful processing w/ large working sets, but not really for this "just get packets through the stack" toy benchmark that fits in cache and the workload is parallel-friendly.

And also the article is talking about handling just 10G, not 100G!

Re:Bypassing the Linux kernel for high-performance packet fi... by gonzo on Monday September 07, 2015 @04:48PM (#10182983)
> One thing to remember is that high-speed packet filtering is an unusual workflow and CloudFlare operates at a much greater scale than most of us see: most Linux devices are not connected to 10G

You're about to see a whole bunch more 10G in the coming 5 years.

Re:Bypassing the Linux kernel for high-performance packet fi... by scurvy on Monday September 07, 2015 @11:05AM (#10181661)
Sorry if I sound mean, but this is just a long apologist post about how things are just so hard. Really? Why? Why can't Linux match BSD's performance?

Also, 10gb servers are not rare by any means. Take a look around the next time you walk in a colo. 10 gb servers everywhere.

Re:Bypassing the Linux kernel for high-performance packet fi... by acdha on Monday September 07, 2015 @11:35AM (#10181800)
> Sorry if I sound mean, but this is just a long apologist post about how things are just so hard. Really? Why? Why can't Linux match BSD's performance?

Mostly I just wish you'd read it again: you appear to have missed the part where I said that this is a real problem which needed working on.

The point I was making is that it's not a problem for most Linux users. Linux includes millions of devices attached to sub-100Mb networks but even if you want to look solely at things in modern data centers ask yourself how many of them are running network-limited applications or are providing services to internet users over an uplink which is actually fast enough to stress modern hardware. For all but the most demanding users the Linux vs. BSD decision will be made on other factors.

Re:Bypassing the Linux kernel for high-performance packet fi... by scurvy on Monday September 07, 2015 @12:14PM (#10181947)
Those millions of sub-100Mb network devices aren't pushing Linux forward though. Sure, they're using Linux, but they're not the ones pushing it forward. It's colo and datacenter use cases that are. A basic MySQL OLTP load with SSD's and a modicum of compute power will easily saturate a 10gig NIC. It does start to die shortly after that due to network/kernel stuff. I'd really like to get a lot more out of my existing hardware if i could.
Re:Bypassing the Linux kernel for high-performance packet fi... by acdha on Monday September 07, 2015 @03:03PM (#10182596)
You mean “pushing it forward in this particular direction”. Again, it's great to have people working on this and better if the companies using Linux support developers working on the problem but it's only a deal-breaker for a much smaller number of people.

Just to use an example which you see a lot today: how many of the developers jumping on Docker care that much about network performance at this level? I would argue that continued development of the container system has done more to boost Linux usage than low-level networking performance, even though both are entirely legitimate and worthwhile concerns worth developer sponsorship. (ZFS has pulled in the opposite direction for people who care about storage)

From the other direction, imagine if *BSD had gotten serious about package management by the mid-to-late 90s when it was obvious how much better the experience was on Debian so that a generation of developers wasn't trained to favor Linux to avoid getting sucked into dependency management. That doesn't have anything to do with the kernel but it mattered more for many, many people. This would have been really interesting if kfreebsd had hit critical mass and made the cost of switching that much lower.

Re:Bypassing the Linux kernel for high-performance packet fi... by betaby on Monday September 07, 2015 @11:37AM (#10181812)
> Why can't Linux match BSD's performance?

You do sound both mean and factless. Meaningful apple to apple BSD to Linux comparison needed.

Re:Bypassing the Linux kernel for high-performance packet fi... by scurvy on Monday September 07, 2015 @12:09PM (#10181933)
Re:Bypassing the Linux kernel for high-performance packet fi... by betaby on Monday September 07, 2015 @12:52PM (#10182100)
Except there is no Linux presence on any graph on this link.
Re:Bypassing the Linux kernel for high-performance packet fi... by scurvy on Tuesday September 08, 2015 @10:14AM (#10185768)
The data are in the original post. Are you just trolling comments or have you actually read the Cloudflare articles?
Re:Bypassing the Linux kernel for high-performance packet fi... by tedunangst on Monday September 07, 2015 @11:35AM (#10181795)
I'm not certain if "apologist post" refers to the article or the comment you replied to, but neither mentions BSD. ?
Re:Bypassing the Linux kernel for high-performance packet fi... by justincormack on Monday September 07, 2015 @11:47AM (#10181850)
Well the BSDs have issues too. FreeBSD/Netflix has been doing in kernel SSL to try to fix some issues, and there is Netmap available for packet processing in userspace. So they are running into similar issues as Linux.
Re:Bypassing the Linux kernel for high-performance packet fi... by gonzo on Monday September 07, 2015 @04:47PM (#10182976)
Netflix is doing in-kernel SSL so they don't have to hit the web server to encrypt the disk blocks for their streaming movies.

That doesn't mean it's a (Free)BSD issue, just that Netflix chose a particular architecture and are doing the work to make it go fast.

Netmap is in FreeBSD, and available for linux. I think it might be in Dragonfly at this point as well.