Database Performance Benchmark

Compare database query speeds: Cloudflare Hyperdrive vs. a standard Bun.js REST API. Tests run from your browser to servers in Helsinki 🇫🇮, US East 🇺🇸, and US West 🇺🇸, all via Cloudflare Workers.

How it Works

This tool measures how quickly your browser gets data using two main methods, with all requests handled by a SvelteKit application on Cloudflare Workers:

  • Hyperdrive: The Worker queries a regional database directly, accelerated by Hyperdrive's connection pooling.
  • Bun REST API: The Worker fetches data from a regional Bun.js API, which then queries the database.

The benchmark runs 3 rounds, testing 12 configurations (different regions, methods, caching) in a random order per round. A 3-second pause occurs between rounds (after the first). Averages are calculated from runs 2 to 3 (run 1 is a warm-up).

Metrics Explained:

  • Client Time: Total time your browser waits for data, including all network and processing.
  • Server Time: Database query execution time. For Hyperdrive, this is direct. For Bun REST, it's the time reported by the Bun API (excluding Worker-to-Bun API latency).

Caching Approaches:

  • Browser Cache: Disabled for all benchmark tests.
  • CDN-Cached: Responses from the Worker (whether via Hyperdrive or Bun API) are cached by Cloudflare's CDN for 30 seconds.
  • Non-Cached: Unique URLs are used for each request to bypass CDN and aim for fresh data from the database. Hyperdrive still benefits from its internal connection pooling and statement caching.

Click the button to start the benchmark.