IP Library Granted Patent US 11,226,745
Granted Patent B2
US 11,226,745 · App. 16/589,038 · Granted Jan 18, 2022

Optimizing data writes in a distributed computing system

Inventors: Arun Dattaram Sharma (Union City, CA); Manukranth Viswakarma Chary Kolloju (Sunnyvale, CA)
Assignee: Facebook, Inc.
G06F3/0619G06F3/061G06F3/065G06F3/067G06F3/0644G06F9/54G06F16/2322G06F16/27
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,226,745
App. No.
16/589,038
Granted
Jan 18, 2022
Kind
B2
Abstract

The disclosure is directed to optimizing data writes in a distributed computing system, e.g., a social networking application. The system employs a write-ahead log (WAL) and a hybrid logical clock (HLC) together to improve data writes across data centers in the distributed computing system, including improving: (1) consensus monitoring and enforcement in replicating data across the data centers; (2) scalability of data writes, e.g., so that different data centers can together handle a sudden increase in data writes during specified periods and consistently maintain the time ordering of the data writes; (3) replication configuration of data centers so that client devices can specify a replication hierarchy per transaction, e.g., at the time of writing the data, rather than specifying at data center configuration time; and (4) a draining process to write transactions committed to the WAL to data storage systems in the data centers.

Claims (67)

1. A computer-implemented method, comprising:

receiving, at a computing system from a client device, a write request for writing a data item to a data storage system, wherein the computing system is one of multiple computing systems in a distributed computing system;

writing, by the computing system, the data item to a write-ahead log in the computing system;

assigning, by the computing system, a hybrid-logical-clock timestamp to the data item upon being written to the write-ahead log, wherein the hybrid-logical-clock timestamp is generated based on a hybrid logical clock of the distributed computing system; and

replicating, by the computing system, the data item to write-ahead logs of one or more of the multiple computing systems based on a consensus protocol that is based on hybrid-logical-clock timestamps.

2. The computer-implemented method of claim 1 , further comprising:

receiving, at an additional computing system from an additional client device after the data item is received by the computing system, an additional write request for writing an additional data item to the data storage system, wherein the additional computing system is one of the one or more of the multiple computing systems;

writing, by the additional computing system, the additional data item to an additional write-ahead log in the additional computing system;

assigning, by the additional computing system, an additional hybrid-logical-clock timestamp to the additional data item upon being written to the additional write-ahead log, wherein the additional hybrid-logical-clock timestamp is generated based on the hybrid logical clock of the distributed computing system; and

replicating, by the additional computing system, the additional data item to at least the write-ahead log of the computing system.

3. The computer-implemented method of claim 2 , wherein:

the data item is a digital photograph; and

the additional data item is a comment on the digital photograph.

4. The computer-implemented method of claim 2 , wherein:

the computing system and the client device are located within a first geographical region; and

the additional computing system and the additional client device are located within a second geographical region.

5. The computer-implemented method of claim 2 , wherein assigning the hybrid-logical-clock timestamp to the data item and assigning the additional hybrid-logical-clock timestamp to the additional data item enables the data item and the additional data item to be sorted in a time-based order regardless of a clock skew associated with the write request and the additional write request.

6. The computer-implemented method of claim 1 , wherein replicating the data item to the write-ahead logs of the one or more of the multiple computing systems comprises:

appending the hybrid-logical-clock timestamp to the data item;

executing the consensus protocol based on the hybrid-logical-clock timestamp to obtain a consensus for writing the data item to the data storage system, wherein the consensus protocol ensures that the data item to be written to the data storage system is a latest version of the data item based on the hybrid-logical-clock timestamp; and

writing the data item to the write-ahead logs of one or more of the multiple computing systems upon receiving a consensus.

7. The computer-implemented method of claim 1 ,

wherein the receiving, the writing, the assigning, and the replicating are performed by a write-ahead-log subsystem of the computing system; and

the computer-implemented method of claim 1 further comprises writing, by the write-ahead-log subsystem and upon receiving a consensus, the data item to a read-optimized store of the computing system.

8. The computer-implemented method of claim 1 , further comprising executing a drain process to write multiple data items from the write-ahead log to the data storage system.

9. The computer-implemented method of claim 8 , wherein executing the drain process includes writing the multiple data items to one or more of multiple shards of the data storage system, wherein a shard of the multiple shards stores a subset of data items in the distributed computing system.

10. The computer-implemented method of claim 9 , wherein executing the drain process includes:

