AirJD 焦点
AirJD

没有录音文件
00:00/00:00
加收藏

Go 在分布式系统开发中的应用

发布者 gopher   简介 Gopher
发布于 1430387869654  浏览 5465 关键词 Go 
分享到

第1页

About me

姓名:刘奇 微博:@goroutine



第2页

The most things i did

if err != nil { return err

}



第3页

The most things i did

reduce allocations object pool buf reuse defer SetFinalizer Reuse goroutine



第4页

Cpu related

Reduce syscall No SetReadDeadline No SetWriteDeadline Pipeline Parallel



第5页

Distributed components

coordinator (gonna talk about) storage rpc

message queue cache …...



第6页

Distributed conponents

coordinator,纠结么 zookeeper etcd

how to use etcd like zookeeper :)



第7页

zookeeper vs etcd

起因以及一些差异

not gonna cover every details



第8页

zookeeper vs etcd

起因: reborndb是一个分布式redis集群框架

支持透明切换引擎 为了同时支持zookeeper和etcd



第9页

zookeeper vs etcd

zookeeper: session

etcd: stateless



第10页

zookeeper vs etcd

文件和目录的差异 zookeeper: 目录可以带value

etcd: 目录就是纯粹的目录



第11页

zookeeper vs etcd

临时节点 zookeeper: 直接创建 etcd: 自己去更新ttl,用goroutine不断

去更新 如果watch了临时节点:这样又会不断

产生新的事件



第12页

zookeeper vs etcd

zookeeper: getwatch etcd: watch after index ?

how to choose index? what if index is far from current raft

index? out of date



第13页

zookeeper vs etcd

RebornDB的getwatch实现 让client持有状态



第14页

zookeeper vs etcd

RebornDB临时节点实现 Create with TTL Update TTL

Filter TTL update event when do watch



第15页

etcd

type etcdImpl struct {

sync.Mutex

…...

indexMap map[string]uint64 //path-->index }



第16页

etcd to zookeeper event

switch resp.Action { case "set": e.Type = zk.EventNodeDataChanged case "delete": e.Type = zk.EventNodeDeleted case "update": e.Type = zk.EventNodeDataChanged case "create": e.Type = zk.EventNodeCreated case "expire": e.Type = zk.EventNotWatching

}



第17页

About Counter

Need it everywhere



第18页

About Testing

It’s hard to do test in distributed system

Monkey test Searching…….



第19页

About RPC

太多的轮子了 希望有一个一统天下

grpc



第20页

Thanks



支持文件格式:*.pdf
上传最后阶段需要进行在线转换,可能需要1~2分钟,请耐心等待。