郭平(坤宇)-12.8--阿里巴巴大规模分布式软负载体系原理及实践

阿里巴巴大规模分布式软负载体系原理及实践
演讲大纲:

  • 什么是软负载?
  • 阿里巴巴9年双11的软负载实践
  • 软负载技术架构原理
  • 微服务应用架构趋势与软负载
  • 阿里巴巴开源中间层软负载均衡产品NACOS
展开查看详情

1.ᴨ᯾૬૬य़ᥢཛྷ‫૲ړ‬ୗ᫫ᨮ᫹ ֛ᔮܻቘ݊ਫ᪢ ࣡ਜ ᴨ᯾૬૬ṛᕆದ๞ӫਹ

2.࣡ਜ ṛᕆದ๞ӫਹ • ᴨ᯾૬૬Ӿᳵկࢫᴚ᫫ᨮ᫹̵ᯈᗝӾஞզ݊ iPaaSԾߝᕚᨮᨱՈ • ᴨ᯾ԯᯈᗝԾߝ ACM ԾߝᎸ‫ݎ‬Leader • Nacos ୏რԾߝ‫ڠ‬তՈ • OpenConfiguration ᥢ᝜‫ݎ‬᩸Ո

3.• Ջԍฎ᫫ᨮ᫹ • ᴨ᯾૬૬9ଙ‫݌‬11Ӿጱ᫫ᨮ᫹ਫ᪢ • ᫫ᨮ᫹ದ๞ຝ຅ܻቘ • ங๐‫ۓ‬ଫአຝ຅᩽۠Ө᫫ᨮ᫹ • ᴨ᯾૬૬୏რӾᳵ੶᫫ᨮ᫹࣐ᤍԾߝ Nacos

