来自Jeff Dean的分布式系统设计模式

本文是Google院士jeff dean在今年SOCC大会上的一次演讲的笔记,主要介绍了一些用于设计分布式系统的模式,原文地址,这次演讲的视频地址(需要安装Silverlight)。

    1. 将一个大而复杂系统切分为多个服务,而且服务之间依赖尽可能的少,这样有助于测试,部署和小团队独立开发。例子:一个google的搜索会依赖100多个服务。ike:需要一套机制来确保服务的fault-tolerant,不能让一个服务的成败影响全局。
    2. 需要有Protocol Description Language,比如protocol buffers。ike:这样能降低通信方面的代码量。
    3. 有能力在开发之前,根据系统的设计来预测性能,在最下面有一些重要的数字。ike:这样数字需要记牢。
    4. 设计系统时,不要想做的很全面,而是需要抓住重点。
    5. 为了增量做设计,但不为无限做设计,比如:要为5-50倍的增量做设计,但超过1000倍了,就需要重写和重新设计了。
    6. 使用备份请求来降低延迟,比如一个处理需要涉及1000台机器,通过备份请求这个机制来避免这个处理被一台慢机器延误。ike:这个机制非常适合MapReduce。
    7. 使用范围来分布数据,而不是Hash,因为这样在语义上比较简单,并且容易控制。
    8. 灵活的系统,根据需求来伸缩,并且当需求上来的时候,关闭部分特性,比如:关闭拼写检查。
    9. 一个接口,多个实现。
    10. 加入足够的观察和调式钩子(hook)。

number

图1. 重要的数字

## A C++11 implementation of the B-Tree part of "The Case for Learned Index Structures" A research **proof of concept** that implements the B-Tree section of [The Case for Learned Index Structures](https://arxiv.org/pdf/1712.01208.pdf) paper in C++. The general design is to have a single lookup structure that you can parameterize with a KeyType and a ValueType, and an overflow list that keeps new inserts until you retrain. There is a value in the constructor of the RMI that triggers a retrain when the overflow array reaches a certain size. The basic API: ```c++ // [first/second]StageParams are network parameters int maxAllowedError = 256; int maxBufferBeforeRetrain = 10001; auto modelIndex = RecursiveModelIndex recursiveModelIndex(firstStageParams, secondStageParams, maxAllowedError, maxBufferBeforeRetrain); for (int ii = 0; ii < 10000; ++ii) { modelIndex.insert(ii, ii * 2); } // Since we still have one more insert before retraining, retrain before searching... modelIndex.train(); auto result = modelIndex.find(5); if (result) { std::cout << "Yay! We got: " << result.get().first << ", " << result.get().second << std::endl; } else { std::cout << "Value not found." << std::endl; // This shouldn't happen in the above usage... } ``` See [src/main.cpp](src/main.cpp) for a usage example where it stores scaled log normal data. ### Dependencies - [nn_cpp](https://github.com/bcaine/nn_cpp) - Eigen based minimalistic C++ Neural Network library - [cpp-btree](https://code.google.com/archive/p/cpp-btree/) - A fast C++ implementation of a B+ Tree ### TODO: - Lots of code cleanup - Profiling of where the slowdowns are. On small tests, the cpp_btree lib beats it by 10-100x - Eigen::TensorFixed in nn_cpp would definitel
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值