ソフトウェア開発における 「設計」と「パフォーマンス」の相互作用 / Interaction Between Design and Performance on
Software Development

672ee2598bea695496f11022a9a9c4c8?s=47 moznion
November 08, 2018

ソフトウェア開発における 「設計」と「パフォーマンス」の相互作用 / Interaction Between Design and Performance on
Software Development

設計Night2018の資料です
https://connpass.com/event/104821/

672ee2598bea695496f11022a9a9c4c8?s=128

moznion

November 08, 2018
Tweet

Transcript

  1. ιϑτ΢ΣΞ։ൃʹ͓͚Δ ʮઃܭʯͱʮύϑΥʔϚϯεʯͷ૬ޓ࡞༻ Interaction Between Design and Performance on
 Software Development

    ઃܭNight2018 @moznion
  2. @moznion Software Engineer ࠷ۙαϒςΫʹೖΓ·ͨ͠

  3. DISCLAIMER

  4. ۩ମతͳιϑτ΢ΣΞઃܭٕ๏ɾख๏ͷ
 ࿩୊͸ଞͷൃදʹৡΓ·͢

  5. ʮઃܭʯͱʮύϑΥʔϚϯεʯ

  6. ύϑΥʔϚϯεͷఆٛ (؆ܿʹ) - ߴ଎ʹϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ͨ͘͞ΜϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ʮਖ਼֬ʹʯ

  7. ύϑΥʔϚϯεͷఆٛ (؆ܿʹ) - ߴ଎ʹϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ͨ͘͞ΜϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ʮਖ਼֬ʹʯ

  8. ύϑΥʔϚϯεͷఆٛ (؆ܿʹ) - ߴ଎ʹϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ͨ͘͞ΜϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ʮਖ਼֬ʹʯ

  9. ύϑΥʔϚϯεͷఆٛ (؆ܿʹ) - ߴ଎ʹϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ͨ͘͞ΜϨεϙϯεΛฦ͢͜ͱ͕Ͱ͖Δ - ʮਖ਼֬ʹʯ

  10. ͳͥύϑΥʔϚϯεΛ௥ٻ͢Δͷ͔

  11. - ྑ͍Πϯλʔωοτମݧͷఏڙ - ΑΓଟ͍ʮػձʯͷ૑ग़ - Πϯϑϥઃඋͷ࠷దԽ - ==> ͭ·Γθχ΍ʂʂʂʂʂʂ ͳͥύϑΥʔϚϯεΛ௥ٻ͢Δͷ͔

  12. - ྑ͍Πϯλʔωοτମݧͷఏڙ - ΑΓଟ͍ʮػձʯͷ૑ग़ - Πϯϑϥઃඋͷ࠷దԽ - => ͭ·Γθχ΍ʂʂʂʂʂʂ ͳͥύϑΥʔϚϯεΛ௥ٻ͢Δͷ͔

  13. ͭ·Γθχ΍ʂʂʂʂʂ

  14. ύϑΥʔϚϯεͤ͞΍͍͢ઃܭʁ

  15. - ΞϧΰϦζϜ - σʔλߏ଄ - (ϋʔυ΢ΣΞ) ύϑΥʔϚϯεͤ͞΍͍͢ઃܭ (Ұྫ) - ϑΝϯΞ΢τ

    - ΩϡʔΠϯά - Ωϟογϡ ɹ- όον ਨ௚ࢦ޲ ਫฏࢦ޲ ͦͷଞ
  16. ਨ௚ࢦ޲ͷઃܭ

  17. - ద੾ͳΞϧΰϦζϜͷద༻ - ద੾ͳσʔλߏ଄ͷద༻ - සग़) ୳ࡧɼιʔτͳͲ - ͳΜͰ΋͔ΜͰ΋ϋϯϚʔΛ࢖ͬͯ͸ͩΊ ਨ௚ࢦ޲ͷઃܭ

  18. - ΞϧΰϦζϜ΍σʔλߏ଄͸খ͍͞ύʔπ - ଞͷઃܭख๏ͱͷ૊Έ߹Θ͕ͤൺֱత༰қ - => ੹຿͕໌֬Ͱ͋Δ͜ͱʹڌΓͦ͏ - ࠜຊతͳύϑΥʔϚϯεվળΛਤΔͳΒ͜͜ʂ ਨ௚ࢦ޲ͷઃܭ

  19. - ʮҰ൪͍͍ϚγϯΛཔΉʯ - ϋʔυ΢ΣΞઃܭͷਐาʹཔΔʂʂʂ - ࠓճͷ࿩୊ͱ͸Ұ੾ؔ܎ͳ͍Ͱ͢ - ͱ͸͍͑ϋʔυ΢ΣΞͷਐาʹΑͬͯ
 ιϑτ΢ΣΞઃܭͷٕ๏͕มΘΔ͜ͱ͸͋Γͦ͏ ਨ௚ࢦ޲ͷઃܭ

    (൪֎)
  20. ਫฏࢦ޲ͷઃܭ

  21. - ϑΝϯΞ΢τ - ෳ਺ͷϓϩηεɾϚγϯͰฒߦॲཧ - ෳ਺ͷϓϩηεɾϚγϯͰฒྻॲཧ (ڠௐॲཧ) - (Reactive...?) -

    ϑΝϯΠϯ͕ཁΔ (৔߹͕͋Δ) ਫฏࢦ޲ͷઃܭ
  22. - ΩϡʔΠϯά - δϣϒΩϡʔͰޙճ͠େ࡞ઓ (™@nekokak) - ཁ͸όοϑΝϨΠϠʔʹॲཧΛ٧ΊࠐΉ - ϫʔΧʔ (૬౰)

    ͕ॲཧΛ੥͚ෛ͏ - εϩοτϦϯά͕͠΍͍͢ ਫฏࢦ޲ͷઃܭ queue (buffer)
  23. - ΩϡʔΠϯά - ҎԼΛຬ଍͢Δ؀ڥͰ͋Ε͹ຊ౰ʹޮՌత - ϦΞϧλΠϜੑ͕ٻΊΒΕͳ͍ - ஗Ԇ͕ڐ༰͞ΕΔ ਫฏࢦ޲ͷઃܭ queue

    (buffer)
  24. - (ଟ͘ͷ৔߹) ඇಉظॲཧ͔Βಀ͛ΒΕͳ͍ - ඇಉظॲཧ͕ϏδωεϩδοΫʹ
 ͢ΜͳΓ࣮૷͞ΕΔ͜ͱ͸ͦ͏ଟ͘͸ͳ͍ - ϓϩτίϧελοΫͷ࣮૷౳Ͱ͸͋Δ͔΋ ਫฏࢦ޲ͷઃܭ

  25. - ඇಉظͰ΋ಈ͘Α͏ʹ࣮૷͢Δඞཁ͕ग़ͯ͘Δ - ྫ - ॱংੑʹڍಈΛࢧ഑͞Εͳ͍ - ႈ౳ੑΛ୲อ࣮ͯ͠૷͢Δ - ௚ײʹ൓͢Δ৔߹͕ଟ͍……

    ਫฏࢦ޲ͷઃܭ
  26. - ύϑΥʔϚϯεͷͨΊͷ౎߹͕ϏδωευϝΠϯͷ
 ઃܭΛ࿪Ί͕ͪ - ஫ҙਂ͘ઃܭ͢Δͱ͏·͘ಇ͘৔߹΋͋Δ (ޙड़) - (ʮӡ͕ྑ͚Ε͹ʯ͔΋͠Εͳ͍) - ͏͔ͬΓૉ๿ʹ࣮૷͢Δͱ……ᄾݺ

    ਫฏࢦ޲ͷઃܭ
  27. - ࡶଟͳۤ͠ΈΛݺͼ͕ͪ - ϨʔείϯσΟγϣϯ - ϦτϥΠ - εςʔτͷෆ੔߹ - ͳͲͳͲ……

    - Ref: ෼ࢄΩϡʔͱ͍͏໊ͷۤ͠Έ - Software Transactional Memo
 http://kumagi.hatenablog.com/entry/queue_struggle ਫฏࢦ޲ͷઃܭ
  28. - εέʔϧ͢Δʢ͠΍͍͢ʣʂʂ - ͔͠͠τϨʔυΦϑ͸ଟ͍ - ͦΕͰ΋ಋೖ͢Δ͔Ͳ͏͔ͷίετ൑அʢޙड़ʣ ਫฏࢦ޲ͷઃܭ

  29. - FaaSʹΑΔύϥμΠϜͷมԽ - ԋࢉϦιʔεΛΦϯσϚϯυͰ҆͘࢖͑ΔΑ͏ʹͳͬͨ - FunctionʹॲཧΛҕৡͯ͠͠·͏ - Firebaseͱ͔Ͱׂͱਪ঑͞ΕΔख๏ - ʮͱΓ͋͑ͣδϣϒΩϡʔʹೖΕ͓͍ͯͯ͋ͱͰॲཧʯ

    - ΊͬͪΌ΍Γ΍͘͢ͳͬͨ - ୯Ұ੹೚ͷݪଇ (SRP) ͕ൺֱతຬͨ͞Ε΍͘͢ͳͬͨҹ৅ - (ίϯϙʔωϯτͷϝϯςίετ΋Լ͕Δ) ਫฏࢦ޲ͷઃܭ (൪֎?)
  30. SONOTA

  31. - όον - ͋Β͔͡ΊίϯςϯπΛ΋Γ΋Γੜ੒
 ͓͍ͯͯ͠ΞϓϦ͸ͦΕΛฦ٫͢Δ͚ͩͱ͔ - αϚϦςʔϒϧͱ͔…… - ͜Ε΋ଈ࣌ੑͱͷ݉Ͷ߹͍ͷ࿩୊ʹͳΔ ͦͷଞ

  32. - Ωϟογϡ - खͬऔΓૣ͍ͥʢةݥࢥ૝ʣ - YAPC::Kansai 2017 OSAKAͰ࿩͠·ͨ͠ - https://speakerdeck.com/moznion/pattern-and-strategy-of-

    web-application-caching - (↑Ͱ࿩͍ͯ͠ͳ͍࿩୊ͱͯ͠͸ϚςϏϡʔ͕͋Γͦ͏) ͦͷଞ
  33. - Ωϟογϡ΍όον͸ຊ࣭త͔Ͳ͏͔ - ଟ͘ͷ৔߹͸ຊ࣭తͰ͸ͳ͍……ʁ ͦͷଞ

  34. - ຊ࣭ͱ͸ͳʹ͔……ʁ - => ϏδωευϝΠϯɾϩδοΫͷ៉ྷ͞ - => θχ΍ʂʂʂʂʂʂ ͦͷଞ

  35. - ຊ࣭ͱ͸ͳʹ͔……ʁ - => ઃܭͷ៉ྷ͞ - => θχ΍ʂʂʂʂʂʂ ͦͷଞ

  36. - ຊ࣭ͱ͸ͳʹ͔……ʁ - => ઃܭͷ៉ྷ͞
 => θχ΍ʂʂʂʂʂʂ ͦͷଞ

  37. ͭ·Γθχ΍ʂʂʂʂʂ

  38. - ͔͠͠ - ςΫχΧϧͳ౎߹͕ιϑτ΢ΣΞઃܭʹٴ΅͢Өڹ͸େ͖͍ - ౎߹ ∈ ϋʔυ΢ΣΞɾϛυϧ΢ΣΞ - ςΫχΧϧͳղܾख๏ͷ҆қͳಋೖʹΑͬͯ


    ΧΦεʹ޲͔͍ͬͯ͘Մೳੑ͸ߴ·Δ - υϝΠϯͷ࣋ͭϐϡΞ͕ࣦ͞ΘΕΔ - ઃܭ͕࿪ΊΒΕ͕ͪ ͦͷଞ
  39. ઃܭ͕࿪ΊΒΕΔʁ

  40. - ઃܭ͕࿪ΊΒΕΔ - => ڍಈ͕Θ͔Γʹ͘͘ͳΔ (ίʔυͷಡΈ΍͚ͩ͢͞Ͱ͸ͳ͍) - => मਖ਼ίετ͕ߴ͘ͳΔ -

    => ϝϯςίετ͕ߴ͘ͳΔ - => ઃܭ͕࿪ΊΒΕ͍ͯΔ͜ͱʹؾͮ͘…… ઃܭ͕࿪ΊΒΕͯԿ͕ѱ͍ʁ
  41. - ઃܭ͕࿪ΊΒΕΔ - => ڍಈ͕Θ͔Γʹ͘͘ͳΔ (ίʔυͷಡΈ΍͚ͩ͢͞Ͱ͸ͳ͍) - => मਖ਼ίετ͕ߴ͘ͳΔ -

    => ϝϯςίετ͕ߴ͘ͳΔ - => ઃܭ͕࿪ΊΒΕ͍ͯΔ͜ͱʹؾͮ͘…… ઃܭ͕࿪ΊΒΕͯԿ͕ѱ͍ʁ
  42. ʮίετʯ

  43. - ৽ͨʹػೳΛ࡞Δίετ - ίʔυͷϝϯςφϯείετ - Πϯϑϥͷϝϯςφϯείετ - => ιϑτ΢ΣΞઃܭ͸͜ΕΒʹӨڹΛٴ΅͢ -

    => ઃܭ͸ίετͱͷઓ͍ ίετ
  44. ͭ·Γθχ΍ʂʂʂʂʂ

  45. - ίετͷ࣠ - ίϯϐϡʔςΟϯάͷ଎౓ʹΑͬͯϖΠ͢ΔྖҬ - ઃܭͷྑ͞ʹΑͬͯϖΠ͢ΔྖҬ - ௚ަ͢Δ৔߹΋͋Ε͹૬৐͢Δ৔߹΋૬൓͢Δ৔߹΋͋Δ - όϥϯε͕ॏཁ

    - ྑ͍ઃܭͷ৚݅ͷҰͭ: ߹ҙ͕औΕ͍ͯΔ - => ίετͱ΋߹ҙΛऔΔඞཁ͕͋Δ - ʮσϕϩούͷੜ࢈ੑʯʹݶఆͨ͠࿩Ͱ͸ͳ͍ ίετ
  46. υϝΠϯ஌ࣝͱύϑΥʔϚϯε

  47. - υϝΠϯʹର͢Δ஌͕ࣝ଍Γͳ͍৔߹ - ݟ౰ҧ͍ͷ࣮૷ɾઃܭΛ͕ͪ͠ - ෆద੾ͳσʔλߏ଄Λ࠾༻ͯ͠͠·ͬͨΓ…… - ྑ͍ύϑΥʔϚϯεʹ͸υϝΠϯʹର͢Δ஌ࣝɾཧղ͕ඞཁ ʮυϝΠϯ஌ࣝͷཧղʯͱύϑΥʔϚϯε

  48. ࣮ࡍͲ͏ઃܭ͢Ε͹ྑ͍ͷ͔……

  49. ΋ͷʹΑΔ

  50. None
  51. ͋͘·Ͱݸਓͷܦݧͷ࿩ͱͯ͠ฉ͍͍ͯͩ͘͞

  52. - ૉ௚ʹϞσϦϯάͯ͠࡞ͬͨ΄͏͕ྑ͍ - ଟ͘ͷ৔߹࣮༻ʹ଱͑͏Δ଎౓Ͱಈ͘ - ͪΌΜͱϞσϦϯά͞Ε͍ͯΔ - ࠷௿ݶৗࣝతͳઃܭɾ࣮૷͕͞Ε͍ͯΕ͹…… - ʮඒ͍͠΋ͷ͸ۭؾ఍߅͕খ͍͞ʯͷਫ਼ਆ

    - ࣮ࡍͦΜͳ౎߹ྑ͘͸ͳ͍ͷ͕ͩ…… - ࠔͬͨΒͬͪ͜ʹ౗͓ͯ͘͠ ύϑΥʔϚϯεͱઃܭࢦ਑
  53. - ͔͋͠͠Δ೔ʢϦϦʔεॳ೔͔΋……ʣΛڥʹ໓๢͢Δ͔΋ - ͱ͍͏࣌ʹύϑΥʔϚϯεΛਅ໘໨ʹߟ͑Δ΂͖ - ཱͪฦͬͯʮྑ͍ઃܭʯͱ͸ - ΞδϦςΟ - ॊೈੑ

    - ྑ͍ઃܭ => ࠷దԽͷ༨஍͕͋Δ͸ͣ ύϑΥʔϚϯεͱઃܭࢦ਑
  54. None
  55. ௨஌͢ΔϢʔβ͕ଟ͗͢Δέʔε ௨஌Λ࡞ͬͯૹΔ෦෼Ͱ٧·Δ͔΋ʜʜ

  56. None
  57. ૉ๿ʹϑΝϯΞ΢τ ௨஌࡞Δ෦෼΋QVTIૹΔ෦෼΋ͦͷ ϓϩηεɾεϨουͰ΍ͬͯ͠·͏

  58. None
  59. ߴස౓ͰૹΒΕΔͱ ࢮΜͰ͠·͍·͢ʂ Έ͍ͨͳ৔߹

  60. None
  61. όοϑΝʹΩϡʔΠϯά ϫʔΧʔͷ਺ͰεϩοτϦϯά ͍ͭͰʹ431

  62. None
  63. ࣮͸͜͜ͰڥքΛ෼͚ΔͱεοΩϦ͢Δʁ

  64. @startuml actor User participant Comment participant WatchingUser participant Queue participant

    Worker1 participant WorkerN participant Notification participant PushNotificationGateway Worker1 -> Queue : subscribe WorkerN -> Queue : subscribe User -> Comment : postComment Comment -> WatchingUser : fetchWatchingUser Comment -> Comment : buildNotificationBody Comment -> Queue : enqueueNotificationPayload group publishing as async until queue is empty Queue -> Worker1 : publish Worker1 -> Notification : create Notification -> PushNotificationGateway : sendNotification Queue -> WorkerN : publish WorkerN -> Notification : create Notification -> PushNotificationGateway : sendNotification end @enduml
  65. @startuml actor User participant Comment participant WatchingUser participant Queue participant

    Worker1 participant WorkerN participant Notification participant PushNotificationGateway Worker1 -> Queue : subscribe WorkerN -> Queue : subscribe User -> Comment : postComment Comment -> WatchingUser : fetchWatchingUser Comment -> Comment : buildNotificationBody Comment -> Queue : enqueueNotificationPayload group publishing as async until queue is empty Queue -> Worker1 : publish Worker1 -> Notification : create Notification -> PushNotificationGateway : sendNotification Queue -> WorkerN : publish WorkerN -> Notification : create Notification -> PushNotificationGateway : sendNotification end @enduml /PUJpDBUJPOΛ࡞Δ෦෼͝ͱ ΩϡʔΠϯάͯ͠͠·͏ ϫʔΧʔ͕͍͍ײ͡ʹॲཧ
  66. Notification͝ͱΩϡʔΠϯά͢ΔϞνϕʔγϣϯ - ଈ࣌ੑ͕ͳͯ͘΋Αͦ͞͏ - Comment͸dispatchʹઐ೦Ͱ͖Δ - rate limitͱ͔Λߟ͑Δඞཁ͕ͳ͘ͳΔ - ୯ҰͷίϯϙʔωϯτΛݟͨ࣌ʹγϯϓϧ

  67. Notification͝ͱΩϡʔΠϯά͢Δݒ೦ - ෦඼͕૿͑Δͱෳࡶੑ͕૿͢ - ϛΫϩͩͱγϯϓϧ͕ͩɼϚΫϩͩͱෳࡶʹͳͬͯͳ͍͔ - Worker͕ʮ୭͔ΒૹΒΕ͖ͯͨδϣϒʯ͔஌͓ͬͯ͘ඞཁ͕
 ͋ΔΜ͡Όͳ͍͔ʁ - =>

    ͜Ε͸ΩϡʔΛΘ͚Ε͹ྑ͍ - => ಛఆͷΩϡʔʹ͸ಛఆͷ୯ػೳWorkerΛඥ෇͚Δ - ΩϡʔΛϓϩτίϧͷΑ͏ʹऔΓѻ͏
  68. ΋ͷʹΑΔ (ϘτϧωοΫʹΑΔ) ߟ͍͖͑ͯ·͠ΐ͏

  69. - ૣ͗͢Δ࠷దԽ͸ࡑͰ͋Δ - ύϑΥʔϚϯεͷ౎߹͸υϝΠϯΛ࿪Ί͕ͪ - ·ͣ͸υϝΠϯʹدΓఴͬͨઃܭ͕ྑ͍ - ʮඒ͍͠΋ͷ͸ۭؾ఍߅͕গͳ͍ʯ - ͔͠͠࠷దԽͷ༨஍Λ࢒͢͜ͱ͸ॏཁ

    - ʮ࠷దԽͷ༨஍͕͋Δઃܭʯ͕ୈҰஈ֊ͱͯ͠ͷྑ͍ઃܭͰ͸ͳ͍͔ ύϑΥʔϚϯεͱઃܭࢦ਑
  70. Q?