4. Ջԍฎ “Ꮭᨮ᫹”Ҙ Organiza(on’s,DMZ ᴠᅉा DMZ ࢥ੶ ᫫կ • 4੶Ꮭկᨮ᫹࣐ᤍ • f5/lvs,᪠ኧ࢏,ᗑᕶNAT Ӡ੶ Ꮭկ • 7੶‫ݻݍ‬դቘᵞᗭ • nginx/apache/haproxy • ۖᶉ‫ړ‬ᐶ • ‫ړ‬ၞ޾᪠ኧ Ꮭᨮ᫹ ฎ೰փᕹጱմӱᕆದ๞ຝ຅Ӿࣁ ၞᰁഴ‫׆ګ‬؇᯿ԭֵአᏝկᨮ᫹࣐ᤍ࢏̵؇ ٖ᮱ᗑ‫ى‬ᨮ᫹࣐ᤍ࢏ ᯿ԭࢥ੶ᨮ᫹࣐ᤍ̵؇᯿ԭᵞӾጱᗑ‫ى‬դቘ • F5 ཛྷୗ҅؇᯿ԭServer-Based Load Balanceጱ • LVS Ӟᔮ‫ڜ‬ጱਫ᪢ොဩ̶

5. “Ꮭᨮ᫹”ᶎԁጱԾӱ᩽۠೴౴ • ؇4੶ᨮ᫹࣐ᤍ • ၞᰁጱӧᏟਧ௔҅ᵱᥝ୨௔޾ᅎၚ௔ ԰ᘶᗑ • IDCٖ᮱ጱ๢࢏ԏᳵጱၞᰁԞஉय़ • ‫ဳى‬ᨮ᫹࣐ᤍ࢏ጱ‫ۑ‬ᚆጱ‫ݢ‬ಘ઀௔ • ᗑ‫ܔى‬ᅩᵙզၾᴻ҅ඳᵑ௩॔ౌ ԯᦇᓒ • ၞᰁጱᔜᕡഴ‫੶ࢥ҅ګ‬ᨮ᫹࣐ᤍᵙզቘᥴӱ‫᧍ۓ‬Ԏ • ஠ᶳ‫ဳى‬౮๜ DevOps • ‫ဳى‬ෆӻᨮ᫹֛ᔮጱ‫ݢ‬ᬩᖌ௔,‫ݢ‬඙֢௔,‫ݢ‬ᓕቘ௔

6. ᫫ᨮ᫹ • ؇᯿ԭ7੶ᨮ᫹࣐ᤍ • ᫫կਧԎၞᰁ࣐ᤍᒽኼ • ቘᥴӱ‫᧍ۓ‬Ԏጱၞᰁ᧣೟ • හഝ޾ᓒဩḝۖጱᔜᕡၞᰁഴ‫ګ‬ᒽኼ • ಘ઀௔޾ᅎၚ௔ • ‫ݢ‬඙֢௔

7. ӡᇔጲ“๐‫”ۓ‬ զ๐‫ۓ‬ԅӾஞጱሿդଫአຝ຅᩽۠ service Service-Centric Architecture

8. ங๐‫ۓ‬ጱचᎪ - ๐‫ݎۓ‬ሿӨဳٙӾஞ Server • ս۠ • ‫۠ە‬ • ֺৼ Client • ս۠ • ‫۠ە‬ • ֺৼ • ‫ف׍‬ੜ • ᗑ‫ى‬ୗ҅ํ‫ܔ‬ᅩ • ෫‫ܔ‬ᅩ • ‫ف׍‬य़ Based • Nginx • DNS • ฃᵞӾᓕഴ • ౮๜ṛ • LVS • Maglev Based • ᵋଫአᛔᆐ֐ᖽ • ౮๜֗ • ᵙᵞӾᓕഴ • Ribbon & Eureka • Service Mesh च च ԭ ԭ ਮ ๐ ಁ ‫ۓ‬ ᒒ ᒒ ᒒ ᨮ ᨮ ᫹ ᫹ ࣐ ࣐ ᤍ ᤍ ࢶᇆ๶ᛔ microservices.io

9. ᴨ᯾૬૬9ଙ‫݌‬11Ӿጱ᫫ᨮ᫹ਫ᪢ • ᕹӞള‫ف‬ • ᕚӤۖாᵍᐶሾह • ஙᅍଶ • ‫زܔ‬۸݊୑ࣈग़ၚ • ၞᰁ᧣ଶ

10. ᕹӞള‫ف‬ PC ᕹӞള‫ف‬ • ۖᶉ‫ړ‬ᐶ • https‫ے‬᭛&ᦤԡᓕቘ ᕹӞള‫ف‬ ᨻᇔ᫣ ࠟߝ Իฃ ඪ՞ • ‫ݗف‬ၞᰁጱᴴၞ (Tengine) ෫ᕚ • ἓᅍၞᰁႴ။҅ਞ‫ق‬ ᴠධ‫ڋ‬ • ฬᚆၞᰁ᫨‫ݎ‬ᒽኼҁአ IoT ಁᇙ஄၏੊҂ ᕹӞള‫ف‬ ᨻᇔ᫣ ࠟߝ Իฃ ඪ՞ (Tengine) • ᭦ᬋ‫ړ‬ၞӨ਻ᅒ Ӿᳵ੶ᨮ᫹࣐ᤍ • ඪ೮᱾᪠᭄᪵ IAAS

11. ۖாᵍᐶሾह ၥᦶሾहҁTest҂ ፥ਫኞԾሾह ܴၥၞᰁ ፥ਫኞԾၞᰁ ᕹӞള‫੶ف‬ ᶼኞԾሾहҁStage҂ • ۖாሾहvsᶉாሾह • ໑ഝᵱ࿢ۖாኞ౮຤ӻሾह • ౮๜֗ ኞԾሾहҁProduction҂ • ᭦ᬋᵍᐶ vs ᇔቘᵍᐶ • ᭦ᬋᵍᐶๅᅎၚ • ᒧ‫ݳ‬୨௔ᒵᵱ࿢ ኞԾ๐‫ړۓ‬ᕟ ᕚӤܴၥ๐‫ړۓ‬ᕟ Ӿᳵ੶ᨮ᫹࣐ᤍ(Mid-Tier ඪ೮ۖா̵᭦ᬋᵍᐶ LoadBalancer)

12. ஙᅍଶ • ᅍଶපሲᳯ᷌ • භഠ‫ڠ‬ෛ޾ᦶᲙ • ොဩ A/B Testing • ‫ݸ‬ᒒၥᦶᵙ • ֗౮๜ಘ઀ग़ॺሾह • ᱾᪠ວᜋ • Ӥӥ჋ׁᩢ᱾᪠॔๥ ҅ • ੒ӱ‫ۓ‬0‫ف׍‬ጱᅍଶ • ๦᯿᪠ኧ޾ၞᰁഴ‫ګ‬ ෛၥᦶሾह᮱ᗟࢯᵙ ၥᦶሾह޾ಋྦྷ • ᱾᪠٫ᑱ༄ၥ • ᕚӤහഝ޾᱾᪠ᇫா • ᕚӤ፥ਫၞᰁ • ᩒრ‫ܛ‬አਭ໐ ᵙզճ፥ • ਻ᰁᓕቘ • ᱾᪠ੴ᮱‫ڠ‬ෛ޾ս۸ ᵙ create ஙᅍଶ1 ᥢ‫ڞ‬ - 3% ၞᰁ -’label-1’ create ஙᅍଶ1 ᥢ‫ڞ‬ -10% ၞᰁ -’label-2’

13. ‫زܔ‬۸݊୑ࣈग़ၚ ᕹӞള‫੶ف‬ ‫܄‬ऒ‫ زܔ‬A ᕹӞള‫ & ف‬Ӿᳵ੶ᨮ᫹࣐ᤍ Ӿᳵ੶ᨮ᫹࣐ᤍ • ᦩ‫ڦ‬አಁᇙ஄ • ᦩ‫ڦ‬ၞᰁ‫܄‬ऒᇙ஄ ‫܄‬ऒ‫ زܔ‬B CDN • ᦩ‫ڦ‬IDC‫૲ړ‬೐ಏᕮ຅ Ӿᳵ੶ᨮ᫹࣐ᤍ • ඪ೮ၞᰁ๦᯿ഴ‫ګ‬ ‫܄‬ऒ‫ زܔ‬C • ᦩ‫ڔڦ‬ၞ&਻ᅒᥢ‫ڞ‬ Ӿᳵ੶ᨮ᫹࣐ᤍ

14.ၞᰁ᧣ଶ • Metrics හഝතᵞ • ໑ഝᵱ࿢ۖாኞ౮຤ӻሾह • ౮๜֗ • ෸ଧහഝਂ‫ؙ‬ • ෸ଧ޾෸ᑮහഝପ • හഝ‫ړ‬ຉ&ᓒဩ • ෸ଧ޾෸ᑮහഝପ • ‫ق‬ੴᛔۖ٬ᒽ • ᴳ๦᯿ • ਧᅩഴ‫ګ‬ᬢᑏ • ӥᕚ • ᴇ꧊‫כ‬ಷ҅ᴠᵪૄ चԭහഝ޾ᓒဩḝۖጱᛔۖ ٬ᒽ҅ᔜᕡጱၞᰁ᧣ଶ

15. ෆ֛ຝ຅ܻቘ • ᔮᕹ಑᭗ ӱ‫ۓ‬ၞᰁ • Ӿᳵ੶ᨮ᫹࣐ᤍӨCMD • Ӿᳵ੶ᨮ᫹࣐ᤍӨAPI Gateway ᔜᕡၞᰁᥢ‫੶ڞ‬ Ӿᳵ੶ᨮ᫹࣐ᤍ • ᯈᗝӾஞӨၞᰁᥢ‫ڞ‬ • चᏐӾᳵկӨӾᳵ੶ᨮ᫹࣐ᤍ • Ӿᳵ੶ᨮ᫹࣐ᤍӨӱ‫ۓ‬ଫአ ᕹӞള‫ف‬ ஙᅍଶ ሾहᵍᐶ ‫زܔ‬۸ DPath ဳٙӾஞ m • ቘᥴӱ‫ۓ‬ၞᰁ e • cookie҅path҅param DNS-SD t ‫ق‬ੴၞᰁ᧣ଶ • header Ӿᳵկ੶ r • ๢಄೐ಏ ҁහഝḝۖ҂ i RPC ၾ௳ ‫૲ړ‬ୗᖨਂ ‫૲ړ‬ୗහഝପ ᯈᗝӾஞ • ‫ق‬຾metrics c • ՗ᗑᕶ҅඙֢ᔮᕹ҅tomcat҅ᖨ s ਂ҅RPC҅ӱ‫ۓ‬᮷ᥝูᶂ‫ݳ‬ᭇጱ ‫૲ړ‬ୗ‫᧣ܐ‬ ᇫாහഝ DNS(bind) Tengine LVS • ୩य़ጱӾᳵ੶ᨮ᫹࣐ᤍ • य़ᥢཛྷහഝ‫޾ݎړ‬വᭆᚆ‫ێ‬ ᇙྛᏝկ‫ے‬᭛ CMDB ਂ‫ᦇ&ؙ‬ᓒଘ‫ݣ‬ • හഝḝۖ • හഝӾஞᇫாහഝ ᩒრ᧣ଶ • ਫ෸௔‫כ‬ᵑ • य़හഝҁᦇᓒଘ‫ݣ‬҂ • Ոૡ+ฬᚆጱ٬ᒽ IAAS (ᗑᕶ҅Ԇ๢҅඙֢ᔮᕹ҂ • ӧෙදᬰᓒဩ • ๢࢏਍ԟොဩ

16. “๐‫ݎۓ‬ሿ”vs“᫫ᨮ᫹”(weight) Registry Registry ๐‫ݎۓ‬ሿ ၞᰁഴ‫ګ‬ tell me tell me svc1’s endpoints! register svc1’s register endpoints! Consume Provide Provide Consume ip1,ip2,i p3 {ip1} request flow request flow ip1:port1/ ip1:port1/ svc1 svc1 ip2:port2/ ip2:port2/ Consume ip1,ip2,ip3 svc1 Consume svc1 {ip1,ip2,ip3} ip3:port2/ ip3:port2/ svc1 svc1

17. ๐‫ݎۓ‬ሿ vs ᫫ᨮ᫹ (label match&selector) Registry Registry ๐‫ݎۓ‬ሿ ۖா୭ᕟ tell me tell me svc1’s svc1’s endpoints! register endpoints! register Provide Consume Provide Consume ip1,ip2,i {ip1,ip2} p3 request flow request flow ip1:port1/ ip1:port1/ svc1 svc1 ip2:port2/ ip2:port2/ svc1 Consume svc1 Consume {ip3} ip1,ip2,ip3 ip3:port2/ ip3:port2/ svc1

18.᫫ᨮ᫹ጱचᎪ - Label Based & Weight label based weight (metadata) (0.1ᔜଶ)

19.“᫫ᨮ᫹”Өෛದ๞᩽۠ • Service Mesh • ฎclient base LB ᬮฎ server baseҘ • service meshԅ֜ᥝඪ೮๦᯿᪠ ኧҘ • Traffic Management ጱ๜ᨶฎՋ ԍ? • Kubernetes DNS-SD • ՋԍฎDNS-SDҘ • Label selector Service Mesh य़ᥢཛྷኞԾଫ አԏ “ᴨ࠶቙ේԏ᪺“ - 1. ௔ᚆኒ᷀ - 2. ၞᰁလቘጱಘ઀௔Ө௔ᚆጱ ଘᤍ ౲ํᥴ٬ԏ᭲҅֕຤Ӟ੶஠ᶳ‫ݒ‬ ᶐ…

20. ᴨ᯾૬૬᭑ྍਖ਼“᫫ᨮ᫹֛ᔮ”୏რ޾୏න” ာኪ֛ࠟᔮ य़෈ৈ ൤ᔱ&ଠ‫ޞ‬ ࢵᴬ۸ ҁॠሞ̵Ⴃਪ̵ោề̵‫و‬ ҁսᯡ̵ᴨ᯾୽ӱ̵ ҁ൤ᔱ̵ᴨ᯾ঌ ṛ஛ࣈࢶ ҁLazada,AliEx ᴨ᯾ԯ ਞ‫ق‬ Ձӱ‫ۓ‬ଘ‫̵ݣ‬ᘸ‫ښ‬ᓒ̵ፋ ঌ…҂ ᴨ᯾ᶪԔ…) press҂ Ḙ …) ᫫ᨮ᫹࣐ य़හഝᦇ ୑ࣈग़ၚ ๐‫ۓ‬လቘ ๐‫ۓ‬ᖫഭ ၞᰁ᧣ଶ ሾहᵍᐶ ୨௔ᦇᓒ ‫ڔ‬ପ਻ᅒ ᶼໜᴴၞ ձ‫᧣ۓ‬ଶ ᤍ ᓒ OPS Service Health Dynamic Intelligent Traffic Mgr Config Push Meta KV Distributed Discovery Check DNS Route Service Service Coordinator user ᴨ᯾૬૬୏რ portal ConfigServer VIPServer Diamond TaoKeeper ‫૲ړ‬ୗӞᛘ௔(ZAB,Piv-Raft,Gossip,SW,Async- Log Nacos Notify,Timer-DUMP) Name Nginx/ Server LVS &Stre am admin portal MySQL Derby Disk File CMDB GNS ETCD REGI REGION REGION IDC IDC IDC IDC IDC IDC https://github.com/alibaba/nacos

