58速运 微服务落地实践之填坑大法

58速运 微服务落地实践之填坑大法
主要分享
1.存在问题
2.58速运微服务落地实践
3.总结

展开查看详情

1.58᭛ᬩ ங๐‫ۓ‬៧ࣈਫ᪢ԏऴࣗय़ဩ ձ໘๞@58᭛ᬩ

2.ፓ୯ • ਂࣁᳯ᷌ ᘠ‫ݳ‬ଶṛ̵։๐‫ۓ‬ • 58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ ᔮᕹೆ‫ړ‬ਫ᪢&ဳ఺Ԫᶱ ։๐‫ۓ‬ද᭜ਫ᪢&ဳ఺Ԫᶱ • ௛ᕮ

3.ᳯ᷌ - ᘠ‫ݳ‬ଶṛ • ଫአᔮᕹ੶ ᭛ᬩ ᭛ᬩ ‫ݪ‬๢ᒒ$SS ‫ݪ‬๢ᒒ$SS ‫ݪ‬๢ᒒwebsite ‫ݪ‬๢ᒒwebsite ᦈ‫ܔ‬๐‫ۓ‬ ٌ՜๐‫ۓ‬ ಶ‫ܔ‬ ಭຽ *36᯾ᑕ ŏ ᦈ‫ܔ‬ള‫ݗ‬ ᦧհള‫ݗ‬ ᦈ‫ܔ‬ᓕቘ ‫ޞل‬ ‫ݪ‬๢‫௳מ‬ ŏ ൪ਹአಁ ඪ՞‫௳מ‬ ᑌ‫ࠟړ‬उ ‫כ‬ᵑᰂᗈᕑ ‫ݪ‬๢ձ‫ۓ‬ ŏ ࢧᦢ Webଫአ ཛྷࣘᘠ‫ݳ‬ ᦈ‫ؙਂܔ‬ ๐‫ ۓ‬ള‫ݗ‬ᘠ‫ݳ‬

4.ᳯ᷌ - ᘠ‫ݳ‬ଶṛ ᭛ᬩ • හഝପ੶ ‫ݪ‬๢ᒒ$SS ‫ݪ‬๢ᒒwebsite ᦈ‫ܔ‬๐‫ۓ‬ ٌ՜๐‫ۓ‬ ᦈ‫ؙਂܔ‬ හഝପ හഝᶱᤒᘠ‫ݳ‬

5.ᳯ᷌ - ։๐‫ۓ‬ • 58᭛ᬩ։๐‫ۓ‬ᇙᅩ 1. ᓌ‫ܔ‬DAO੶੗ᤰ҅ӧ۱‫ولތ‬ӱ‫ۓ‬੗ᤰ ӱ‫ۓ‬᭦ᬋ‫ړ‬ව҅॔‫̵ګ‬ᔌᩂ҅Ӟӻੜᵱ࿢n‫ڡ‬ද̵ၥҔ 2.ᖨਂӶࣁ᧣አො҅ӱ‫ۓ‬ොᵱᥝ‫(ؙਂဳى‬አಁ‫)׆ݣݸ̵׆‬Ҕ ᨵጱ ൪ਹ սᯈ ZHEVLWH ZHEVLWH ZHEVLWH ӱ‫॒ۓ‬ቘ ӱ‫॒ۓ‬ቘ ӱ‫॒ۓ‬ቘ FDFKH FDFKH ᦈ‫ܔ‬๐‫ۓ‬ ᦈ‫ܔ‬๐‫ۓ‬ አಁ‫׆‬ ‫׆ݣݸ‬ ᦈ‫ܔ‬ ᦈ‫ݣݸܔ‬ପ P\VTO P\VTO FDQDO ‫ྍݶ‬Ԁᤈ

6.ெԍ‫ې‬Ҙ

