Scalin ling s servic ices w it it h Dis ist rib ibut ed In-Mem em ory Ca Caches SATURN 201 8 | Plano, Texas Divya Nagar and Chirag Aggarw al
900K+ Drivers 10 0 M+ Mon th ly Ord e rs 261M+ P e op le Im p acte d
- 18+ P rod u cts - 3M+ Ord e rs Daily - Exp on e n tial g row th sin ce first ap p lau n ch
Slick User Experience Low Re sp on se Tim e s Hig h Availab ility
- Hig h th rou g h p u t Car - Hig h Availab ility Bike
Acce p tab le Con siste n cy Surge He at Map s
Diffe re n t Re q u ire m e n ts Surge He at Map s
- Em b e d d e d & In -Me m ory - Distrib u te d - Re p licate d - Horizon tally Scalab le
Prat t l t t l e github.com /gojekfarm /prattle
MEM EMBER ERSHIP CA CACH CHE RE REPLICA CATION
1 2 8 Mem bership 7 3 6 4 5
3 2 UDP Multicast 4 1 5 6
1 6 2 - Less Nodes - Less Congestion 5 3 4
1 2 9 3 Quadratic Increase in Netw ork 8 4 Congestion 7 5 6
(1,2,3,5,6) 4 is dead 1 6 2 False Positives 6 is dead 5 3 (1,2,3,4,5) 4
Reduce Netw ork Congestion 1 2 1 9 3 4 2 3 8 4 7 5 5 6 7 8 6
SW IM IS A MEM EMBER ERSHIP PROT OTOC OCOL OL
FAILURE DETECTION
N1 N2 func (m *Member) Ping(nodeAddress net.Addr) error { pingRequest := NewPingRequest{ NodeAddress: nodeAddress, } ackChannel := make(chan ackMessage, 1) defer close(ackChannel) m.sendMessageUdp(&pingRequest, ackChannel) select { case ackMessage := <-ackChannel: logger.info(“ack message: + ackMessage) return nil case <-time.After(m.config.AckTimeout): return m.ProbeNode(nodeAddress) } }
N1 N2 func (m *Member) Ping(nodeAddress net.Addr) error { pingRequest := NewPingRequest{ NodeAddress: nodeAddress, } ackChannel := make(chan ackMessage, 1) defer close(ackChannel) m.sendMessageUdp(&pingRequest, ackChannel) select { case ackMessage := <-ackChannel: logger.info(“ack message: + ackMessage) return nil case <-time.After(m.config.AckTimeout): return m.ProbeNode(nodeAddress) } }
N1 N2 func (m *Member) Ping(nodeAddress net.Addr) error { pingRequest := NewPingRequest{NodeAddress: nodeAddress} ackChannel := make(chan ackMessage, 1) defer close(ackChannel) err := m.sendMessageUdp(nodeAddress.String(), &pingRequest, ackChannel) if err != nil { return err } select { case ackMessage := <-ackChannel: logger.info(“ack message:” + ackMessage) return nil case <-time.After(m.config.AckTimeout): return m.ProbeNode(nodeAddress) } }
N1 N2 func (m *Member) Ping(nodeAddress net.Addr) error { pingRequest := NewPingRequest{NodeAddress: nodeAddress} ackChannel := make(chan ackMessage, 1) defer close(ackChannel) err := m.sendMessageUdp(nodeAddress.String(), &pingRequest, ackChannel) if err != nil { return err } select { case ackMes sage := <-ackChannel: logger.info(“ack message:” + ackMessage) return nil case <-time.After(m.config.AckTimeout): return m.ProbeNode(nodeAddress) } }
N1 N2 N3 func (m *Member) ProbeNode(nodeAddress net.Addr) error { members := m.KRandomMembers() ackChannel := make(chan ackMessage, count(members)) for _, member := range members { pingRequest := NewPingRequest{NodeAddress: nodeAddress} member.sendMessageUdp(&pingRequest, ackChannel) } defer close(ackChannel) select { case ackMessage := <-ackChannel: logger.info(“ack message:” + ackMessage) return nil case <-time.After(m.config.AckTimeout): return errors.New(“timed out while probing”) } }
N1 N2 N3 func (m *Member) ProbeNode(nodeAddress net.Addr) error { members := m.KRandomMembers() ackChannel := make(chan ackMessage, count(members)) for _, member := range members { pingRequest := NewPingRequest{ NodeAddress: nodeAddress, } member.sendMessageUdp(&pingRequest, ackChannel) } defer close(ackChannel) select { case ackMessage := <-ackChannel: logger.info(“ack message:” + ackMessage) return nil case <-time.After(m.config.AckTimeout): return errors.New(“timed out while probing”) } }
N1 N2 N3 func (m *Member) ProbeNode(nodeAddress net.Addr) error { members := m.KRandomMembers() ackChannel := make(chan ackMessage, count(members)) for _, member := range members { pingRequest := NewPingRequest{ NodeAddress: nodeAddress, } member.sendMessageUdp(&pingRequest, ackChannel) } defer close(ackChannel) select { case ackMessage := <-ackChannel: logger.info(“ack message:” + ackMessage) return nil case <-time.After(m.config.AckTimeout): return errors.New(“timed out while probing”) } }
N1 N2 N3 func (m *Member) ProbeNode(nodeAddress net.Addr) error { members := m.KRandomMembers() ackChannel := make(chan ackMessage, count(members)) for _, member := range members { pingRequest := NewPingRequest{ NodeAddress: nodeAddress, } member.sendMessageUdp(&pingRequest, ackChannel) } defer close(ackChannel) select { case ackMessage := <-ackChannel: logger.info(“ack message:” + ackMessage) return nil case <-time.After(m.config.AckTimeout): return errors.New(“timed out”) } }
REPLIC ICATIO ION
1 Initial Im plem entation 4 2 3 w ith Prattle 5 6 7 8
prattle := NewPrattle(siblingAddr string) prattle.SetViaGossip(key, value)
Problem s w ith Gossip Based Re p lication - In fe ction Style Disse m in ation
3 2 UDP m ulticast 4 based 1 replication 5 6
prattle := NewPrattle(siblingAddr string) prattle.SetViaMulticast(key, value)
Thank you
Recommend
More recommend