Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/content/changelog/d1/2025-05-30-d1-rest-api-latency.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Faster D1 REST API
description: D1 REST API request latency improvements.
products:
- d1
- workers
date: 2025-05-29T00:00:00Z
---

Users using Cloudflare's [REST API](/api/resources/d1/) to query their D1 database can see lower end-to-end request latency now that D1 authentication is performed at the closest Cloudflare network data center that recieved the request. Previously, authentication required D1 REST API requests to proxy to Cloudflare's core centralized centers, which added network round trips.

D1 query endpoints like `/query` and `/raw` have the most noticeable improvements since they no longer access Cloudflare's core data centers. D1 control plane endpoints such as those to create and delete databases see smaller improvements, since they still require access to Cloudflare's core data centers for other control plane metadata.

Performance improvements apply to only the REST API. Users can now expect similar performance querying their database via the REST API and via a [Worker](/d1/best-practices/query-d1/#query-d1-with-workers-binding-api).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought about mentioning comparison to the Worker binding API but they are still not quite the same. The REST API still does extra things, auth itself, we do some other internal calls, and so there is some overhead still until they are the same.

I would remove that sentence.

Suggested change
Performance improvements apply to only the REST API. Users can now expect similar performance querying their database via the REST API and via a [Worker](/d1/best-practices/query-d1/#query-d1-with-workers-binding-api).
These performance improvements only apply to the REST API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lambrospetrou Are there any plans to address the REST overhead? Is the overhead 10s of ms (if so I could still frame as comparable performance which is the goal)

Copy link
Contributor

@lambrospetrou lambrospetrou May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 100-300ms more than the Worker Binding depending on caching of downstream services, so not negligible in some cases. I don't want folks to start complaining that they don't see same numbers.

Copy link
Contributor Author

@vy-ton vy-ton May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 100-300ms more than the Worker Binding depending on caching of downstream services

is this specific to D1 or general REST overhead for CF APi?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not general CF API. Well, auth is, but the rest is for other things we check in D1 (e.g. entitlements, feature flags, and others) only during REST API requests. We can reduce that further later with some followups.


Loading