7.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - ᔮᕹೆ‫ړ‬ ᭛ᬩ • ӱ‫࣮ۓ‬ፗೆ‫ړ‬ ‫ݪ‬๢ᒒ$SS 1. ӱ‫ۓ‬༂ቘ҅ཛྷࣘ୭ᔄҔ ಶ‫ܔ‬ᓕቘZHE 2. ׁᩢො༂ቘҔ Webଫአ ᦈ‫ܔᦈ ܔ‬ ‫ݪ‬๢ӻՈӾஞZHE ‫ݪ‬๢ ‫ݪ‬๢ ‫כ‬ᵑ ᬩ០ଘ‫ݣ‬ZHE ᑌ‫ޞل ړ‬ ٌ՜ZHE ࣮ፗೆ‫ړ‬ ಶ‫ܔ‬ 3. ຅ୌෛᔮᕹҔ ‫ڜ‬ᤒ ᧇఘ ձ‫ ௳מ ۓ‬ᰂ᷐ ࠟउ ᭗Ꭳ 4. വᬰׁᩢොള‫ف‬ෛᔮᕹҔ ᦈ‫ܔ‬๐‫ۓ‬ ‫ݪ‬๢‫௳מ‬๐‫ۓ‬ ‫כ‬ᵑᰂ๐‫ۓ‬ ٌ՜๐‫ۓ‬ 5. ෭பᏟᦊ‫ق‬᮱ള‫ف‬ෛᔮᕹҔବ੶๐‫ۓ‬ ᦈ‫ܔᦈ ܔᦈ ܔᦈ ܔ‬ ‫ݪ‬๢ ‫ݪ‬๢ ᯈ ᗈ ൉ ŏ ŏ ŏ ‫ڠ‬ୌ ‫ݐ‬ၾ ັᧃ ਠ౮ ‫ے‬ፑ ձ‫ۓ‬ ᗝ ᕑ ‫ݐ‬ 6. ӥᕚധ෯ᔮᕹҔ ࣮ፗೆ‫ړ‬ ᦈ‫ؙਂܔ‬ ‫ݪ‬๢ਂ‫ؙ‬ ‫כ‬ᵑᰂਂ‫ؙ‬ ਂ‫ؙ‬ • ဳ఺Ԫᶱ 1. ᭿‫ع‬᭳ᄋׁᩢොҔ 2. ‫ࠟܐ‬অ෸ᳵᜓॵ҅᭿‫ع‬᫾ᳩ෸ᳵᖌಷӷӻଫአҔ 3. ‫ྍړ‬඙֢(step1:ऒ‫̵ݷ‬ള‫ݗ‬ӧ‫ݒ‬Ҕstep2:चԭෛᔮᕹٚ᯿຅) 4. ‫ڔ‬ணᓌ‫ܔ‬೩ᨬդᎱԧԪ

8.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - හഝೆ‫ړ‬ •හഝ‫݌‬ٟ ଘჶᬢᑏ҅ӧ୽ߥᕚӤӱ‫ۓ‬Ҕ හഝӞᛘ௔Ҕ ᦈ‫ܔ‬๐‫ۓ‬ ᦧհ๐‫ۓ‬ ඪ՞๐‫ۓ‬ ᦈ‫ؙਂܔ‬ ᦧհᦕ୯ ਂ‫ؙ‬ ඪ՞ᦕ୯ ਂ‫ؙ‬ ࢧᦢ๐‫ۓ‬ ࢧᦢᦕ୯ ਂ‫ؙ‬

