跳到主内容
精选85Hacker News Best(web_list)行业动态

Linux内核开发者:AI爬虫消耗20%算力,被迫关闭功能

Linux 内核开发者谈爬虫与网络抓取

原文
推荐理由

做AI训练数据采集或运营高流量站点的同学必看,这篇一手数据揭示了爬虫对基础设施的真实冲击,以及Anubis等反爬方案的实战效果,值得收藏参考。

Creepy crawlies

令人毛骨悚然的爬虫

August 29, 2026

2026年8月29日

You've probably heard me complain about the “AI crawlers” before, but now I actually have some hard numbers I can put up to show their impact. In a few words, it's bad enough to create a constant “background radiation” of system load, permanently tying up a chunk of capacity spent on producing output that is only useful for a single purpose — feeding a learning model.

你可能之前听我抱怨过“AI爬虫”,但现在我确实有一些硬数据可以展示它们的影响。简而言之,情况糟糕到足以造成系统负载的持续“背景辐射”,永久占用一部分计算能力,而这些计算能力产出的输出仅对单一目的有用——喂养学习模型。

TL;DR: we spend more CPU cycles rendering commits for scrapers than we spend on all other kinds of legitimate access, including git clones. At any one time, across 5 geo-distributed nodes, there are 14 CPU cores doing nothing but rendering git commits as html.

简而言之:我们花费在渲染提交给爬虫的CPU周期,比所有其他合法访问(包括git克隆)的总和还要多。在任何时刻,跨5个地理分布节点,有14个CPU核心仅用于将git提交渲染为HTML。

Why is git.kernel.org “interesting” to crawlers

为什么git.kernel.org对爬虫“有吸引力”

Linux development happens in the open — from git repositories you can clone, to discussion archives you can follow in real time. To a large language model, this is a goldmine of learning data, because all of this is not only immediately available, but is easy to filter in order to guarantee pure unadulterated pre-AI content. Training an LLM on content produced by the LLM gives it the equivalent of a digital prion disease, so when a source is guaranteed to be LLM-free, like the entire history of kernel commits, it's worth its weight in gold as a source of training data.

Linux开发是公开进行的——从你可以克隆的git仓库,到你可以实时关注的讨论存档。对于大型语言模型来说,这是一个学习数据的金矿,因为所有这些不仅立即可用,而且易于过滤,以确保纯净无污染的AI前内容。在由LLM生成的内容上训练LLM,相当于给模型患上数字版朊病毒病,所以当数据源保证不含LLM生成内容时,比如内核提交的完整历史,作为训练数据源就价值连城。

The stupidest way of doing it

最愚蠢的做法

We make almost everything clonable, because hey — we may not be around forever, so here — clone the repos. Also, clone the archives. Grab a copy just so we're not the only ones who have it all. Seriously, it's just a “git clone” away — and then you'll have the whole history.

我们几乎让所有内容都可克隆,因为嘿——我们可能不会永远存在,所以这里——克隆仓库吧。另外,也克隆存档。拿一份副本,这样我们就不是唯一拥有全部数据的人。说真的,只需“git clone”一下——然后你就拥有了完整的历史。

For example, did you know you can clone the entirety of LKML and then do whatever you want with it? It's just git repos all the way down.

例如,你知道你可以克隆整个LKML,然后随心所欲地使用它吗?这全是git仓库,一路到底。

So, you'd think that something that pretends to be “Artificial Intelligence” would use the most efficient way of using our data for training purposes, right? Clone the repos, walk every commit. Done.

所以,你会认为,一个自称“人工智能”的东西会使用最有效的方式利用我们的数据进行训练,对吧?克隆仓库,遍历每个提交。搞定。

But no, let's in fact choose the stupidest possible way of doing it — by rendering everything as HTML commit by commit and then parsing it.

但事实并非如此,让我们选择最愚蠢的方式——逐个提交渲染成HTML,然后解析它。

At the time of writing, linux.git is about 1.48 million commits. Oh, and we have about 922 forks of it on git.kernel.org — but don't worry, it's actually extremely efficient on the backend, since it's mostly the same objects in every fork.

在撰写本文时,linux.git约有148万次提交。哦,我们在git.kernel.org上还有大约922个它的分支——但别担心,后端实际上非常高效,因为每个分支中的对象大多是相同的。

Unless, of course, you're a scraper, in which case you have, oh, several BILLION valid URLs you can scrape, only to get 922 duplicates of the same 1.48 million commits — which is exactly what the scrapers are doing.

