Kaburaya: CPU負荷に応じて継続的に上限値を最適化する動的セマフォ / wsa_3_kaburaya

Kaburaya: CPU負荷に応じて継続的に上限値を最適化する動的セマフォ / wsa_3_kaburaya

2018.11.17 Web System Architecture 研究会 (WSA研)  #3
https://websystemarchitecture.hatenablog.jp/entry/2018/10/09/231937

Cd3d2cb2dadf5488935fe0ddaea7938a?s=128

monochromegane

November 17, 2018
Tweet

Transcript

  1. 1.

    ࡾ୐༔հ / Pepabo R&D Institute, GMO Pepabo, Inc. 2018.11.17 Web

    System Architecture ݚڀձ (WSAݚ) #3 Kaburaya: CPUෛՙʹԠͯ͡ܧଓతʹ ্ݶ஋Λ࠷దԽ͢ΔಈతηϚϑΥ
  2. 9.

    • ద੾ͳࢦඪ͕બఆͰ͖Ε͹୯७ͳࢦඪͰ΋ޮՌ͕͋Δ • Ծ૝αʔόͷ༧ଌతΦʔτεέʔϦϯά (*1)Ͱ͸ɼΞϓϦέʔγϣϯॲཧ಺ ༰Ͱ͸ͳ͘ɼӡ༻ܦݧ͔Βಘͨαʔό୯ҐͷεϧʔϓοτΛࢦඪͱͨ͠ɽ • ʮશࣗಈύϥϝʔλνϡʔχϯά͞Μʯ(*2)Ͱ͸ϝτϦΫεΛҰ఺ʹߜΓε ϧʔϓοτ͕࠷େԽ͢Δ஋Λ୳ࡧతʹٻΊͨɽ 9

    ैདྷख๏ *1. ࡾ୐ ༔հ, দຊ ྄հ, ྗ෢ ݈࣍, ܀ྛ ݈ଠ࿠, ΞΫηεස౓༧ଌʹجͮ͘Ծ૝αʔόͷܭըతΦʔτεέʔϦϯά, FIT 2018 ୈ17ճ৘ใ Պֶٕज़ϑΥʔϥϜ, CL-002, Sep 2018. *2. https://github.com/mirakui/tuningsan
  3. 16.

    1. ॳظ஋͔ΒϫʔΧʔ਺Λม͑ͳ͍FixController (ൺֱ༻) 2. CPU࢖༻཰100%Λ໨ඪ஋ͱ͠ɼෆ଍ͨ͠৔߹͸ workerΛ1ͣͭ૿Ճͤ͞Δ SimpleController 3. CPU࢖༻཰100%Λ໨ඪͱ͠ɼ໨ඪͱͷࠩ෼ͷKഒΛՃ͑Δ PController(ൺྫ੍ޚ)

    4. 3.ͷCPU࢖༻཰ͷ໨ඪ஋Λ90%ͱͨ͠΋ͷ 5. ௚ۙ3؍ଌ఺ͷฏۉΛ໨ඪ஋ͱͯ͠3؍ଌ͝ͱʹPControllerͷ໨ඪ஋ΛมԽͤ͞ΔDynamicController 6. ҰఆظؒͷCPU࢖༻཰ͷඪ४ภࠩΛͱͬͯͦΕ͕Ұఆͷ஋ҎԼͩͬͨΒ҆ఆͨ͠ͱΈͳͯ͠ɼworkerΛݮΒ͍ͯ͠ ͘StabilityController 7. CPU࢖༻཰Ͱ͸ͳͯ͘CPU࢖༻཰ͷมԽ཰Λݩʹ੍ޚ͢ΔRateController 8. 5.ͷDynamicControllerΛݩʹఆظͰ͸ͳ͘େ͖ͳมಈ͝ͱʹ໨ඪ஋Λݟ௚͢ํࣜ 9. 8.ͷDynamicControllerΛݩʹఆৗ࣌ͷෆཁͳworkerΛ࡟ݮ͢Δํࣜ 10. 9.ͷDynamicControllerΛݩʹมಈͷਫ਼౓ͱ଎౓Λ޲্ͤ͞ΔͨΊʹੵ෼ඍ෼੍ޚΛಋೖ͢Δํࣜ 16 ࠷దͳ੍ޚثʹ޲͚ͯ
  4. 18.
  5. 20.

    • γϛϡϨʔλ͸࣮࣌ؒͰ͸ͳ͘ɼ୯Ґ࣌ؒΛεςοϓͱΈͳ͢ • Job͸WorkloadΛ࣋ͪɼεςοϓ͝ͱͷCPUར༻཰Λఆٛ͢Δ • Workload͕0ͷεςοϓ͸ϒϩοΩϯάॲཧΛදݱ͢Δ • γϛϡϨʔλ͸εςοϓ͝ͱʹ೚ҙͷ਺ͷδϣϒΛ౤ೖ͢Δ • γϛϡϨʔλ͸εςοϓ͝ͱʹىಈՄೳͳϫʔΧʔ਺Λ੍ޚث͔Βऔಘ͢Δ

    • ϫʔΧʔ͸γϛϡϨʔλͰར༻ՄೳͳCPUར༻཰·Ͱδϣϒͷ֘౰εςοϓͷWorkloadΛফඅ ͢Δ • ফඅͰ͖ͳ͔ͬͨWorkload͸࣍ճͷεςοϓʹճ͞ΕΔ • Workload͕0ͷεςοϓ͸CPUࢿݯΛফඅ͠ͳ͍ͨΊແ৚݅ʹεςοϓΛਐΊΔ 20 γϛϡϨʔλʔཁ݅
  6. 27.
  7. 29.