9.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - හഝೆ‫ړ‬ • හഝ‫݌‬ٟ(՗ᦈ‫ܔ‬ପӾᬢᑏ‫ڊ‬አಁࢧᦢᦕ୯ԅֺ) ZHEVLWH ZHEVLWH ᦈ‫ܔ‬๐‫ۓ‬ Ӥᕚᦈ‫ܔ‬๐‫݌҅ۓ‬ٟᦈ‫ܔ‬෯ପ޾ࢧᦢෛପғ ᦈ‫ܔ‬๐‫ۓ‬ Ӥᕚᦈ‫ܔ‬๐‫݌҅ۓ‬ٟᦈ‫ܔ‬෯ପ޾ࢧᦢෛପғ GHOHWH̵LQVHUW̵XSGDWH GHOHWH̵LQVHUW̵XSGDWH ᦈ‫ܔ‬෯ପ ࢧᦢෛପ ᦈ‫ܔ‬෯ପ ࢧᦢෛପ ᦈ‫ᦕܔ‬୯ࢧᦢᦕ୯ ‫ᦕᦢࢧํݝ‬୯ ᦈ‫ᦕܔ‬୯ࢧᦢᦕ୯ ‫ᦕᦢࢧํݝ‬୯ VHOHFW෯ପ VHOHFWෛପ ັᧃ‫ڊ‬ᵱᥝᬢᑏጱහഝ ฎ‫ވ‬૪ᬢᑏ LI ෯ପํᦕ୯ ෛପ෫҂ හഝᬢᑏjob LQVHUWᦕ୯‫ک‬ෛପӾ ᄟࣁଚ‫ݎ‬ᳯ᷌

10.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - හഝೆ‫ړ‬ • ଚ‫ݎ‬ఘ‫݌ ٭‬ٟӾጱdelete඙֢ ྋଉғইຎᦕ୯๚ᬢᑏ‫ک‬ෛପӾ҅‫ڢݝ‬ᴻ෯ପᦕ୯‫ݢܨ‬Ҕ‫ڞވ‬ෛ̵෯ପ᮷ಗᤈ‫ڢ‬ᴻ඙֢Ҕ ZHEVLWH ᦈ‫ܔ‬๐‫ۓ‬ GHOHWHෛପ GHOHWH෯ପ ᦈ‫ܔ‬෯ପ ࢧᦢෛପ ᦈ‫ᦕܔ‬୯ࢧᦢᦕ୯ ‫ᦕᦢࢧํݝ‬୯ VHOHFW෯ପ VHOHFWෛପ හഝᬢᑏjob LI ෯ପํᦕ୯ ෛପ෫҂ LQVHUWᦕ୯‫ک‬ෛପӾ ᄟࣁᳯ᷌ғࢧᦢ๐‫ۓ‬ෛପӾ҅տग़‫ڊ‬ӞԶᦕ୯

11.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - හഝೆ‫ړ‬ •ଚ‫ݎ‬ఘ‫݌ ٭‬ٟӾጱdelete඙֢ ᄟࣁᳯ᷌ғ ࢧᦢ๐‫ۓ‬ෛପӾ҅տग़‫ڊ‬ӞԶᦕ୯(ᧆ‫ڢ‬ᴻ҅‫ܩ‬ဌํ‫ڢ‬ᴻധ) 58᭛ᬩਫ᪢ғ ྯᵍn‫ړ‬ᰦ໊҅ḵn‫ړ‬ᰦ‫ڹ‬ᬰᤈᬢᑏጱහഝ҅ฎ‫ࣁވ‬ෛପӾํӬ෯ପӾဌํ ਂࣁᧆఘ‫ڢڞ҅٭‬ᴻෛପӾጱᦕ୯Ҕ

12.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - හഝೆ‫ړ‬ • ଚ‫ݎ‬ఘ‫݌ ٭‬ٟӾጱinsert඙֢ ZHEVLWH ᦈ‫ܔ‬๐‫ۓ‬ LQVHUWෛପ LQVHUW෯ପ ᦈ‫ܔ‬෯ପ ࢧᦢෛପ ᦈ‫ᦕܔ‬୯ࢧᦢᦕ୯ ‫ᦕᦢࢧํݝ‬୯ VHOHFW෯ପ VHOHFWෛପ හഝ‫ྍݶ‬job LI ෯ପํᦕ୯ ෛପ෫҂ LQVHUWᦕ୯‫ک‬ෛପӾ ᄟࣁᳯ᷌ғࢧᦢ๐‫ۓ‬ෛପӾ҅տग़‫ڊ‬ӞԶᦕ୯ ᴻԧහഝ໊ḵक़҅LQVHUW෸ᬮํٌ՜᭿‫ع‬ଚ‫ݎ‬ᳯ᷌ጱොဩԍҘ

