architecture7 min read

Scaling Cloudflare's Security Scans 10x

4 similar posts
  • Apache Kafka
  • PostgreSQL
  • Go

AI Summary

Cloudflare engineers scaled their automated security insight scans by 10x, moving from 10 to over 120 scans per second. Instead of blindly adding hardware or brokers, the team systematically resolved bottlenecks in Apache Kafka partitioning, database insertion queries, cross-region API latency, and scheduling spikes. These architectural improvements enabled automated scans for all free accounts and increased scanning frequency across paid tiers.

Key Takeaways

  • Addressed head-of-line blocking in Kafka by separating slow and fast lanes
  • Optimized Postgres insertions by combining UNNEST and COPY strategies based on payload size
  • Switched multi-region API deployment from active-active to active-passive to eliminate cross-continent latency bottlenecks
  • Introduced randomized scheduling and adaptive rate-limiting to smooth out traffic spikes

Why it matters

Understanding how to optimize distributed messaging, database insertion strategies, and cross-region latency without simply throwing hardware at the problem is a vital skill for backend and infrastructure engineers. This case study demonstrates methodical performance engineering in action.

Conversation0

What would you add from your experience?

Checking your session…

Every good conversation starts with one perspective.