知っておくと便利な Exponential Backoff / Exponential Backoff

知っておくと便利な Exponential Backoff / Exponential Backoff

3da5b00de1285b12a17d730262cc4824?s=128

Yoshiaki Yoshida

November 18, 2016
Tweet

Transcript

  1. 濼׏גֶֻה⤑ⵃז &YQPOFOUJBM#BDLP  爡ⰻ⹈䓼⠓ !LBLBLBLBLLV

  2. 8IBUJT &YQPOFOUJBM#BDLP ؙؒأهطٝءٍٕغحؙؔؿ׏ג

  3. &YQPOFOUJBM#BDLPJT ‣ ؒٓ٦ָ涪欰׃׋הֹךٔزٓ؎꟦ꥫ׾
 䭷侧ꟼ侧涸ח㟓װ׃גְֻ➬穈׫،ٕ؞ٔؤي ‣ ؙٓؐس"1*꽀⹛و؎ؙٗ؟٦ؽأזוךⵖ秈ה׃ג
 طحزٙ٦ؙח⣛㶷׃׋♧儗涸זؒٓ٦ָ涪欰ׅ׷ֿהכ֮׷ ‣ ׬׃׹♧儗涸זؒٓ٦׾⵸䲿חٔزٓ؎Ⳣ椚׾䮠׬ֿהח״׏ג
 ؒٝآص،ך麊欽؝أزָ♴ָ׷

    ‣ ٓٝتيז鹼䒀儗꟦ +JUUFS ׾⸇皾ׅ׷㜥さ׮֮׷
  4. &YQPOFOUJBM#BDLPJT ‣ ؒٓ٦ָ涪欰׃׋הֹךٔزٓ؎꟦ꥫ׾
 䭷侧ꟼ侧涸ח㟓װ׃גְֻ➬穈׫،ٕ؞ٔؤي ‣ ؙٓؐس"1*꽀⹛و؎ؙٗ؟٦ؽأזוךⵖ秈ה׃ג
 طحزٙ٦ؙח⣛㶷׃׋♧儗涸זؒٓ٦ָ涪欰ׅ׷ֿהכ֮׷ ‣ ׬׃׹♧儗涸זؒٓ٦׾⵸䲿חٔزٓ؎Ⳣ椚׾䮠׬ֿהח״׏ג
 ؒٝآص،ך麊欽؝أزָ♴ָ׷

    ‣ ٓٝتيז鹼䒀儗꟦ +JUUFS ׾⸇皾ׅ׷㜥さ׮֮׷ 
  5.          猱

  6. "84׾⢪ֲֶ⡲岀ה׃ג׮ &YQPOFOUJBM#BDLPָ䱿㤺ׁ׸גְ׷ "844%,דכ傀ח㹋鄲ׁ׸גְ׷ IUUQTEPDTBXTBNB[PODPNKB@KQHFOFSBMMBUFTUHSBQJSFUSJFTIUNM

  7. ؟٦غ٦ؒٓ٦ YY ת׋כأٗحزؚٔٝؒ ٓ٦׾「ֽ《׷⯋ךؙٔؒأز׾ⱄ鑐遤ׅ׷䗳銲 ָ֮׶תׅկ׋׌׃ծؙٓ؎،ٝزؒٓ٦ YY  כծⱄ鑐遤ׅ׷⵸חؙٔؒأز׾⥜姻׃ג㉏겗׾ 鍑寸ׅ׷䗳銲ָ֮׷ֿה׾爙׃גְתׅկ

  8. ֶ遤⭑葺ֻٔزٓ؎ׅ׷

  9. ׋׌꠹ꨡחٔزٓ؎ׅ׶ׯ 葺ְ׻ֽׄׯזְ

  10. ֶ遤⭑葺ֻٔزٓ؎ׅ׷ ‣ 湱䩛ך㡮׾׃׏ַ׶ה耀ֻٖأهٝأ؝٦س׾鋅׷ ‣ ٔزٓ؎ׅ׷ה⸬卓ָ֮׷ ‣ ؟٦غ٦ؒٓ٦ YY הأٗحزؚٔٝؒٓ٦ ‣

    ؙٔؒأز׾⥜姻׃זְהٔزٓ؎׃ג׮⸬卓ָזְ ‣ ؙٓ؎،ٝزؒٓ٦ YY
  11. ֶ遤⭑葺ֻٔزٓ؎ׅ׷ ‣ 湱䩛ך㡮׾׃׏ַ׶ה耀ֻٖأهٝأ؝٦س׾鋅׷ ‣ ٔزٓ؎ׅ׷ה⸬卓ָ֮׷ ‣ ؟٦غ٦ؒٓ٦ YY הأٗحزؚٔٝؒٓ٦ ‣

    ؙٔؒأز׾⥜姻׃זְהٔزٓ؎׃ג׮⸬卓ָזְ ‣ ؙٓ؎،ٝزؒٓ٦ YY 
  12. 8IBUJT 5ISPUUMJOH أٗحزؚٔٝ׏ג

  13. 5ISPUUMJOHJT ‣ ♧㹀儗꟦ⰻחⵖꣲ׾馄ִ׋㔐侧ךؙٔؒأز׾
 굲ל׃׋㜥さחؒٓ٦חז׷ֿה"1*؝٦ٕ♳ꣲהずׄ ‣ ؟٦ؽأ⩎ַ׵ׅ׷ה%%P4זו׾꣇ּ湡涸׮֮׷ ‣ "84׌ה؟٦ؽأ׀החأٗحزؚٔٝⵖꣲָ֮׷ ‣ $MPVE8BUDI"NB[PO"1*(BUFXBZזו

    ‣ 歍锜ד♳ꣲ箢ㄤכ〳腉"84麊欽罏ז׵ֶ꼧厩׫ך֮׸
  14. 鷞חٔزٓ؎׾䫇ⵖׅ׷

  15. 3FUSZ 5ISPUUMJOH ٔزٓ؎׾䫇ⵖׅ׷

  16. 3FUSZ5ISPUUMJOHJT ‣ ٔزٓ؎ָ넝然桦ד㣟侁׃׋׶䘔瘶儗꟦ָꞿְ㜥さ׌ה ‣ ٔزٓ؎ׅ׷ֿהח״׏ג鷞חؙٓ؎،ٝز⩎ח堣腉♶Ⰻָ饯ֹ׷ ‣ ׉ך״ֲז㜥さחٔزٓ؎׾䫇ⵖׅ׷堣腉ךֿה׾鎉ֲ ‣ "844%,GPS+BWB"844%,GPS/&5חכ傀ח㹋鄲ׁ׸גְ׷

  17. 圫ղז鎉铂ד㹋鄲ׁ׸׋ &YQPOFOUJBM#BDLP

  18. 3VCZ3FUSJFT ‣ IUUQTHJUIVCDPNPPZBMBSFUSJFT ‣ ءٝفٕח㹋鄲ׁ׸גְ׷ ‣ رؿٕؓز׌ה4UBOEBSE&SSPS׾SFTDVF׃גְ׷ require 'retries' with_retries(max_tries:

    10, max_sleep_seconds: 100.0) { puts Time.now raise StandardError }
  19. 3VCZ3FUSJBCMF ‣ IUUQTHJUIVCDPNLBNVJSFUSJBCMF ‣ 3FUSJFT״׶醱꧟זػًٓ٦ةדثُ٦صؚٝ〳腉 ‣ رؿٕؓز׌ה4UBOEBSE&SSPS׾SFTDVF׃גְ׷ require 'retriable' Retriable.retriable

    tries: 10 do puts Time.now raise StandardError end
  20. 0UIFS ‣ 1)1 ‣ IUUQTHJUIVCDPNZSJWFJSPQIQCBDLP ‣ (PMBOH ‣ IUUQTHJUIVCDPNDFOLBMUJCBDLP ‣

    1ZUIPO ‣ IUUQTHJUIVCDPNSIPMEFSSFUSZJOH
  21. ىسٕؐؑ،ד㹋鄲ׁ׸׋ &YQPOFOUJBM#BDLP

  22. 'MVFOUE ‣ IUUQTHJUIVCDPNVFOUVFOUE ‣ 0VUQVU1MVHJOכرؿٕؓزד&YQPOFOUJBM#BDLPדٔزٓ؎ׅ׷ ‣ ꟼ鸬ׅ׷鏣㹀⦼ ‣ SFUSZ@MJNJU ‣

    SFUSZ@XBJU
  23. 'MVFOUE ‣ 㹋ꥷחGPSXPSEח㣟侁ׅ׷橆㞮׾⡲׏ג鑐׃ג׫׋ ‣ SFUSZ@MJNJU ‣ SFUSZ@XBJUT ‣ קרZ?Yח䖞ֲ ‣

    杝荈ךٗآحؙח״׏ג侧猱ך铎䊴 +JUUFS ָⰅ׷
  24. None
  25. תה׭

  26. ׮׃➙䖓ٔزٓ؎Ⳣ椚׾㹋鄲ׅ׷堣⠓ָ֮׸ל ךֿה׾䙼ְ⳿׃גֻ׌ְׁ &YQPOFOUJBM#BDLP