当然,除非你是个爬虫,那样的话,你就有,哦,几十亿个有效的URL可以抓取,结果却只得到同一148万次提交的922个重复——这正是爬虫们正在做的事情。

But wait, it's not just commits itself. You can also ask for patches, plain renders, diffs between arbitrary commits — cgit is happy to let you, which was perfect for the times when the Internet was for humans or crawlers who obeyed robots.txt, and is AWFUL right about now, because we can generate 1.2 METRIC BAJILLION valid URLs just for a single fork of linux.git.

但等等,不仅仅是提交本身。你还可以请求补丁、纯文本渲染、任意提交之间的差异——cgit很乐意让你这么做,这在互联网是为人类或遵守robots.txt的爬虫服务的时代是完美的,而现在则糟糕透顶,因为仅针对linux.git的一个分支,我们就能生成1.2兆亿个有效的URL。

Block them

封锁它们

Initially, this was the solution — look through the logs, find out which IPs are obvious scraper bots, and fail2ban them. At first, this was easy, because the bots helpfully told you who they were via their user-agent. Then, they wised up and started pretending that they were random vanilla browsers.

最初,解决方案是——查看日志,找出哪些IP是明显的爬虫机器人,然后用fail2ban封禁它们。起初这很容易,因为机器人会通过它们的用户代理友好地告诉你它们是谁。然后,它们变聪明了,开始假装成随机的普通浏览器。

So, we started banning them by IP — after all, it's easy to figure out that an IP that is trying to grab every possible commit in a 8-year-old abandoned fork of linux is not really some lone Chrome on Windows user who is just furiously clicking every link that comes across their screen.

于是,我们开始按IP封禁——毕竟,很容易判断一个试图抓取一个8年前被遗弃的linux分支中每一个可能提交的IP,并不是某个孤独的Windows Chrome用户,只是疯狂点击屏幕上出现的每个链接。

The bots then started fanning out to entire subnets, but this was still meh, because obviously an IP coming from Google Compute is just pretending to be a Firefox user. Banning the whole ASN was justified, even if this occasionally caught a random legitimate instance trying to automate link checking in commits.

接着,机器人开始扩散到整个子网,但这仍然没什么用,因为显然来自Google Compute的IP只是假装成Firefox用户。封禁整个ASN是合理的,即使这偶尔会误伤一些合法的实例,它们试图在提交中自动化检查链接。

Enter... your TV?

接下来……你的电视?

And... that's when things turned really, really ugly. Suddenly, the crawlers were coming from millions of random residential or mobile IPs, all pretending to be random modern browsers. An IP like that would make 4-5 requests and then never show up in the logs again. There was no point in banning them, because by the time you figured out that they were bots, they were already done with you. You just needlessly ballooned your firewall ruleset by adding IPs that would never be back.

然后……事情变得非常非常糟糕。突然,爬虫来自数百万个随机的住宅或移动IP,都假装成随机的现代浏览器。这样的IP会发出4-5个请求,然后就再也不出现在日志中。封禁它们毫无意义,因为当你发现它们是机器人时,它们已经完成了对你的访问。你只是不必要地膨胀了防火墙规则集,添加了永远不会再回来的IP。

They descended like swarms of locust, hit hard and fast until the system fell over and then moved on to the next target until you recovered. Then, they returned. Rinse. Repeat.

它们像蝗虫群一样降临,猛烈而迅速地攻击,直到系统崩溃,然后转向下一个目标,直到你恢复。然后,它们又回来了。冲洗。重复。

They still do that — welcome to the wonderful world of “proxy SDK monetization.” It's big business, and your TV is probably doing it.

它们仍然这样做——欢迎来到“代理SDK变现”的奇妙世界。这是门大生意,你的电视可能正在做这件事。

Make them pay

让它们付出代价

When this first became a problem, oh, about a year ago, we naively thought that there was a way to make it stop. Just make the bots perform a task that would flip the economy of the whole thing upside-down by making them burn some cycles doing throwaway math. Like, calculate what string, when combined with their own IP and a secret we provide, would generate a sha256 sum with 4 leading zeroes.

当这个问题首次出现时,大约一年前,我们天真地以为有办法让它停止。只需让机器人执行一项任务,通过让它们消耗一些周期进行无用的计算,从而彻底颠覆整个经济模式。比如,计算什么字符串,当与它们自己的IP和我们提供的秘密结合时,会生成一个前四位为零的sha256和。

In other words, we put Anubis in front of everything.

换句话说,我们在所有东西前面都放置了阿努比斯。

