Hacker News new | ask | show | jobs
by kentonv 1690 days ago
The latency that this individual was experiencing with Workers wayyyyy back in 2019 was not caused by cold starts, but rather a bug in the workers runtime which caused rare but long pauses. Specifically, the bug involved a hash map with a broken hash function. Here's me publicly facepalming over the issue at the time: https://twitter.com/KentonVarda/status/1189966124688953344

But that was two years ago, Workers has grown ~an order of magnitude since then (both traffic and team size), and such a bug would be immediately noticed today.

The article author says that after the fix he still wasn't happy with performance, but I don't know what he was experiencing exactly. We've done a lot of other things to improve performance since then; it may very well be better today.

2 comments

I used cloudflare-workers still this year and only switched a couple of months ago: https://securitytrails.com/domain/url.rw/history/a

The performance was still very bad from a 95 percentile perspective.

This isn't the feedback we get from most customers, so I guess there was something unusual going on. Sorry we weren't able to dig into this while it was still relevant to you.
> https://twitter.com/KentonVarda/status/1189966124688953344

What exactly was the bug though? bool effectively reducing hash(key) to 0 or 1?

Yes. So almost all keys had a hash code of 1, forcing linear search lookups. Insidious since the code still works, it's just slow -- and only really slow in production, after seeming fine in tests that only put a few items in the map.