reading, from one or more of multiple partitions of the write-ahead log, data items associated with a specified shard of the multiple shards of the data storage system;

sorting, based on hybrid-logical-clock timestamps, the data items associated with the specified shard to generate a sorted set of data items; and

writing the sorted set of data items to the specified shard.

11. The computer-implemented method of claim 10 , wherein reading the data items associated with the specified shard includes determining the partitions having data items associated with those shards for which updates have been received since the drain process was last executed.

12. The computer-implemented method of claim 10 , wherein reading the data items associated with the specified shard includes maintaining a bitmap for each of the partitions, the bitmap indicating a set of shards for which updates have been received in the corresponding partition since the drain process was last executed.

13. The computer-implemented method of claim 8 , wherein executing the drain process includes executing the drain process in response to a trigger, the trigger being at least one of an expiry of a time interval or an amount of data items to be drained exceeds a specified threshold.

14. The computer-implemented method of claim 8 , wherein executing the drain process includes ensuring that a timestamp associated with the data item being written to the write-ahead log is greater than the timestamp of the data item stored in the data storage system.

15. The computer-implemented method of claim 1 , wherein writing the data item to the write-ahead log includes writing the data item to one of multiple partitions of the write-ahead log, wherein the client device writes a specified data item associated with any of multiple shards of the data storage system to any of the multiple partitions.

16. The computer-implemented method of claim 15 , wherein:

at least some of the multiple partitions are associated with different replication properties; and

the multiple partitions comprise:

a first partition that stores data items that are not replicated to other computing systems;

a second partition that stores data items that are replicated to a subset of the multiple computing systems; and

a third partition that stores data items that are replicated to at least a subset of the multiple computing systems without executing the consensus protocol.

17. A distributed computing system comprising:

a hybrid logical clock; and

a computing system comprising:

a write-ahead log;

at least one physical processor;

physical memory comprising computer-executable instructions that, when executed by the physical processor, cause the physical processor to:

receive, from a client device, a write request for writing a data item to a data storage system;

write the data item to the write-ahead log;

assign a hybrid-logical-clock timestamp to the data item upon being written to the write-ahead log, wherein the hybrid-logical-clock timestamp is generated based on the hybrid logical clock of the distributed computing system; and

replicate the data item to write-ahead logs of one or more additional computing systems in the distributed computing system based on a consensus protocol that is based on hybrid-logical-clock timestamps.

18. The distributed computing system of claim 17 , further comprising an additional computing system comprising:

an additional write-ahead log;

at least one additional physical processor;

additional physical memory comprising computer-executable instructions that, when executed by the additional physical processor, cause the additional physical processor to:

receive, from an additional client device after the data item is received by the computing system, an additional write request for writing an additional data item to the data storage system, wherein the additional computing system is one of the one or more additional computing systems;

write the additional data item to the additional write-ahead log;

assign an additional hybrid-logical-clock timestamp to the additional data item upon being written to the additional write-ahead log, wherein the additional hybrid-logical-clock timestamp is generated based on the hybrid logical clock of the distributed computing system; and

replicate the additional data item to at least the write-ahead log of the computing system.

19. The distributed computing system of claim 18 , wherein:

the computing system and the client device are located within a first geographical region; and

the additional computing system and the additional client device are located within a second geographical region.

20. A non-transitory computer-readable medium comprising one or more computer-executable instructions that, when executed by at least one processor of a computing device, cause the computing device to:

receive, at a computing system from a client device, a write request for writing a data item to a data storage system, wherein the computing system is one of multiple computing systems in a distributed computing system;

write, by the computing system, the data item to a write-ahead log in the computing system;

assign, by the computing system, a hybrid-logical-clock timestamp to the data item upon being written to the write-ahead log, wherein the hybrid-logical-clock timestamp is generated based on a hybrid logical clock of the distributed computing system; and

replicate, by the computing system, the data item to write-ahead logs of one or more of the multiple computing systems based on a consensus protocol that is based on hybrid-logical-clock timestamps.

Assignments (2)
CHANGE OF NAME Recorded Dec 23, 2021
From: FACEBOOK, INC.
To: META PLATFORMS, INC.
Reel/Frame 058569/0422 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 30, 2019
From: SHARMA, ARUN DATTARAM; KOLLOJU, MANUKRANTH VISWAKARMA CHARY
To: FACEBOOK, INC.
Reel/Frame 050571/0220 →
Cited By (1)
US 12,367,151