21. Nacos - ඪ೮Metadata ޾ WeightጱဳٙӾஞ Nacos 1.0 Service Infra Dubbo 4.0 + Nacos 2.0 - An Open ๐‫ဳۓ‬ٙӨ‫ݎ‬ሿ Service Platform ๐‫زۓ‬හഝᓕቘ ๐‫ۓ‬ᬳളӨ᧣አ ๐‫ۓ‬ᯈᗝᓕቘ ๐‫ۓ‬؋଼ᓕቘ ๐‫ۓ‬ኞ޸ޮ๗ᓕቘ ๐‫ۓ‬ᴴၞӨᆤෙ ๐‫ۓ‬೐ಏׁᩢ‫ړ‬ຉ ሾहᵍᐶ Service Traffic ඳᵑᵍᐶ Managem service Management ฬᚆ᪠ኧ Kubernetes Dubbo ჻ۖ‫܋‬ᕆ ᨮ᫹࣐ᤍ ኞா ኞா Service-Centric Architecture ๐‫ۓ‬୨௔ ၞᰁ᧣ଶ Nacos ๐‫ۓ‬SLAᓕቘ Service սᵝӤӥᕚ ๐‫ۓ‬ਞ‫ق‬ᒽኼ Integration&Mark ୑ࣈग़ၚ eting Spring ኞா ๐‫وۓ‬Ձ ๐‫ᦓܐۓ‬᫨ഘ ๐‫ۓ‬ፓ୯ᓕቘ ๐‫ۓ‬ᘸᵞӨᵞ౮ ๐‫ۓ‬᪜ऒလቘ ๐‫ᦧۓ‬հᔮᕹᓕቘ ᭳ኸᔮᕹᵞ౮

22. ‫فے‬౯ժ Nacos ᐒ‫܄‬Իၞᗭ 9 ᗭ ᴨ᯾૬૬Ӿᳵկங‫لמ‬ռ‫ݩ‬ https://nacos.io https://github.com/alibaba/nacos

23. ௛ᕮ • ਧԎଚՕᕨԧ᫫ᨮ᫹ጱ༷ஷ • Օᕨԧᴨ᯾૬૬चԭ᫫ᨮ᫹ጱଫአ࣋ว݊ದ๞֛ᔮ • Օᕨԧ๐‫ݎۓ‬ሿ‫ک‬᫫ᨮ᫹ጱቘஷᦊᎣ‫܋‬ᕆ • Օᕨԧහഝᓒဩḝۖጱᔜᕡၞᰁഴ‫ګ‬ጱ “᫫ᨮ᫹”ቘஷ

24.