# US 12,182,167 B1 · Sequential consistency across a distributed cloud computing network

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,182,167 B1
- Document ID: US12182167B1
- Status: Granted
- Kind: B1
- Application number: 18/740,932
- Filed: 2024-06-12
- Granted: 2024-12-31
- Earliest claimed: 2024-04-01
- Assignees: Cloudflare, Inc.
- Applicants: Cloudflare, Inc.
- Inventors: Justin Mazzola Paluska; Joshua Tyler Howard; Matthew Silverlock; Kenton Taylor Varda; Vy Nuthuy Ton
- Web page: https://patentgrep.com/patent/US12182167B1

## CPC

- G06F 16/273: {Asynchronous replication or reconciliation}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Sequential consistency across a distributed cloud computing network is described. A database includes a primary database and multiple read replica databases. Write queries are transmitted to the primary database, and commit tokens are provided to the read replica databases and the clients. Commit tokens are included in requests from clients. If a request for a read operation received at a read replica database does not include a token that is later than a commit token of the most recent update to the read replica database, the read replica database performs the read operation. If a request for a read operation received at a read replica database includes a token that is later than a commit token of the most recent update to the read replica database, the read replica database delays servicing the read update until it receives an update from the primary database with an updated commit token.

## Claims

### Claim 1

A method for providing sequential consistency across a distributed cloud computing network, comprising:
receiving a first request that includes a first read operation of a first read replica database, wherein the first read replica database is one of a plurality of read replica databases that are distributed by the distributed cloud computing network, and wherein the plurality of read replica databases are read replicas of a primary database, and wherein the first request is part of a logical session;
determining that the first request does not include a first token that identifies a first particular committed query to the first read replica database that is later than a second token that is stored that identifies a latest committed query to the first read replica database, and responsive to this determination:
performing the first read operation of the first read replica database,
transmitting a first response to the first request that includes a first result of the first read operation and the second token;
receiving a second request that includes a second read operation of the first read replica database, wherein the second request is part of the logical session;
determining that the second request includes a third token that identifies a second particular committed query to the first read replica database that is later than the second token that is stored that identifies the latest committed query to the first read replica database, and responsive to this determination:
pausing execution of the second read operation until the first read replica database is updated from the primary database with a fourth token that is later or equal to the third token;
receiving, from the primary database, an update from the primary database with the fourth token;
updating the first read replica database with the update from the primary database, and storing the fourth token;
performing the second read operation;
transmitting a second response to the second request that includes a second result of the second read operation, and the fourth token;
receiving a third request that includes a write operation, wherein the third request is part of the logical session;
transmitting the third request to the primary database for servicing;
receiving a third response to the third request that includes a third result of the write operation and a fifth token; and
transmitting the third response to the third request.

### Claim 2 (depends on 1)

The method of claim 1, wherein the first token, second token, third token, fourth token, and fifth token, are each a monotonically increasing commit token.

### Claim 3 (depends on 1)

The method of claim 1, wherein the third token is included in a cookie or accessed from device-local storage.

### Claim 4 (depends on 1)

The method of claim 1, wherein the third token indicates a version.

### Claim 5 (depends on 1)

The method of claim 1, wherein all write operations are transmitted to the primary database for servicing.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
receiving an update from the primary database that includes a sixth token that represents a latest commit of the primary database; and
updating the first read replica database with the update from the primary database, and storing the sixth token.

### Claim 7 (depends on 1)

The method of claim 1, wherein the logical session is unique to a particular user agent.

### Claim 8