It was immediately extremely effective — the bots just gave up. For a few months, it was bliss: bots were blocked at the perimeter and gave up, moving on to easier targets; the users were mildly annoyed but tolerated it, and the Anubis stack was easy enough to deploy everywhere.

它立即非常有效——机器人直接放弃了。几个月内,一切都很美好:机器人在外围被拦截并放弃,转向更容易的目标;用户虽然有些恼火但容忍了,而且阿努比斯堆栈部署起来足够简单,到处都能用。

A few months later, the bots were back, solving difficulty 4. No problem, we said, let's raise difficulty to 5.

几个月后,机器人回来了,解决了难度4。没问题,我们说,让我们把难度提高到5。

The legitimate users were more annoyed now. Difficulty 5 takes a few seconds to solve on a mobile device, and the phone gets uncomfortably warm as it's doing the number crunching. However, it was effective and bought us a few more months of peace.

合法用户现在更加恼火了。难度5在移动设备上需要几秒钟才能解决,而且手机在进行数字计算时会变得不舒服地热。然而,这很有效,为我们买来了几个月的平静。

Then... the bots started solving difficulty 5.

然后……机器人开始解决难度5了。

Where we are now

我们现在的情况

Today, git.kernel.org receives about 6M daily requests demanding to see random commits. Of these, 66% are still immediately batted away with the Anubis challenge, but 33% are now solving the math and getting through to the main site — because apparently what we have to offer is worth spending a ton of cycles to calculate the Anubis challenge.

今天,git.kernel.org每天收到约600万次请求,要求查看随机提交。其中,66%仍然立即被阿努比斯挑战拦截,但33%现在正在解决数学问题并进入主站——因为显然我们提供的东西值得花费大量周期来计算阿努比斯挑战。

It's impossible to tell with certainty which of these are bots and which are real humans — but chances are, if it's asking for an old commit in a random old fork, it's probably not a real developer trying to do their work.

无法确定哪些是机器人,哪些是真实人类——但很可能,如果它请求的是随机旧分支中的旧提交,那可能不是真正在做工作的开发者。

With a bunch of generous assumptions, legitimate requests are only about 2% of git.kernel.org traffic — everything else are scrapers.

在一系列慷慨的假设下,合法请求仅占git.kernel.org流量的约2%——其余都是爬虫。

How bad is it?

情况有多糟?

At this point, we're not quite overwhelmed — if you visit git.kernel.org, it will likely be snappy and responsive. The thing that usually takes us down are not scraper bots, but poorly designed CI systems that try to do something stupid like shallow-clone stable.git from 20 different nodes, all at the same time. (Shallow clones are awful. Run your own damn mirror if you're going to do something nasty like that.)

目前,我们还没有完全不堪重负——如果你访问git.kernel.org,它可能会很快响应。通常让我们宕机的不是爬虫机器人,而是设计糟糕的CI系统,它们试图做愚蠢的事情,比如同时从20个不同节点浅克隆stable.git。(浅克隆很糟糕。如果你要做那种恶心的事,就运行你自己的镜像吧。)

However, you should know that out of the total of the 90 cores across 5 geo-distributed nodes, there are 14-16 cores that are constantly doing nothing but rendering commits for scrapers. On average, that's 20% of our entire capacity — except the swarms descend in waves and the actual graph is a lot more spiky than a 20% flatline.

然而,您应当了解,在分布于5个地理位置的节点共90个核心中,有14至16个核心始终仅用于为爬虫程序渲染提交内容。平均而言,这占我们总容量的20%——但群集如潮水般涌来,实际图形远比20%的平直线更为波动。

Where does that leave us?

这让我们何去何从?

Unclear. Maybe the AI bubble bursts and we suddenly have a lot fewer entities out there trying to train their models. Alternatively, maybe they smarten up and stop consuming our data in the dumbest way possible.

尚不明朗。或许AI泡沫破裂,试图训练模型的外部实体骤然减少。又或许,他们变得聪明,不再以最笨拙的方式消耗我们的数据。

In terms of what we're doing, we're turning off features to reduce the number of crawlable URLs and to gate off actions that are expensive for us to run. Expect to lose some functionality, at least when accessing our resources anonymously. Trust me, we hate it just as much as you, but at this point it's a necessity.

就我们而言,正在关闭部分功能以减少可抓取的URL数量,并限制对我们而言运行成本高昂的操作。预计某些功能将无法使用,至少在匿名访问我们的资源时如此。请相信,我们和您一样对此感到遗憾,但此刻这是必要的。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

另一事件,读法相近