13.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - හഝೆ‫ړ‬ •ଚ‫ݎ‬ఘ‫݌ ٭‬ٟӾጱinsert඙֢ ᄟࣁᳯ᷌ғ ࢧᦢ๐‫ۓ‬ෛପӾ҅տग़‫ڊ‬ӞԶᦕ୯(᯿॔insert) ZHEVLWH 58᭛ᬩਫ᪢ғ ‫ض‬ಗᤈෛପጱinsert҅ ᦈ‫ܔ‬๐‫ۓ‬ LQVHUWෛପ step5๵կӧ౮ᒈҔ LQVHUW෯ପ (stpe2̵step3Ԁᤈ) ᦈ‫ܔ‬෯ପ ࢧᦢෛପ ᦈ‫ᦕܔ‬୯ࢧᦢᦕ୯ ‫ᦕᦢࢧํݝ‬୯ ইຎstep2 insert෯ପ०ᨳ҅ VHOHFW෯ପ VHOHFWෛପ ᵱᥝࢧ჻ෛପinsert඙֢Ҕ ັᧃ‫ڊ‬ᵱᥝᬢᑏጱහഝ හഝ‫ྍݶ‬job LI ෯ପํᦕ୯ ෛପ෫҂ LQVHUWᦕ୯‫ک‬ෛପӾ

14.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - හഝೆ‫ړ‬ • ଚ‫ݎ‬ఘ‫݌ ٭‬ٟӾጱupdate඙֢ 58᭛ᬩਫ᪢ғ updateೆ‫ړ‬ԅ੒ෛପ‫ض‬ᬰᤈdelete඙֢҅ٚᬰᤈinsert඙֢ ‫݌‬ٟጱdelete̵insert඙֢ᥴ٬‫݌҅ݸ‬ٟupdate඙֢Ԟ੪ᥴ٬ԧҔ ZHEVLWH හഝๅෛ ັᧃӱ‫ۓ‬ ໊ḵᇙ‫ڦ‬᯿ᥝғ ᦈ‫ܔ‬๐‫ۓ‬ ଚ‫ݎ‬හഝӞᛘ௔໊ḵҔ ‫݌‬ٟๅෛ ು໏໊ḵҔ ᦈ‫ܔ‬෯ପ ࢧᦢෛପ ັᧃӱ‫ڔضۓ‬ഘҔ ᦈ‫ᦕܔ‬୯ࢧᦢᦕ୯ ‫ᦕᦢࢧํݝ‬୯ VHOHFW෯ପ VHOHFWෛପ LI ෯ପํᦕ୯ ෛପ෫҂ හഝ‫ྍݶ‬job LQVHUWᦕ୯‫ک‬ෛପӾ

