$30 off During Our Annual Pro Sale. View Details »

Microservices on “Rails” - Wantedly のマイクロサービス事例

Altech
March 24, 2018

Microservices on “Rails” - Wantedly のマイクロサービス事例

Altech

March 24, 2018
Tweet

More Decks by Altech

Other Decks in Programming

Transcript

  1. ©2018 Wantedly, Inc. 4PIFJ5BLFOP !"MUFDI@  ೥8BOUFEMZೖࣾ  8BOUFEMZ7JTJUͷ։ൃΛ೥ؒ୲౰ 

    άϩʔεɺݕࡧɾਪનɺσʔλج൫ɺ ։ൃج൫ͳͲ  ݱࡏ͸ϓϩϑΟʔϧج൫νʔϜΛϦʔυ  ޷͖ͳϓϩάϥϛϯάݴޠ͸3VCZ ࣗݾ঺հ
  2. ©2018 Wantedly, Inc. ⾣ αʔϏε঺հ ⾣ 8BOUFEMZ1FPQMFͷࣄྫ w ։ൃظؒɾ։ൃମ੍ w

    ΞʔΩςΫνϟɾΠϯϑϥ w ϦϦʔε࣌ͷTFSWJDFߏ੒ w ݱࡏͷTFSWJDFߏ੒ w ։ൃ͢Δ্Ͱͷ޻෉ ⾣ 8BOUFEMZ7JTJU͔Βͷ෼ׂ ໨࣍
  3. ©2018 Wantedly, Inc. ⾣ Πϯϑϥɿ%PDLFS,VCFSOFUFT w %PDLFS೥͝Ζ͔Βຊ൪ӡ༻ w ,VCFSOFUFT೥݄ࠒ͔Βࢼݧӡ༻ ⾣

    ΞʔΩςΫνϟɿϚΠΫϩαʔϏε w ίϯςφٕज़ɺ+40/"1*ʹΑΔ௨৴ˠಛఆͷݴޠʹґΒͳ͍։ൃ w ࣮ࡍʹ1FPQMFͰ࢖༻͞Εͨݴޠɿ3VCZ 3BJMT (P 1ZUIPO $ ΠϯϑϥɾΞʔΩςΫνϟ
  4. ©2018 Wantedly, Inc. ⾣ ໊͕ࢗεΩϟϯͰ͖Δ ϦϦʔε࣌ͷػೳ • ໊ࢗྖҬநग़ • จࣈྻநग़

    • จࣈྻΧς ΰϦਪఆ • Ϣʔβݕࡧ ΫϥΠΞϯτͰॲཧ αʔόʔͰॲཧ
  5. ©2018 Wantedly, Inc. ⾣ ໊͕ࢗεΩϟϯͰ͖Δ ϦϦʔε࣌ͷػೳ • ໊ࢗྖҬநग़ • จࣈྻநग़

    • จࣈྻΧς ΰϦਪఆ • Ϣʔβݕࡧ ΫϥΠΞϯτͰॲཧ αʔόʔͰॲཧ Categorizer X-Finder OCR Microservice Խ
  6. ©2018 Wantedly, Inc. ⾣ ໊͕ࢗεΩϟϯͰ͖Δ ϦϦʔε࣌ͷػೳ • ໊ࢗྖҬநग़ • จࣈྻநग़

    • จࣈྻΧς ΰϦਪఆ • Ϣʔβݕࡧ ΫϥΠΞϯτͰॲཧ αʔόʔͰॲཧ Categorizer X-Finder OCR Microservice Խ ⾣ ࿈བྷઌʹ௥ՃɾฤूɾҰཡͰ͖Δ
  7. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People <Rails> <Go> <Python> <C++>

    <ݴޠ> ओͳϞσϧͷ
 "1*͸3BJMTͰ ActiveRecord ΄Ͳ༏लͳ O/R Mapper ͕ Go ʹͳ͍
  8. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People <Rails> <Go> <Python> <C++>

    <ݴޠ> Categorizer OCR FileStorage X-Finder ImageRefiner ओͳϞσϧͷ
 "1*͸3BJMTͰ ActiveRecord ΄Ͳ༏लͳ O/R Mapper ͕ Go ʹͳ͍
  9. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People <Rails> <Go> <Python> <C++>

    <ݴޠ> ίΞͳମݧ͸
 (PͰ࠷దԽ Categorizer OCR FileStorage X-Finder ImageRefiner ओͳϞσϧͷ
 "1*͸3BJMTͰ ActiveRecord ΄Ͳ༏लͳ O/R Mapper ͕ Go ʹͳ͍
  10. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Accounts ⾣ Ϣʔβʔೝূ Search Search
 Admin ⾣ ͭͳ͕Γݕࡧ
  11. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Accounts ⾣ Ϣʔβʔೝূ Search Search
 Admin ⾣ ͭͳ͕Γݕࡧ Timeline Timeline
 Admin ⾣ λΠϜϥΠϯ
  12. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Notification Accounts ⾣ Ϣʔβʔೝূ Search Search
 Admin ⾣ ͭͳ͕Γݕࡧ Timeline Timeline
 Admin ⾣ λΠϜϥΠϯ
  13. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Notification Accounts ⾣ Ϣʔβʔೝূ Search Search
 Admin ⾣ ͭͳ͕Γݕࡧ Timeline Timeline
 Admin ⾣ λΠϜϥΠϯ ⾣ ΞϓϦ಺௨஌
  14. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Notification Accounts ⾣ Ϣʔβʔೝূ Search Search
 Admin ⾣ ͭͳ͕Γݕࡧ Timeline Timeline
 Admin ⾣ λΠϜϥΠϯ ⾣ ΞϓϦ಺௨஌
  15. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Notification Accounts Search Search
 Admin Timeline Timeline
 Admin
  16. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Notification Accounts Search Search
 Admin Timeline Timeline
 Admin X-Finder ͳΜͰ΋ݟ͚ͭΔ܅
  17. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Notification Accounts Search Search
 Admin Timeline Timeline
 Admin Options Ϣʔβʔͷઃఆ஋Λ؅ཧ͢Δ܅ X-Finder ͳΜͰ΋ݟ͚ͭΔ܅
  18. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Notification Accounts Search Search
 Admin Timeline Timeline
 Admin Furiganer ͻͨ͢Β;Γ͕ͳৼΔ܅ Options Ϣʔβʔͷઃఆ஋Λ؅ཧ͢Δ܅ X-Finder ͳΜͰ΋ݟ͚ͭΔ܅
  19. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification X-Finder Options Furiganer
  20. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification X-Finder Options Furiganer
  21. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification X-Finder Options Furiganer
  22. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification X-Finder Options Furiganer - ϑϧελοΫϑϨʔϜϫʔΫ - ؅ཧը໘ͷੜ࢈ੑ
  23. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification X-Finder Options Furiganer - ϑϧελοΫϑϨʔϜϫʔΫ - ؅ཧը໘ͷੜ࢈ੑ - ؅ཧը໘͸ΞΫηε͸গͳ͍ - ੜ࢈ੑ > ϥϯλΠϜޮ཰
  24. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification X-Finder Options Furiganer - ϑϧελοΫϑϨʔϜϫʔΫ - ؅ཧը໘ͷੜ࢈ੑ - ؅ཧը໘͸ΞΫηε͸গͳ͍ - ੜ࢈ੑ > ϥϯλΠϜޮ཰ - ActiveRecord::Migration - ALTERߏจ֮͑ͯͳ͍
  25. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification X-Finder Options Furiganer - ϑϧελοΫϑϨʔϜϫʔΫ - ؅ཧը໘ͷੜ࢈ੑ - ؅ཧը໘͸ΞΫηε͸গͳ͍ - ੜ࢈ੑ > ϥϯλΠϜޮ཰ - ActiveRecord::Migration - ALTERߏจ֮͑ͯͳ͍ - ϚΠΫϩαʔϏεͷݪଇʹ
 ൓ͯ͠ɺDB ͸ڞ༗ - ػೳ୯Ґ֎ʹ͸Ӆṭ
  26. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification
  27. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification - υϝΠϯϞσϧͷ CRUD API
  28. ©2018 Wantedly, Inc. ߏ੒೥݄ CardScanner People Categorizer OCR Storage ImageRefiner

    Timeline Search Accounts Timeline
 Admin Search
 Admin Notification - υϝΠϯϞσϧͷ CRUD API - ͦͷଞͷࡶଟͳ࢓ࣄʢॏཁʣ - Admin ը໘ - ϝʔϧΛૹΔ - Push ௨஌ - Λ΍Δόονͷ࣮ߦ - ৭ʑͳࢪࡦ͝ͱͷ API
  29. ©2018 Wantedly, Inc. ⾣ ϑϧελοΫϑϨʔϜϫʔΫ w 8FCϖʔδ࡞੒ɺϝʔϧɺͦͷଞ͍͍ͩͨͷ͜ͱ͸Ͱ͖Δ w υϝΠϯ͕҆ఆ͢Δ·Ͱ෼ׂΛ஗Ԇ͢Δ໾ׂ w

    ݴ͍׵͑Δͱɺ৭ʑͳ΋ͷΛೖΕқ͍ʹTFSWJDF͕େ͖͘ͳΓ͕ͪ ⾣ (Pͱͷൺֱ w (PυϝΠϯͷ෼͔͍ͬͯΔখ͞ͳTFSWJDFͷ࣮૷ʹར༻ w ੩తܕ෇͚ɾ'8ͷந৅Խ͕཈͑Ίɾখ͍͞ίʔυϕʔεʹΑΔѻ͍΍͢͞ w ϥϯλΠϜޮ཰ɺඇಉظॲཧɾฒߦϓϩάϥϛϯάػߏͷ༏ྼ w 3BJMT͸ͦΕҎ֎ΛΧόʔ w "DUJWF3FDPSE͸Ғେ ·ͱΊɿଟݴޠͷϚΠΫϩαʔϏεʹ͓͚Δ3BJMT
  30. ©2018 Wantedly, Inc. ⾣ ։ൃ؀ڥͷηοτΞοϓ͕େม
 ˠ։ൃ͢Δαʔόʔ͚ͩϩʔΧϧʹ%PDLFSͰཱͯͯɺ
 ଞ͸ϦϞʔτͷڞ௨αʔόʔɾ%#ʹ઀ଓ w IUUQHJUIVCDPNDSFBTUZSJE%PDLFSΛ஌Βͳͯ͘΋։ൃͰ͖Δ ⾣

    (P͸γϯϓϧ͕ͩαʔόʔͷߏ੒͕͹Β͹Β
 ˠ(PαʔόʔͷϨʔϧΛෑ͘ w IUUQHJUIVCDPNJ[VNJOHSBQJH31$(BUFXBZʹΑΔ"1*αʔόʔ ⾣ શͯͷTFSWJDF͕ඪ४Ͱඋ͍͑ͯͯཉ͍͠ػೳͷڞ௨Խ w IUUQHJUIVCDPNXBOUFEMZTFSWJDFY JOUFSOBM ิ଍ɿଟݴޠ؀ڥͰ։ൃੜ࢈ੑΛԼ͛ͳ͍ͨΊͷ৭ʑͳ޻෉
  31. ©2018 Wantedly, Inc. ⾣ αʔϏε঺հ ⾣ 8BOUFEMZ1FPQMFͷࣄྫ ⾣ 8BOUFEMZ7JTJU͔Βͷ෼ׂ w

    ࣄۀతͳഎܠ w ʮϢʔβʔϓϩϑΟʔϧʯTFSWJDF w ʮϢʔβʔؒͷͭͳ͕ΓʯTFSWJDF ໨࣍
  32. ©2018 Wantedly, Inc. ⾣ ֘౰ϞσϧͷجఈΫϥεΛมߋ w ܧঝݩΛA"QQMJDBUJPO3FDPSEAA1SPpMF3FDPSEAʹมߋ͢Δ ϝΠϯσʔλϕʔε͔Βͷ෼ׂ ⾣ +0*/Λࣄલʹશͯݕग़ˍॻ͖׵͑

    w ෼ׂڥքΛ·͙ͨΑ͏ͳ+0*/͕૸Βͳ͚Ε͹্ख͘ಈ͘ w A"DUJWF3FDPSE3FMBUJPOAʹϞϯΩʔύονͯ͠ϩΪϯά w +0*/ͯ͠ΔՕॴΛॻ͖׵͑
  33. ©2018 Wantedly, Inc. ⾣ ֘౰ϞσϧͷجఈΫϥεΛมߋ w ܧঝݩΛA"QQMJDBUJPO3FDPSEAA1SPpMF3FDPSEAʹมߋ͢Δ ϝΠϯσʔλϕʔε͔Βͷ෼ׂ ⾣ +0*/Λࣄલʹશͯݕग़ˍॻ͖׵͑

    w ෼ׂڥքΛ·͙ͨΑ͏ͳ+0*/͕૸Βͳ͚Ε͹্ख͘ಈ͘ w A"DUJWF3FDPSE3FMBUJPOAʹϞϯΩʔύονͯ͠ϩΪϯά w +0*/ͯ͠ΔՕॴΛॻ͖׵͑ ⾣ ໷ؒʹαʔϏεఀࢭͯ͠Ҡߦ w 1PTUHSFTͷ3FBE3FQMJDBΛ1SPpMF%#༻ͷNBTUFSͱͯ͠ঢ֨ w A1SPpMF3FDPSEA͸ͦͪΒΛࢀর͢ΔΑ͏ʹ͢Δ w ໰୊ͳ͚Ε͹֤%#Ͱෆཁͳςʔϒϧ͸%301͢Δ
  34. ©2018 Wantedly, Inc. ⾣ ͭͳ͕Γͷऔಘɾߋ৽ϝιου͸طʹہॴ Խ͞Ε͍ͯΔͷͰ"1*Խ͸༰қ w ਺ԯ݅͋ΔςʔϒϧͷͨΊɺ͋·Γڽͬͨ࢖͍ํ͸͍ͯ͠ͳ͔ͬͨ w ผͷ՝୊ɿͭͳ͕ΓΛอଘ͢ΔσʔλετΞͱͯ͠3%#͸ॊೈੑʹ͚ܽΔ

    DPOOFDUJPOTTFSWJDF άϥϑσʔλϕʔεΛόοΫΤϯυʹ͢Δ (P੡ͷ.JDSPTFSWJDFΛ࣮૷ w 8BOUFEMZ1FPQMFͷํͰઌʹಋೖɺӡ༻࣮੷͕Ͱ͖ͨΒڞ௨Խ
  35. ©2018 Wantedly, Inc. ⾣ ࣄۀతͳഎܠ͔ΒɺϞϊϦγοΫ3BJMT ΞϓϦέʔγϣϯ͔Βத֩υϝΠϯͷ෼཭ ΛਐΊͨ w QSPpMFTFSWJDFग़དྷΔݶΓڍಈΛม͑ͳ͍Α͏ɺݩͷ%#Λෳ੡ͯ͠෼ׂ w

    DPOOFDUJPOTTFSWJDFશ͘৽͍͠σʔλετΞΛผͰݕূͯ͠TFSWJDFԽ ⾣ ͜ͷΞʔΩςΫνϟมߋ͕࣮ࡍʹαʔϏε ͷՁ஋ʹͭͳ͕Δ͔͸ࠓޙͷݕূࣄ߲ w طଘͷࣄۀؒͰͷ૬৐ޮՌɾ৽نࣄۀͰͷ׆༻ ·ͱΊɿ8BOUFEMZ7JTJU͔Βͷ෼཭