Unpacking Cloudflare Workers CPU Performance Benchmarks
2 days ago
- #Cloudflare
- #Performance
- #Benchmarking
- Independent developer Theo Browne published benchmarks comparing server-side JavaScript execution speed between Cloudflare Workers and Vercel, showing Cloudflare Workers performing worse by up to 3.5x.
- Cloudflare investigated and found several small issues contributing to the disparity, including infrastructure tuning, JavaScript library differences, and test issues, leading to performance improvements for all customers.
- Key fixes included updating the scheduling algorithm to better handle CPU-heavy workloads and adjusting V8 garbage collector tuning, resulting in Cloudflare Workers now performing on par with Vercel in most benchmarks.
- Next.js performance on Cloudflare Workers was still lagging due to issues like unnecessary buffer allocations and inefficient streams adapters, with ongoing work to optimize OpenNext and submit patches to Next.js and React.
- Cloudflare identified and fixed a Node.js trigonometry performance issue, submitting a pull request to enable faster trig functions in Node.js, benefiting the broader ecosystem.
- Benchmark methodology issues were addressed, including running tests from the same data center to minimize network latency and ensuring consistent configurations between Cloudflare and Vercel tests.
- Cloudflare plans further improvements to the Workers Runtime, OpenNext, and V8, with a focus on closing the remaining performance gap with Next.js on Vercel and continuing to contribute to open source projects.