Preface:
Whenever the topic of understanding architecture through open source research comes up in the Gopher TW discussion group, I personally highly recommend etcd. The reasons are as follows:
- Simple tasks: etcd's tasks are relatively straightforward.
- Basic Client/Server concept (and many tools available)
- Features the RAFT distributed computing HA algorithm
So, when discussing how to study code, I also enjoy sharing etcd.
Code Link:
https://github.com/etcd-io/etcd
Related Recommendations:
So, during this discussion, I also made the following suggestions:
- Want to understand the Raft algorithm? First, look at https://github.com/etcd-io/etcd/tree/master/raft
- How to write tools? See https://github.com/etcd-io/etcd/tree/master/tools
- How to write client apps? See https://github.com/etcd-io/etcd/tree/master/client
Reading well-structured code based on your objectives is like reading a good book. It's very beneficial!
Netizen's suggestion for segregated hashmap performance optimization:
According to netizen Naruto's suggestion:
Because the page storage area of the bbolt db will have performance problems, a set of segregated hashmap was designed to solve it
Quick search, summarized:
segregated hashmap
An optimization initiated by Alibaba, based on performance bottlenecks they discovered in their business operations.
- English: https://www.cncf.io/blog/2019/05/09/performance-optimization-of-etcd-in-web-scale-data-scenario/
- Chinese: https://www.infoq.cn/article/Dit9YCy2-ziDrLfFeQzq
Very effective
The new optimization reduces time complexity of the internal freelist allocation algorithm in etcd from O(n) to O(1) and the page release algorithm from O(nlgn) to O(1) , which solves the performance problem of etcd under the large database size. Literally, the etcd’s performance is not bound by the storage size anymore. The read and write operations when etcd stores 100GB of data can be as quickly as storing 2GB. This new algorithm is fully backward compatible.
I'll find some time to study it...
Top comments (0)