Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

AWSが支えるEightリコメンデーションエンジンの裏側

 AWSが支えるEightリコメンデーションエンジンの裏側

AWS Dev Dey Tokyo 2017 Day4(Serverless evolution day) 講演資料
- Eightのリコメンデーションについて
- サーバーレスを用いたアーキテクチャ刷新
- AWS Step Functions を用いたリコメンドデータ洗い替え

## 動画
https://www.youtube.com/watch?v=e6afrxI6p04

Yasunori Suzuki

June 05, 2017
Tweet

More Decks by Yasunori Suzuki

Other Decks in Technology

Transcript

  1. 

  2. 

  3. 

  4. ʮ ໊ ࢗ Λ Ϗ δ ω ε ͷ ͭ

    ͳ ͕ Γ ʯ ʹ ม ͑Δ 
  5. ͭ ͳ ͕ ͬ ͨ ૬ ख ͱ ί ϛ

    ϡ χέ ʔ γ ϣ ϯ 
  6. ϨʔςΟϯάσʔλ  ୭͕୭ʹԿΛ͔ͨ͠ ϢʔβʔΞΫςΟϏςΟ ϦΞϧλΠϜੑΛ୲อ͢ΔͨΊʹ தؒσʔλΛ࣋ͭ ੜϩά Ϩίʔυʹ৘ใΛ·ͱΊΔ ୭͕ "͞Μ

    9͞Μ ୭ʹ #͞Μ :͞Μ ͭͳ͕Γঢ়ଶ ͭͳ͕͍ͬͯΔ ʜ ͍͍Ͷճ਺ ճ ʜ ϝοηʔδճ਺ ճ ʜ ౤ߘγΣΞճ਺ ճ ʜ '#ͭͳ͕Γ ͳ͠ ʜ
  7. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered ϩάऩू ϨʔςΟϯάσʔλ
 தؒσʔλ ੜ੒ ϨʔςΟϯάσʔλ
 Ωϟογϡੜ੒ ਪનσʔλܭࢉɾ ੜ੒ Triggered 
  8. ҟͳΔετϦʔϜ͔Β ಉ͡Α͏ͳॲཧΛ͍ͤͨ͞έʔε ͲͷετϦʔϜ͔Λ൑ผ͠ɺॲཧΛ෼ذ -BNCEBΛ·ͱΊɺετϦʔϜΛ൑ผ { ‘eventSource’: ‘aws:kinesis’, ‘eventSourceARN’: ‘arn:aws:kinesis:Stream1’, }

    { ‘eventSource’: ‘aws:dynamodb’, ‘eventSourceARN’: ‘arn:aws:dynamodb:xxxx’, } { ‘eventSource’: ‘aws:kinesis’, ‘eventSourceARN’: ‘arn:aws:kinesis:Stream2’, } 
  9. ಉ͡ύϥϝʔλͰ ҟͳΔॲཧΛ͍ͤͨ͞έʔε {‘data’: 1} {‘data’: 1} {‘data’: 1} {‘key’: ‘func1’,

    ’data’: 1} {‘key’: ‘func2’, ’data’: 1} {‘key’: ‘func3’, ’data’: 1} ύϥϝʔλʹΑΓॲཧΛ෼ذ {’data’: 1} 4USFBNΛॻ͖໭͢ ෼਎ͷज़ 
  10. ୭͕ "͞Μ 9͞Μ ୭ʹ #͞Μ :͞Μ ͭͳ͕Γঢ়ଶ ͭͳ͕͍ͬͯΔ ʜ ͍͍Ͷճ਺

    ճ ʜ ϝοηʔδճ਺ ճ ʜ ౤ߘγΣΞճ਺ ճ ʜ '#ͭͳ͕Γ ͳ͠ ʜ ࠓ·Ͱؤுͬͯ஝ੵͨ͠΋ͷ͸ແʹؐΔ ❌  ALTER TABLE ͱ͔ͳ͍ͷͰ
  11. %BUB1JQFMJOFΛར༻ چςʔϒϧ
 ෆཁʹͳͬͨΒ࡟আ ৽ςʔϒϧ 3FETIJGU ❌ Redshift Copy Activity Hive

    Activity  ૯*UFN਺ສ௒ 8SJUF$BQBDJUZ  ʹઃఆͯ͠ ਺͔͔࣌ؒΔ

  12. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered Triggered 
  13. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered Triggered -BNCEBఀࢭ   
  14. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered Triggered -BNCEBఀࢭ ৽σʔλੜ੒   
  15. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered Triggered -BNCEBఀࢭ Replace ςʔϒϧೖΕସ͑ ৽σʔλੜ੒   
  16. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered Triggered -BNCEBఀࢭ Replace ςʔϒϧೖΕସ͑ ৽σʔλੜ੒ Ωϟογϡ ɹ΢ΥʔϜΞοϓ    
  17. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered Triggered -BNCEBఀࢭ Replace ςʔϒϧೖΕସ͑ -BNCEB࠶։ ৽σʔλੜ੒ Ωϟογϡ ɹ΢ΥʔϜΞοϓ  
  18. ղܾํ๏  %BUB1JQFMJOFͷঢ়ଶ؅ཧ %BUB1JQFMJOFͷঢ়ଶΛอ࣋ -BNCEBͷ5JNFPVU໰୊ 3FUSZΛ׆༻ ચ͍ସ͑ର৅ςʔϒϧͷ ࢦఆํ๏ 1BSBMMFM$IPJDFΛ׆༻ Ωϟογϡͷ

    ΢ΥʔϜΞοϓ໰୊ ɹɹ Ͱߴ଎ʹ΢ΥʔϜΞοϓ μ΢ϯλΠϜແ͠Ͱ ચ͍ସ͑ "U5JNFTUBNQࢦఆͰτϦΨʔઃఆ
  19. ׬͍ྃͯ͠ͳ͍৔߹͸ Τϥʔѻ͍ͱ͠ɺఆִؒͰϦτϥΠ Polling "Retry" : [{ "ErrorEquals": [ "States.ALL" ],

    "IntervalSeconds": 300, "MaxAttempts": 100, "BackoffRate": 1.0 }], If: error  Step1 Step2 Step3 else: success %BUB1JQFMJOF ঢ়ଶอ࣋ςʔϒϧ Retry
  20. ΩʔσʔλΛ ҰׅΠϯϙʔτ͠ɺ ετϦʔϜʹҰؾʹྲྀ͢ %ZOBNP%#4USFBNܦ༝Ͱ ΩϟογϡΛͻͨ͢Βߴ଎ੜ੒ Triggered Caching  [ :key1,

    :key2, :key3, :key4, ], Rating data table )BTILFZ DPVOU TDPSF LFZ   LFZ   LFZ   LFZ   Get by :key1 {hash_key: :key1, count:1, score:1} -BNCEB͕ෳ਺ىಈ ΢ΥʔϜΞοϓ༻
 ςϯϙϥϦςʔϒϧ
  21. "U5JNFTUBNQͰτϦΨʔઃఆ  Latest Oldest refreshed_at Starting Position: At Timestamp =

    refreshed_at ࢦఆ࣌ࠁ SFGSFTIFE@BU ΑΓ΋ ৽͍͠΋ͷΛॲཧ
  22. logging Streaming Triggered Write Send Message Polled Get Write Triggered

    Set Ϣʔβʔ ΞΫςΟϏςΟ Get Set 8FCαʔόʔ #BUDIαʔόʔ Ϧίϝϯυ ݁Ռ Triggered Triggered Replace  σʔλચ͍ସ͑ػߏ 4UFQ'VODUJPOT
  23.