ChatWorkとPHPと私

5e9da389e03683311d161a452a09a09d?s=47 tan-yuki
October 08, 2017

 ChatWorkとPHPと私

PHPConference 2017
ChatWork株式会社 田中佑樹

5e9da389e03683311d161a452a09a09d?s=128

tan-yuki

October 08, 2017
Tweet

Transcript

  1. ChatWorkͱPHPͱࢲ PHPConference 2017

  2. © ChatWork ✔ Java ✔ JavaScript ✔ PHP ɹScala ✔

    Vim ాத༎थ ChatWorkגࣜձࣾ ɹɹtan-yuki ɹɹtan_yuki ɹ৽ׁग़਎ ɹChatWork͔Ε͜Ε5೥໨ ɹೣ͕1ඖ
  3. © ChatWork ▸ ೔ຊൃϏδωενϟοτ ▸ λεΫ؅ཧ΍ϏσΦ௨࿩͕Մೳ ▸ ಋೖاۀ150,000ࣾʢ※2017೥9݄຤೔࣌఺ʣ

  4. © ChatWork ChatWorkͷΠϝʔδ

  5. © ChatWork ▸ Scala͚ͩ͡Όͳ͍ΑʂPHP΋΍ͬͯΔΑʂ ࣮ࡍ

  6. © ChatWork ͜ͷεϥΠυͷ໨త ▸ ͜Μͳਓͨͪʹฉ͍ͯ΋Β͍͍ͨ ▸ ϨΨγʔ͔Β୤٫͍ͨ͠ͱࢥ͍ͬͯΔ ▸ ֦େͭͭ͋͠Δاۀɾ૊৫ ▸

    ͜Μͳ͜ͱ͕Θ͔Δ ▸ ϨΨγʔ୤٫ͷͨΊͷઓུͷҰྫ ▸ ϨΨγʔ୤٫Λ௅ઓͨ͠ਓͨͪͷྺ࢙
  7. © ChatWork ྺ࢙͸܁Γฦ͢ ▸ ࣦഊͱ੒ޭͷ܁Γฦ͠ ▸ ྺ࢙͔Βֶ΅͏

  8. © ChatWork ChatWorkͱPHPͷྺ࢙

  9. © ChatWork ChatWorkͷ஀ੜ 1 2 3

  10. © ChatWork νϟοτϫʔΫ͕Ͱ͖Δ·Ͱ ▸ 2000೥ ▸ EC studio૑ۀ
 ʢ΋ͱ΋ͱ͸ChatWorkͱ͍͏ձࣾͰ͸ͳ͔ͬͨʣ ▸

    தখاۀ޲͚ͷιϦϡʔγϣϯΛఏڙ
  11. © ChatWork νϟοτϫʔΫ͕Ͱ͖Δ·Ͱ ▸ 2010೥ ▸ ࣾ಺πʔϧͱͯ͠ͷνϟοτϫʔΫΛ։ൃ ▸ Skypeͷෆຬͩͬͨ෦෼Λվྑ ▸

    ͨ·ͨ·UstreamͰެ։ͨ͠ͱ͜Ζɺେ൓ڹʂ ▸ 2011೥ ▸ ਖ਼ࣜͳϓϩμΫτͱͯ͠ϩʔϯν͢Δ
  12. © ChatWork ࣾ಺πʔϧ࣌ͷόʔδϣϯ

  13. © ChatWork ॳظϦϦʔεόʔδϣϯ

  14. © ChatWork νϟοτϫʔΫϦϦʔε࣌ͷঢ়گ ▸ ͓͔͛͞·ͰαʔϏε͸ٸ੒௕ ▸ νϟοτϒʔϜͷ೾΋͋ΓɺޱίϛͰେ͖͘޿͕͍ͬͯ͘ ▸ େاۀ΁ͷಋೖ΋ਐΉ ▸

    ໊ࣾΛChatWorkגࣜձࣾ΁มߋɺࣾӡΛṌ͚Δ֮ޛΛܾΊΔ
  15. © ChatWork ੵΈॏͳ͍ٕͬͯ͘ज़తෛ࠴ ▸ ͱʹ͔͘εϐʔυॏࢹ ▸ ։ൃɺ։ൃɺ։ൃɾɾɾ ▸ ޙΖΛৼΓฦΒͳ͍ ▸

    ਓһ૿Ճ ▸ ૿͑ଓ͚Δ҉໧஌ ▸ ࢲ͸͜͜Β΁ΜͰೖࣾʢ2013೥4݄ʣ ▸ Ҏલ͔Β࢖༻͍ͯͨ͠ಠࣗϑϨʔϜϫʔΫΛݩʹ։ൃΛ͢͢ΊΔ
  16. © ChatWork ಠࣗϑϨʔϜϫʔΫ ▸ ECFʢEC Frameworkʣ ▸ ࣾ಺ͷಠࣗϑϨʔϜϫʔΫʢPHP4ϕʔεʣ ▸ ಈతͳWebϖʔδΛαΫοͱ࡞Δ͜ͱΛ໨తͱ͍ͯ͠Δ

    ▸ શ෦ೖΓɺAll in OneͳϑϨʔϜϫʔΫ ▸ Smarty template, QueryBuilder, Validator, scaffolding, Form ▸ TestFramework, Mail, i18n, ….
  17. © ChatWork υΩϡϝϯτ͸ॆ࣮͍ͯ͠Δ

  18. © ChatWork ChatWork on ECF ▸ EC studioͷ੡඼͸͢΂ͯECFͰ࡞ΒΕ͍ͯͨ ▸ νϟοτϫʔΫ΋ྫ֎Ͱ͸ͳ͍

    ▸ ECF͸؆୯ͳಈతϖʔδΛ࡞ΔͨΊʹಛԽ͠ ͨϑϨʔϜϫʔΫ ▸ Ajaxલఏͷνϟοτπʔϧͷ૝ఆͳΜͯͳ͍
  19. © ChatWork ςετ on ECF ▸ Ϣχοτςετ͕GUIͰ༻ҙ͞Ε͍ͯͨ ▸ νΣοΫϘοΫεʹνΣοΫɺϘλϯΫϦοΫͰ࣮ߦ ▸

    શ෦νΣοΫ࣮ͯ͠ߦ͢ΔͱམͪΔʢҰͭҰͭͳΒಈ͘ʣ
  20. © ChatWork ECFҎલʹ ▸ νϟοτϫʔΫ͸΋ͱ΋ͱ͸ࣾ಺πʔϧͱͯ͠։ൃ͍ͯͨ͠ ▸ େن໛ͳνʔϜ։ൃ΍ߴτϥϑΟοΫͳαʔϏεͷߟྀ͕͞Ε͍ͯͳ͍ ▸ σʔλઃܭ͕େྔσʔλΛѻ͏࡞ΓͰ͸ͳ͍

  21. © ChatWork ͳΜͱ͔ͤͶ͹ɾɾɾ

  22. © ChatWork ͱΓ͋͑ͣϢχο τςετ ▸ ͱʹ͔͘ɺϢχοτςετΛॻ͖΍͍ͨ͘͢͠ ▸ ແҋʹϦϑΝΫλͯ͠΋ɺςετ͕ਏ͍ ▸ ࣾ಺ϝϯόʔ΋खಈςετͰͷݶքΛײ͓ͯ͡Γɺ

    ςετʹର͢ΔԹ౓ײ΋ߴ͔ͬͨ
  23. © ChatWork Ϣχο τςετͰಘΒΕΔ΋ͷ ▸ ؆୯ͳϛε͕ଈ࠲ʹΘ͔Δ ▸ ಛʹPHP͸࣮૷ऀ͕ҙࣝ͠ͳ͍ͱܕʹकΒΕͳ͍ ▸ ॲཧΛ෼ׂ͠ͳͯ͘͸Ϣχοτςετ͸ॻ͖ͮΒ͍

    ͷͰɺ੹຿Λ෼ׂ͢Δ͔͠ͳ͍ ▸ ڊେϝιο υ͕࡞ΒΕʹ͘͘ͳΔ ▸ ࣗ৴Λ࣋ͬͯϦϑΝΫλͰ͖Δ
  24. © ChatWork Ϣχο τςετͰಘΒΕͳ͍΋ͷ ▸ खಈςετΛ׬શʹͳ͘͢͜ͱ͸΄΅ແཧ ▸ Ϣχοτςετ͸खಈςετΛʮָʹ͢Δʯ͚ͩ ▸ खಈςετΛͮ͠Β͍෦෼ΛϢχοτςετͰ୲อ

    ͢ΔͱɺՁ஋͕ߴ͍
  25. © ChatWork ςετΛॻ͖΍͘͢͢ΔͨΊʹ ▸ ݱঢ়ͩͱΫϥεɾϝιουͷ੹຿͕େ͖͗ͯ͢Ϣχοτςετ͕ॻ͖ͮΒ͍ ▸ 500ߦΛ௒͑ΔϩδοΫͷڽΓݻ·ͬͨϝιου ▸ 1ສߦΛ௒͑ΔਆΫϥεͷଘࡏ ▸

    PSR४ڌͷύοέʔδΛ৽ͨʹ࡞ͬͨ ▸ ECFϕʔεͷΞϓϦέʔγϣϯ͔ΒPSR४ڌͷύοέʔδΛݺͼग़͢ܗ΁ Ҡߦ͍ͯͬͨ͠
  26. © ChatWork PSRඪ४ύοέʔδʹ෼ׂ ৽ػೳ ECFͷίʔυ PSRඪ४ύοέʔδ΁ͷҠߦ ςετ ςετ

  27. © ChatWork ύοέʔδ෼ׂͷϝϦοτ ▸ શ෦࡞Γม͑Δඞཁ͸ͳ͘ɺہॴతʹมߋ͢Δ͜ͱ͕Ͱ͖Δ ▸ ςετͮ͠Β͍ߏ੒͔Βςετ͠΍͍͢ߏ੒΁ͷΠϯΫϦϝϯλϧͳϦϑΝ ΫλϦϯά͕Մೳ

  28. © ChatWork ύοέʔδ෼ׂͷσϝϦοτ ▸ Ͱ΋ɺ݁ہECFʹ໨ΛͭͿ͍ͬͯΔ͚ͩ ▸ ࠜຊղܾͰ͸ͳ͍ ▸ ਏ͍ͱ͜Ζ͸࢒Γͦ͏

  29. © ChatWork ChatWork੒௕ظɾస׵ظ 1 2 3

  30. ։ൃ؀ڥ MAMP Vagrant, Ansible ϦϦʔε खಈσϓϩΠ (SFTP) Jenkins όʔδϣϯ؅ཧ SVN

    Git, Github CI - TravisCI ϨϏϡʔख๏ ௚઀આ໌ PullRequestϕʔε © ChatWork ։ൃͷঢ়گʢ2014೥ࠒʣ
  31. © ChatWork ·͊·͊ Ϟμϯʹͳ͖ͬͯͨ

  32. © ChatWork ͕ɺαʔόʔμ΢ϯ͕૬͙࣍ ▸ ϦϑΝΫλΛਐΊ͍ͯΔͱ͸͍͑ɺࠜຊతͳ෦෼͸ͦͷ·· ▸ Ϣʔβʔ૿Ճɺແཧͳҧ๏ݐங͕ੵΈॏͳΓαʔόʔμ΢ϯ͕૬͍࣍ͩ ▸ αʔϏεͷੑ্࣭ɺαʔϏεΛࢭΊΔͱϢʔβʔͷ࢓ࣄ͕ࢭ·ͬͯ͠·͏

  33. © ChatWork Internet GAE (Comet) ▸ εέʔϧ͠ʹ͍͘ઃܭ ▸ ݻఆ୆਺αʔόʔ ▸

    ΄ͱΜͲશͯͷ͜ͱΛWebαʔόʔͰ ಉظతʹॲཧ͍ͯ͠Δ ▸ ϑΝΠϧΞ οϓϩʔυ͕WebαʔόʔΛ ܦ༝ͯ͠S3΁Ξοϓϩʔυ͍ͯ͠Δ ໰୊఺ Tokyo S3 RDS(MySQL) ELB EC2 EC2 (groonga) 1 2 3 1 2 3
  34. © ChatWork ଧͪख ▸ AutoScalingಋೖʹΑΓμ΢ϯλΠϜ͕େ෯ʹݮগ ▸ NewRelicͷಋೖɺPHPͷॏ͍ͨॲཧ΍DB΁ͷΫΤϦΛݟ௚͢ ▸ SQSΛ༻͍ͨඇಉظͳॲཧ ▸

    WebαʔόʔͰ͸͋·Γ࢓ࣄΛͤ͞ͳ͍ 1 2 3
  35. © ChatWork Internet Tokyo ߏ੒ਤ ʢରࡦޙʣ GAE (Comet) BigQuery (API

    Logs) 2 Auto Scaling EC2 (Web Server) ElastiCache (Session) DynamoDB (Flags) S3 (Logs) RDS(MySQL) S3 Direct Upload / Download ELB CloudSearch Index EC2 (Worker) Get SQS
 (Task Queue) Push Glacier 2 3 1
  36. © ChatWork ͔͠͠ɺࠜຊղܾͰ͸ͳ͍ ▸ ίʔυϕʔε͸ґવͱͯ͠ݹ͍·· ▸ ͦ΋ͦ΋ͷઃܭతʹ໰୊͕͋Δ ▸ ٸ੒௕͢ΔαʔϏεɺ૿͑ΔϢʔβʔ਺ ▸

    ͜ͷ··ͩͱ؇΍͔ʹࢮΛ଴ͭͷΈɾɾɾ
  37. Α͠ɺγεςϜΛϦϓϨΠε͠Α͏

  38. © ChatWork ࠶࣮૷Λܾஅ ▸ ίʔυϕʔεΛഁغ͢Δ͜ͱΛܾஅ ▸ θϩϕʔεͰߟ͑ɺνϟοτϫʔΫΛߏங͢Δʹ͸ Ͳ͏͍ͬͨݴޠɾઃܭɾFW͕ద੾͔Λߟ͑Δ ▸ ࠷దͳઃܭͰ࠶௅ઓͰ͖Δ

  39. © ChatWork ٕज़ͷબఆ ▸ ΞʔΩςΫνϟબఆ߹॓Λ։࠵ ▸ ͍͔ͭ͘ͷνʔϜʹผΕɺͦΕͧΕͰ ৽͍͠ݴޠɾFWͰԾ࣮૷ͯ͠ΈΔ ▸ Python

    / Flask ▸ Scala / Play framework ▸ PHP / Laravel ▸ ͪͳΈʹࢲ͸PHPνʔϜ
  40. © ChatWork ߹॓ͷ෩ܠ ▸ ֤νʔϜ͝ͱʹ։ൃɾൃදΛߦ͍ɺͲͷݴޠ͕ྑͦ͞͏͔Λબఆ

  41. © ChatWork ScalaΛબఆ ▸ ڠٞͷ݁ՌɺScalaΛ࠾༻͢Δ͜ͱΛܾఆ ▸ େن໛PJ։ൃͰͷ੩తܕ෇͚ͷԸܙΛड͚͍ͨ ▸ ٕज़೉қ౓తʹ΋ͦ͜·Ͱϋʔυϧ͕ߴ͍΋ͷͰ͸ͳ͍ ▸

    ͸͡ΊͯScalaΛ৮ͬͨਓͰ΋ʮΘΓͱ͍͚Δʯͱ͍͏ධՁ ▸ ؔ਺ܕͬΆ͘։ൃ͢Δ͔ɺΦϒδΣΫτࢦ޲ͬΆ͘։ൃ͢Δ͔͸ࣗ༝
  42. © ChatWork ϦϓϨΠεͷൣғ ▸ ݱߦAPIΛScalaʹஔ͖׵͑Δ͜ͱΛ໨ඪͱ͢Δ ▸ νϟοτϫʔΫʹؔΘΔશػೳ͕ϦϓϨΠεର৅ ▸ طଘͷAPIͱฒߦͯ͠ӡ༻͢Δ͜ͱΛ૝ఆ ▸

    ֤ΫϥΠΞϯτ͸޷͖ͳλΠϛϯάͰ৽API΁Ҡߦ͢Δ ▸ APIͷIO΋େ͖͘มΘΔͷͰɺ͜ͷλΠϛϯάͰΫϥΠΞϯτଆ΋େ͖͘ ࡮৽
  43. © ChatWork Scalaͷ࠾༻΋Ճ଎ ▸ Ճ౻५Ұ͞Μʢ2014೥ೖࣾʣ ▸ ೔ຊScalaϢʔβʔζάϧʔϓൃىਓͷ ͻͱΓ ▸ DDD͓͡͞Μ͓ʹ͍͞Μ

    ▸ ΞʔΩςΫνϟઃܭɾScala/DDDͷࣾ ಺ܒ໤ ࣸਅࠨͷਓ
  44. © ChatWork ϦϓϨΠεମ੍ ▸ Scalaଆ ▸ ࠾༻2໊ɺۀ຿ҕୗ2໊ɺࣾһ߹Θͤͯܥ5໊ମ੍ ▸ PHPଆʢ಺෦APIɺͦͷଞϦϓϨΠεͷͨΊͷվमʣ ▸

    5໊ମ੍ <- ࢲ͸͜͜ʹ഑ଐ ▸ طଘͷӡ༻΋ฒߦ
  45. © ChatWork ৽γεςϜҠߦΞʔΩςΫνϟ ▸ ϥΠϒϚΠάϨʔγϣϯͱ͍͏ํ๏Λબ୒ͨ͠ ▸ ݱߦͷσʔλετΞͱ৽͍͠σʔλετΞʹಉ࣌ʹॻ͖ࠐΉ ▸ ݱߦσʔλ΋؇΍͔ʹҠߦ͍ͯ͘͠ ▸

    બఆཧ༝ ▸ ϝϯςφϯεʹΑΔ௕࣌ؒͷγεςϜμ΢ϯ͕ڐ͞Εͳ͍ ▸ طଘγεςϜ΁ͷӨڹΛ࠷খݶʹ͢ΔͨΊ
  46. © ChatWork ৽γεςϜҠߦΞʔΩςΫνϟ

  47. ४උ͸੔ͬͨ ͋ͱ͸લ΁ਐΉͷΈ

  48. © ChatWork ։࢝ͯ͠൒೥…

  49. © ChatWork ·ͩͰ͖ͳ͍ ▸ ݟ͍͑ͯͳ͔ͬͨվमϙΠϯτ͕ͨ͘͞Μݟ͑ͯ͘Δ ▸ ऴΘΓ͕ݟ͑ͳ͍ঢ়گ͕ଓ͘ ▸ ͜͜·Ͱ΍ͬͨͷ͔ͩΒɺ͜ͷ··Ҿ͖Լ͕ΔΘ͚ʹ͸͍͔ͳ͍ɾɾɾɻ

  50. © ChatWork ։࢝ͯ͠1೥…

  51. © ChatWork ·ͩͰ͖ͳ͍ ▸ ͦ΋ͦ΋ͷΞʔΩςΫνϟతͳઃܭ্ͷ໰୊΋ݟ͑࢝ΊΔ ▸ KeyValueετΞͰͷσʔλઃܭ ▸ LiveϚΠάϨʔγϣϯʹΑΔଟྔͳΠϕϯτͷॲཧɺແཧͳΞʔΩςΫ νϟ

    ▸ ͕͔ͩ͠͠ɺΑ͏΍͘։ൃͷऴΘΓ΋ݟ͑ͯ͘Δ ▸ ͜ͷ··Ҿ͖Լ͕ΔΘ͚ʹ͸͍͔ͳ͍ɾɾɾɻ
  52. © ChatWork ։࢝ͯ͠1೥൒…

  53. © ChatWork ·ͩͰ͖ͳ͍ ▸ ։ൃ͕΄΅ऴྃɺεςʔδϯά؀ڥ΁ࡌͤͯ୺຤Ͱ ಈ͔ͯ͠ΈΔ ▸ ύϑΥʔϚϯε্ͷେ͖ͳ໰୊͕ݟ͔ͭΔ ▸ DynamoDbͷ՝͕ۚଌఆෆೳ

    ▸ ͜ͷ··Ͱ͸AWSͷ՝͕ۚɾɾɾɻ
  54. © ChatWork ϦϓϨΠεΛҰ࣌அ೦ ▸ ͜͜ʹདྷͯύϑΥʔϚϯε্ͷେ͖ͳ໰୊͕ൃ֮ ▸ ࣾһؚΊͨνʔϜϝϯόʔͷർฐ͕͔ͳΓߴ·͍ͬͯͨ ▸ ϦϓϨΠεʹ޲͚ͯಥ͖ਐΜͰ͍͕ͨɺݶք͕དྷ͍ͯͨ ▸

    ձࣾͱͯ͠ͷେ͖ͳܾஅΛͤ͟ΔΛಘͳ͔ͬͨ
  55. © ChatWork Կ͕໰୊͔ͩͬͨ ▸ େ͖͘͸ϓϩδΣΫτϚωδϝϯτମ੍ͷ໰୊ͱݴ͑Δ ▸ ʮશ෦ϦϓϨΠεͯ͠΍Δʂʯͱ͍͏ҙؾࠐΈͷ΋ͱ࢝·͕ͬͨɺείʔ ϓ͕͋·Γʹ΋޿͗ͨ͢ɻͦΕ͚ͩγεςϜ͕੒௕͍ͯͨ͠ͱ΋ݴ͑Δɻ ▸ είʔϓΛڱΊɺεέδϡʔϧ͕ݟ͑ΔൣғͰͷϦϓϨΠεʹཹΊΔ΂͖

    ͩͬͨ
  56. © ChatWork Կ͕໰୊͔ͩͬͨ ▸ ύϑΥʔϚϯε΍՝ۚͷ͜ͱΛޙճ͠Ͱߟ͑ͯ͠·ͬͨ ▸ ϦεΫ؅ཧ͕Ͱ͖͍ͯͳ͔ͬͨ ▸ ͜͜Β΁Μ΋ϓϩδΣΫτϚωδϝϯτମ੍ͷ໰୊

  57. © ChatWork Ҿ͖ฦͤͳ͍ ▸ ్தͰҾ͖ฦ͢͜ͱ΋Մೳͩͬͨ ▸ ͔͠͠ɺҾ͖ฦ͢ͱ͍͏͜ͱ͸ࠓ·ͰੵΈ্͛ͯ ͖ͨ΋ͷΛશͯແʹ͢Δͱ͍͏ҙຯ ▸ ޙʹͳΕ͹ͳΔ΄ͲɺҾ͖ฦͤͳ͍ঢ়گʹ

    ▸ ͦͯ͠ɺޙʹͳΕ͹ͳΔ΄ͲɺҾ͖ฦͨ͠ͱ͖ͷ μϝʔδ͸େ͖͍
  58. © ChatWork ৼΓฦΓޙɺ࠶௅ઓ ▸ ΋͏͜ΕҎ্ϢʔβʔΛ଴ͨͤΔ͜ͱ͸Ͱ͖ͳ͍ ▸ είʔϓΛݶఆ͠ɺνʔϜϝϯόʔΛ෼͚ͨ ▸ γεςϜҠߦ͢ΔνʔϜ ▸

    ݱߦγεςϜͷػೳ։ൃΛ͢ΔνʔϜ ▸ Ͳ͜ΛγεςϜϦϓϨΠε͢Δ͔Λ࠶౓ఆٛ͢Δ
  59. © ChatWork ϝοηʔδϯάγεςϜΛ࠶ߏங ▸ ͜ͷ࣌ɺ٤ۓͷ՝୊ͱͳ͍ͬͯͨͷ͕ϝοηʔδͷ૿Ճ཰ ▸ ͜ͷ··ͩͱintͷ࠷େ஋Λ௒͑Δʢ໿21ԯʣ ▸ ϝοηʔδσʔλ͸MySQLʢRDSʣ΁֨ೲ͍ͯͨ͠ ▸

    idܕ͸unsigned int ▸ ͋ͱ2ഒͰऴྃ ▸ ૿Ճ཰ͷ৳ͼ͔Βͯ͠ɺͦΜͳઌͷ࿩Ͱ΋ͳͦ͞͏
  60. © ChatWork ϝοηʔδϯάγεςϜΛ࠶ߏங ▸ νϟοτγεςϜͷࠜװΛͳ͢ػೳͳͷͰϏδωεతͳՁ஋΋͋Γͦ͏ ▸ είʔϓ΋͍͍ײ͡ʹݶఆͰ͖͍ͯΔ

  61. ͍͟ɺ࠶ग़ൃ΁

  62. © ChatWork ࠶ग़ൃͷ࿩͸௕͘ͳΔͷͰলུ ▸ ৄ͘͠͸ԼهεϥΠυΛࢀߟʹ͍ͯͩ͘͠͞ ▸ https://speakerdeck.com/j5ik2o/chatworkfalsexin- metusezingusisutemuwozhi-eruji-shu ▸ ʮChatWork

    ϝοηʔδϯάγεςϜʯͰݕࡧ
  63. © ChatWork ͬ͘͟Γ͍͏ͱ ▸ े෼ͳίϯηϓτݕূʢPoCʣͷظؒΛ͸͞Έɺٕज़બఆΛ͓͜ͳͬͨ ▸ Akka, HBase, KafkaΛϕʔεͱͨ͠ΞʔΩςΫνϟ ▸

    1೥Λ͔͚ͯϝοηʔδϯάγεςϜΛϦϓϨΠε ▸ 2016೥12݄຤ɺ໷ؒ࡞ۀʹͯϦϦʔε
  64. © ChatWork Ұ୴ɺϦϓϨΠε͸ऴྃ ▸ ͓ർΕ༷Ͱͨ͠ ▸ ߹ܭͰ໿2೥൒͔͔ͬͨ

  65. © ChatWork ChatWorkͷݱࡏͱࠓޙ 1 2 3

  66. © ChatWork Ұ෦͸ஔ͖׵͚͑ͨͲ ▸ ґવͱͯ͠େ͖ͳίʔυϕʔε͸ͦͷ··ͷঢ়ଶ ▸ શͯΛஔ͖׵͑Δ͜ͱ͸ࠔ೉ ▸ ܦݧࡁΈ ▸

    طଘͷϨΨγʔίʔυͱͲ͏෇͖߹͍͔ͬͯ͘
  67. © ChatWork ϦϓϨΠε vs ϦϑΝΫλϦϯά ▸ ଟ͘ͷ৔߹͸ϦϑΝΫλϦϯάΛଓ͚Δ΄͏͕ྑ͍ ▸ ͦͷϨΨγʔίʔυʹ͸ɺ͍ͭ͘΋ͷվળͷ݁Ռ͕٧Ίࠐ·Ε͍ͯΔ ▸

    ͦͷϨΨγʔίʔυʹ͸ɺ͋ͳͨͷ஌Βͳ͍Α͏ͳػೳ͕Ӆ͞Ε͍ͯΔ ▸ ϦϓϨΠε͢Δʹ͸ɺ͋·Γʹଟ͘ͷ͕͔͔࣌ؒΔ
  68. © ChatWork ϦϓϨΠε vs ϦϑΝΫλϦϯά ▸ ҎԼͷ৔߹͸ϦϓϨΠε͕͍͍͔΋͠Εͳ͍ ▸ ϦϓϨΠεର৅͕খ͍͞ɺ͋Δ͍͸খ͘͞Ͱ͖Δ ▸

    σʔλઃܭ౳ɺࠜຊతͳͱ͜Ζʹ໰୊͕͋Δ ▸ ϦϓϨΠε͢Δ৔߹΋ग़དྷΔݶΓہॴతʹ͢Δ΄͏͕Α͍
  69. © ChatWork ࠓޙͷChatWork͸Ͳ͏͍͔ͯ͘͠ ▸ ෦෼తʹϦϓϨΠε͍ͯ͘͠ ▸ ͨͱ͑͹ɺAPIͷΤϯυϙΠϯτ୯Ґ౳ ▸ ϚΠΫϩαʔϏεԽ΋Ұͭͷखஈ ▸

    σʔλઃܭతʹແཧͳՕॴɺେྔͷσʔλΛѻ͏ՕॴʢAkka/Actor͕ಘ ҙͳ෦෼ʣ ▸ ͨͩ͠ɺશͯΛϦϓϨΠε͠ͳ͍ɺPHPͱ΋௕͍͓෇͖߹͍Λ͍ͯ͘͠ ▸ ݱࡏPHPόʔδϣϯΞοϓΛݕ౼தʢݱঢ়5.6ʣ
  70. © ChatWork PHP7 vs HHVM ▸ ඇৗʹ೰·͍͠બ୒

  71. © ChatWork εϧʔϓοτൺֱ ▸ abʹΑΔ؆୯ͳϕϯνϚʔΫ ▸ ҎԼ͸ϩάΠϯॲཧͷ଎౓ൺֱ runtime -c 10

    -c 50 -c 100 php 5.6 19.27 req / s 18.78 req / s 19.74 req / s php 7.1 151.44 req / s 161.81 req / s 161.20 req / s hhvm 3.15 143.16 req / s 161.31 req / s 162.61 req / s ▸ େ͖ͳҧ͍͸ͳͦ͞͏
  72. © ChatWork ϝϞϦ࢖༻ྔൺֱ ▸ Լهؔ਺Λ༻͍ͯ࢖༻ྔൺֱ ▸ memory_get_peak_usage — PHP ʹΑׂͬͯΓ౰ͯΒΕͨϝϞϦͷ࠷

    େ஋Λฦ͢ ▸ ୈҰҾ਺ʹtrueΛࢦఆͯ͠ܭଌɻҧ͍͸ҎԼɻ ࢀߟʣhttp://php.net/manual/ja/function.memory-get-peak-usage.php ͜ΕΛ TRUE ʹઃఆ͢ΔͱɺγεςϜׂ͕Γ౰࣮ͯͨࡍͷϝϞϦͷେ͖͞Λऔಘ͠·͢ɻ লུͨ͠Γ FALSEΛઃఆͨ͠Γ͢Δͱɺ emalloc() ͕࢖༻͢ΔϝϞϦͷΈΛใࠂ͠·͢ɻ
  73. © ChatWork runtime API A API B API C php

    5.6 9,961,472 12,582,912 17,039,360 php 7.1 2,097,152 2,097,152 4,194,304 hhvm 3.15 396,328 427,544 889,568 ϝϞϦ࢖༻ྔൺֱ ▸ 3छྨͷAPIͰͦΕͧΕܭଌ ▸ HHVM͕ܶతʹΑ͘ݟ͑Δ͕ɺPHPͱHHVM͸ಈ࡞Ϟσϧ͕ҟͳΔͨΊɺ औಘͰ͖Δ஋͕ҟͳΔ ▸ Ϛϧνϓϩηεͱγϯάϧϓϩηε+ϚϧνεϨου ࢀߟʣhttps://github.com/facebook/hhvm/issues/2257
  74. © ChatWork ݴޠػೳൺֱ ▸ HHVM (Hack) ▸ Generics, Nullable, Collections,

    Lambda, Tuple, … ▸ ϚϧνεϨουʹΑΔඇಉظॲཧ ▸ PHP7 ▸ TypeHinting͕௥Ճ ▸ Hackͷ΋ͷͱൺֱ͢Δͱऑ͍͔
  75. © ChatWork ίʔυվमྔ ▸ ͻͱͭͷAPIΛPHP7, HHVM্Ͱಈ͔͢·ͰͷมߋྔΛൺֱ ▸ ฐࣾͷ৔߹͸ɺґଘ͍ͯ͠ΔύοέʔδΛߋ৽͢Δඞཁ͕͋ͬͨͨΊ PHP7ͷํ͕มߋྔ͸ଟ͘ͳͬͨ ▸

    ͨͩ͠ɺHHVMͷ΄͏͸ϥϯλΠϜ͕ҟͳΔͨΊɺϋϚϦϙΠϯτ͕
 େ͖ͦ͏ ▸ ϢχοτςετΛ௨ͨ͠ͱ͖ʹɺ໧ͬͯࢮΜͰ͍ͨ
  76. © ChatWork ͦͷଞࢀߟ৘ใ ▸ Symfony ▸ ࣍ͷόʔδϣϯͰ͋ΔSymfony4͸HackΛαϙʔτ͠ͳ͍͜ͱΛൃද ▸ https://symfony.com/blog/symfony-4-end-of-hhvm-support ▸

    HHVM͕PHP7ͷαϙʔτΛ͓͜ͳΘͳ͍͜ͱΛൃද ▸ http://hhvm.com/blog/2017/09/18/the-future-of-hhvm.html
  77. © ChatWork ChatWork with PHP7 ▸ ChatWork͸PHP7Λબ୒ ▸ ੑೳࠩʹ͍ͭͯ͸େ͖ͳҧ͍͸ͳͦ͞͏ ▸

    PHPίϛϡχςΟͷେ͖͞΍ɺࠓޙͷ֤ϥΠϒϥϦͷαϙʔτঢ়گΛצ Ҋ͠PHP7ΛબΜͩ ▸ HHVM͸৽͍͠ϥϯλΠϜͷͨΊɺֶशίετ΍Πϯϑϥͷ੔උ౳ɺଟগ ͷίετ͸͔͔Δ ▸ PHP7ͷTypeHintingͰ΋ɺݱঢ়ͱൺ΂Ε͹े෼ڧྗ
  78. © ChatWork PHP7΁ͷҠߦઓུ ▸ ग़དྷΔݶΓϏοΫόϯϦϦʔε͸ආ͚͍ͨ ▸ ػೳ͝ͱʹมߋ͍ͨ͠

  79. © ChatWork PHP7΁ͷҠߦઓུ ▸ ΤϯυϙΠϯτ͝ͱʹPHP7ͱPHP5.6ʹ෼ذͤ͞Δ ▸ ಉҰαʔόʔʹͯPHP7ɺPHP5.6Λڞଘͤ͞Δ ▸ ຊདྷͰ͋Ε͹PHP7ͱPHP5.6༻ͷαʔόʔΛ༻ҙͯ͠ALB౳Ͱ෼ذ
 ͤ͞Δͷ͕ྑ͍

    ▸ ͔͠͠ɺ͍·ͷCDͷ࢓૊Έʹ৐͔ͬΔΑ͏ͳߏ੒ʹ͢ΔͨΊɺ͋͑ͯ
 ͜ͷΑ͏ͳߏ੒ʹ͍ͯ͠Δ
  80. © ChatWork ߏ੒ਤ

  81. © ChatWork · ͱ Ί

  82. © ChatWork ▸ ϨΨγʔίʔυͷվम͸ඇৗʹɺඇৗʹɺඇৗʹେม ▸ ٕज़తෛ࠴͸ܭըతͳฦࡁΛ ▸ ҰؾʹϦϓϨΠε͢Δͷ͸ɺख़ߟ্ͨ͠Ͱ ▸ ϦϓϨΠεʹ͓͍ͯ͸PoCΛߦ͍৻ॏͳݕূΛ͢΂͖

    ▸ ػೳ୯ҐͳͲɺͰ͖Δ͚ͩখ͘͞ϦϓϨΠε͍ͯ͘͠ͱΑ͍ ·ͱΊ
  83. © ChatWork ΤϯδχΞืूத http://corp.chatwork.com/ja/recruit/ ▸ ओମੑΛ࣋ͪɺࣗΒߦಈͰ͖Δ ▸ ଞऀΛೝΊɺଚॏͰ͖Δ ▸ ৘ใΛूΊɺڞ༗Ͱ͖Δ

    ͱ͍͏ํΛ׻ܴ͠·͢ʂ