《Go 在分布式系统开发中的应用.pdf》由会员分享,可在线阅读,更多相关《Go 在分布式系统开发中的应用.pdf(20页珍藏版)》请在三一文库上搜索。
1、About me 姓名:刘奇 微博:goroutine The most things i did if err != nil return err The most things i did reduce allocations object pool buf reuse defer SetFinalizer Reuse goroutine Cpu related Reduce syscall No SetReadDeadline No SetWriteDeadline Pipeline Parallel coordinator (gonna talk about) storage rpc
2、message queue cache . Distributed components coordinator,纠结么 zookeeper etcd how to use etcd like zookeeper :) Distributed conponents 起因以及一些差异 not gonna cover every details zookeeper vs etcd 起因: reborndb是一个分布式redis集群框架 支持透明切换引擎 为了同时支持zookeeper和etcd zookeeper vs etcd zookeeper: session etcd: stateless
3、 zookeeper vs etcd 文件和目录的差异 zookeeper: 目录可以带value etcd: 目录就是纯粹的目录 zookeeper vs etcd 临时节点 zookeeper: 直接创建 etcd: 自己去更新ttl,用goroutine不断 去更新 如果watch了临时节点:这样又会不断 产生新的事件 zookeeper vs etcd zookeeper: getwatch etcd: watch after index ? how to choose index? what if index is far from current raft index? out o
4、f date zookeeper vs etcd RebornDB的getwatch实现 让client持有状态 zookeeper vs etcd RebornDB临时节点实现 Create with TTL Update TTL Filter TTL update event when do watch zookeeper vs etcd type etcdImpl struct sync.Mutex . indexMap mapstringuint64 /pathindex etcd switch resp.Action case “set“: e.Type = zk.EventNode
5、DataChanged case “delete“: e.Type = zk.EventNodeDeleted case “update“: e.Type = zk.EventNodeDataChanged case “create“: e.Type = zk.EventNodeCreated case “expire“: e.Type = zk.EventNotWatching etcd to zookeeper event Need it everywhere About Counter Its hard to do test in distributed system Monkey test Searching. About Testing 太多的轮子了 希望有一个一统天下 grpc About RPC Thanks