A server of a plurality of servers of a distributed cloud computing network, the server comprising:
a processor; and
a non-transitory machine-readable storage medium coupled to the processor that stores instructions that, when executed by the processor, causes the server to perform operations including:
receiving a first request that includes a first read operation of a first read replica database, wherein the first read replica database is one of a plurality of read replica databases that are distributed by the distributed cloud computing network, and wherein the plurality of read replica databases are read replicas of a primary database, and wherein the first request is part of a logical session;
determining that the first request does not include a first token that identifies a first particular committed query to the first read replica database that is later than a second token that is stored that identifies a latest committed query to the first read replica database, and responsive to this determination:
performing the first read operation of the first read replica database,
transmitting a first response to the first request that includes a first result of the first read operation and the second token;
receiving a second request that includes a second read operation of the first read replica database, wherein the second request is part of the logical session;
determining that the second request includes a third token that identifies a second particular committed query to the first read replica database that is later than the second token that is stored that identifies the latest committed query to the first read replica database, and responsive to this determination:
pausing execution of the second read operation until the first read replica database is updated from the primary database with a fourth token that is later or equal to the third token;
receiving, from the primary database, an update from the primary database with the fourth token;
updating the first read replica database with the update from the primary database, and storing the fourth token;
performing the second read operation;
transmitting a second response to the second request that includes a second result of the second read operation, and the fourth token;
receiving a third request that includes a write operation, wherein the third request is part of the logical session;
transmitting the third request to the primary database for servicing;
receiving a third response to the third request that includes a third result of the write operation and a fifth token; and
transmitting the third response to the third request.

### Claim 9 (depends on 8)

The server of claim 8, wherein the first token, second token, third token, fourth token, and fifth token, are each a monotonically increasing commit token.

### Claim 10 (depends on 8)

The server of claim 8, wherein the third token is included in a cookie or accessed from device-local storage.

### Claim 11 (depends on 8)

The server of claim 8, wherein the third token indicates a version.

### Claim 12 (depends on 8)

The server of claim 8, wherein all write operations are transmitted to the primary database for servicing.

### Claim 13 (depends on 8)

The server of claim 8, wherein the operations further comprise:
receiving an update from the primary database that includes a sixth token that represents a latest commit of the primary database; and
updating the first read replica database with the update from the primary database, and storing the sixth token.

### Claim 14 (depends on 8)

The server of claim 8, wherein the logical session is unique to a particular user agent.

### Claim 15

A non-transitory machine-readable storage medium that provides instructions that, when executed by a processor causes operations to be performed including:
receiving a first request that includes a first read operation of a first read replica database, wherein the first read replica database is one of a plurality of read replica databases that are distributed by a distributed cloud computing network, and wherein the plurality of read replica databases are read replicas of a primary database, and wherein the first request is part of a logical session;
determining that the first request does not include a first token that identifies a first particular committed query to the first read replica database that is later than a second token that is stored that identifies a latest committed query to the first read replica database, and responsive to this determination:
performing the first read operation of the first read replica database,
transmitting a first response to the first request that includes a first result of the first read operation and the second token;
receiving a second request that includes a second read operation of the first read replica database, wherein the second request is part of the logical session;
determining that the second request includes a third token that identifies a second particular committed query to the first read replica database that is later than the second token that is stored that identifies the latest committed query to the first read replica database, and responsive to this determination:
pausing execution of the second read operation until the first read replica database is updated from the primary database with a fourth token that is later or equal to the third token;
receiving, from the primary database, an update from the primary database with the fourth token;
updating the first read replica database with the update from the primary database, and storing the fourth token;
performing the second read operation;
transmitting a second response to the second request that includes a second result of the second read operation, and the fourth token;
receiving a third request that includes a write operation, wherein the third request is part of the logical session;
transmitting the third request to the primary database for servicing;
receiving a third response to the third request that includes a third result of the write operation and a fifth token; and
transmitting the third response to the third request.

### Claim 16 (depends on 15)

The non-transitory machine-readable storage medium of claim 15, wherein the first token, second token, third token, fourth token, and fifth token, are each a monotonically increasing commit token.

### Claim 17 (depends on 15)

The non-transitory machine-readable storage medium of claim 15, wherein the third token is included in a cookie or accessed from device-local storage.

### Claim 18 (depends on 15)

The non-transitory machine-readable storage medium of claim 15, wherein the third token indicates a version.

### Claim 19 (depends on 15)

The non-transitory machine-readable storage medium of claim 15, wherein all write operations are transmitted to the primary database for servicing.

### Claim 20 (depends on 15)

The non-transitory machine-readable storage medium of claim 15, wherein the operations further comprise:
receiving an update from the primary database that includes a sixth token that represents a latest commit of the primary database; and
updating the first read replica database with the update from the primary database, and storing the sixth token.

### Claim 21 (depends on 15)

The non-transitory machine-readable storage medium of claim 15, wherein the logical session is unique to a particular user agent.