15.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - ։๐‫ۓ‬ද᭜ • ᕹӞӱ‫ۓ‬ӥဃԅ๐‫ۓ‬ • ᕹӞӞӻᦈ‫ܔ‬๐‫ۓ‬ ᨵጱ ൪ਹ սᯈ ᨵጱ ൪ਹ սᯈ ZHEVLWH ZHEVLWH ZHEVLWH ZHEVLWH ZHEVLWH ZHEVLWH ӱ‫॒ۓ‬ቘ ӱ‫॒ۓ‬ቘ ӱ‫॒ۓ‬ቘ ᕹӞӱ‫॒ۓ‬ቘ LI ᨵጱ ^ FDFKH FDFKH ᦈ‫ܔ‬๐‫ۓ‬ ŏŏ ᦈ‫ܔ‬๐‫ۓ‬ ᦈ‫ܔ‬๐‫ۓ‬ ᕹӞӱ‫॒ۓ‬ቘ `HOVHLI ൪ਹ ^ አಁ‫׆‬ ‫׆ݣݸ‬ ŏŏ `HVOHLI սᯈ ^ ᦈ‫ܔ‬ ᦈ‫ݣݸܔ‬ପ FDFKH ᦈ‫ܔ‬ ᦈ‫ݣݸܔ‬ପ ŏŏ P\VTO P\VTO P\VTO P\VTO ` FDQDO ‫ྍݶ‬Ԁᤈ FDQDO ‫ྍݶ‬Ԁᤈ

16.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - ๐‫ۓ‬ද᭜ • Ԁᤈ‫ྍݶ‬හഝ҅௔ᚆᳯ᷌ ᨵጱ ൪ਹ սᯈ ZHEVLWH ZHEVLWH ZHEVLWH ᦈ‫ܔ‬ ᦈ‫ݣݸܔ‬ପ ᦈ‫ܔ‬๐‫ۓ‬ P\VTO P\VTO ᕹӞӱ‫॒ۓ‬ቘ XSGDWHPVJ XSGDWHPVJ XSGDWHPVJ XSGDWHPVJ ᦈ‫ܔ‬ ᦈ‫ݣݸܔ‬ପ XSGDWHPVJ XSGDWHPVJ FDFKH P\VTO P\VTO PT ୑ྍ FDQDO ୑ྍ‫ྍݶ‬හഝ҅Ԥଧ੕ᛘහഝӧӞᛘ ‫ྍݶ‬Ԁᤈ ӧᥝԅੜ༷ሲԪկ҅୽ߥෆ֛

17.58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ - ๐‫ۓ‬ද᭜ • ୑ྍ۸&ES ᨵጱ ൪ਹ սᯈ ᨵጱ ൪ਹ սᯈ ZHEVLWH ZHEVLWH ZHEVLWH ZHEVLWH ZHEVLWH ZHEVLWH ᦈ‫ܔ‬๐‫ۓ‬ ᦈ‫ܔ‬๐‫ۓ‬ ᕹӞӱ‫॒ۓ‬ቘ ᕹӞӱ‫॒ۓ‬ቘ FDFKH ᦈ‫ܔ‬ ᦈ‫ݣݸܔ‬ପ FDFKH ᦈ‫ܔ‬ P\VTO P\VTO ᦈ‫(ܔ‬6ପ P\VTO ᦈ‫ܔ‬P\VTO ᦈ‫(ܔ‬6ପ FDQDO ၾ௳വᭆ ೉‫๋ݐ‬ෛᦈ‫ܔ‬ ‫ྍݶ‬Ԁᤈ PT ୑ྍ XSGDWHPVJ JHW2UGHU%\,G አ๋ෛᦈ‫ᦕܔ‬୯ XSGDWHPVJ ᯿ୌ(6ᔱ୚ XSGDWHPVJ PT ୑ྍ ๋ᕣӞᛘ

18.௛ᕮ • ਂࣁᳯ᷌ ᘠ‫ݳ‬ଶṛ̵։๐‫ۓ‬ • 58᭛ᬩங๐‫ۓ‬៧ࣈਫ᪢ ᔮᕹ࣮ፗೆ‫ړ‬ғ 1.ӱ‫ۓ‬༂ቘҔ2.ဋ᭗വᬰҔ හഝଘჶᬢᑏғ 1.‫݌‬໊ٟḵҔ ๐‫ۓ‬ද᭜ғ 1.ᕹӞӱ‫ۓ‬ӥဃԅ๐‫҅ۓ‬Ӟӻࣈොදۖ‫ݢܨ‬Ҕ 2.ӧᥝԅੜ༷ሲԪկ҅୽ߥෆ֛Ҕ 3.හഝ๋ᕣӞᛘ௔ਫ᪢Ҕ