开始要面亚麻了,把设计的题更新一下。以前的可以参考这两个链接。
2023年 亚麻半年设计和BQ
https://www.1point3acres.com/bbs/thread-1016786-1-1.html
2024年Google 设计和题解
https://www.1point3acres.com/bbs/thread-1097035-1-1.html
SD 设计分布式计数器
原帖
以下对网上的一个比较详细的文章的解读
https://systemdesign.one/distributed-counter-system-design/Distributed Counter System Design
The article on “Distributed Counter System Design” outlines a solution for implementing a scalable and efficient counter system that can handle high throughput and concurrency across a distributed environment. Below, I’ll abstract the key components, processes, and strategies involved in the design.
Overview
A distributed counter is useful in scenarios where a system must tally counts across multiple nodes in a distributed system, such as counting clicks on a website or tallying votes. The primary challenge is ensuring that the counter is accurate, consistent, and capable of handling high load and distributed nature of the data.
System Design Components
1. Counter Sharding
• Purpose: To distribute the load uniformly across several machines to avoid a single point of failure or bottlenodes to prevent data loss and improve read availability.
• Data Consistency: Implement eventual consistency, where the system tolerates temporary inconsistencies but guarantees that all updates will eventually be consistent across all nodes.
Conclusion
The design of a distributed counter system as described aims to balance between performance (speed of updates and reads) and reliability (data persistence and consistency). It addresses common challenges in distributed systems such as scalability, concurrency control, and fault tolerance. This system can be adapted and extended based on specific use cases and reliability requirements.
原文有比较详细的设计分析,我觉得主要缺少了DB之间的比较。比如MongoDB VS Cassandra, Redis vs Memcache。有兴趣的可以看看我写的其他帖子。
补充内容 (2024-12-02 08:11 +08:00):
2024年灭他设计和题解 |