How much spec is required to operate Twitter on only one PC?



Large-scale Internet services such as Twitter are basically operated on infrastructure such as multiple PCs and data centers, but if Twitter is operated on a single PC, what kind of PC is required? Technology researcher Tristan Hume explains how it will be. Mr. Hume is considering the possibility of providing almost all functions of Twitter on one PC with the latest high-performance storage and data communication.

Production Twitter on One Machine? 100Gbps NICs and NVMe are fast - Tristan Hume

https://thume.ca/2023/01/02/one-machine-twitter/

At Twitter's core, 'tweet delivery', users post text-based tweets to feeds, and other users follow those tweets in chronological order. There are basically two ways to distribute tweets.

The first is by taking tweets from the accounts you follow in reverse chronological order on your timeline page and merging them using a heap until you have enough tweets. This method requires obtaining a large number of tweets from various feeds, and the problem is that it cannot be accelerated.

The second is how tweets are pushed to the cached timeline. This method is said to be potentially faster than retrieving a large number of tweets, but celebrities' tweets have a huge number of replies, etc., so they need to be processed in the background or merged separately. . This method is used in actual Twitter.

It is necessary to think about how many tweets need to be saved in order to distribute tweets, and Twitter CEO Elon Musk said, ``About 500 million tweets and billions of impressions are being made per day. ' said.




Twitter also publishes various data on tweets, and according to Hume, much of the published data is relatively small on the scale of modern computers.

So Hume is devising a mixture of RAM , NVMe and HDD for storing tweets. As the necessary specifications, we recommend installing a RAM of 512GB to 1TB and a high-speed NVMe drive with a capacity of 8TB or more. Also, the HDD will store 20TB of old tweets that are basically never accessed.

Hume created a prototype using the programming language Rust and benchmarked timeline merging. As a result, it is fast enough to handle all the loads, and we have confirmed that it can handle real Twitter loads.

On the other hand, Mr. Hume said, ``If you build Twitter on a single PC, there is a risk of data loss and long-term service outages, bad code can exhaust your PC's resources, and some bugs can occur. It is not realistic to build Twitter on a single PC due to the possibility of service downtime, the need to pay attention to the zero-downtime function and database structure, and the difficulty of debugging Twitter.' I'm here.



In the prototype created by Mr. Hume, it is said that there is room to add functions other than tweet distribution, and Mr. Hume is considering functions that can be added.

As functions that can be added, Mr. Hume cites ``

HTTP request '', `` live update and infinite scrolling of the timeline '', and `` display of images on the timeline ''.

On the other hand, 'displaying videos', 'searching tweets', 'notification function', and 'displaying advertisements' are said to be difficult.

In addition, Mr. Hume estimates the cost of building Twitter on a single PC. Hume envisions using two 16-core Xeon CPUs, 768GB RAM, 46TB NVMe, a 360TB HDD, an NVIDIA A100 Tensor Core GPU and a Dell PowerEdge R740xd to run all of Twitter on one machine. I'm here.

Server cost: $ 15,425 (about 2,030,000 yen)
24 pieces of 32 GB RAM: $ 3168 (about 418,000 yen)
6 samsung PM1733 8tb NVMe: $ 7200 (about 950,000 yen)
NVIDIA A100 Tensor Core GPU: $ 10,000 (about 1.32 million yen)
Cost for using bandwidth : About $ 130,000 in a year (about 17.14 million yen)

``Reducing server costs below this level does not make economic sense from an engineer's perspective,'' Hume said. Hume also said, ``I will not actually build this PC,'' but ``I am making notes and diagrams about how to build this PC in my free time at work.'' says.

in Software,   Web Service,   Hardware, Posted by log1r_ut