Slide 1

Slide 1 text

ChatWorkͱPHPͱࢲ PHPConference 2017

Slide 2

Slide 2 text

© ChatWork ✔ Java ✔ JavaScript ✔ PHP ɹScala ✔ Vim ాத༎थ ChatWorkגࣜձࣾ ɹɹtan-yuki ɹɹtan_yuki ɹ৽ׁग़਎ ɹChatWork͔Ε͜Ε5೥໨ ɹೣ͕1ඖ

Slide 3

Slide 3 text

© ChatWork ▸ ೔ຊൃϏδωενϟοτ ▸ λεΫ؅ཧ΍ϏσΦ௨࿩͕Մೳ ▸ ಋೖاۀ150,000ࣾʢ※2017೥9݄຤೔࣌఺ʣ

Slide 4

Slide 4 text

© ChatWork ChatWorkͷΠϝʔδ

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

© ChatWork ͜ͷεϥΠυͷ໨త ▸ ͜Μͳਓͨͪʹฉ͍ͯ΋Β͍͍ͨ ▸ ϨΨγʔ͔Β୤٫͍ͨ͠ͱࢥ͍ͬͯΔ ▸ ֦େͭͭ͋͠Δاۀɾ૊৫ ▸ ͜Μͳ͜ͱ͕Θ͔Δ ▸ ϨΨγʔ୤٫ͷͨΊͷઓུͷҰྫ ▸ ϨΨγʔ୤٫Λ௅ઓͨ͠ਓͨͪͷྺ࢙

Slide 7

Slide 7 text

© ChatWork ྺ࢙͸܁Γฦ͢ ▸ ࣦഊͱ੒ޭͷ܁Γฦ͠ ▸ ྺ࢙͔Βֶ΅͏

Slide 8

Slide 8 text

© ChatWork ChatWorkͱPHPͷྺ࢙

Slide 9

Slide 9 text

© ChatWork ChatWorkͷ஀ੜ 1 2 3

Slide 10

Slide 10 text

© ChatWork νϟοτϫʔΫ͕Ͱ͖Δ·Ͱ ▸ 2000೥ ▸ EC studio૑ۀ
 ʢ΋ͱ΋ͱ͸ChatWorkͱ͍͏ձࣾͰ͸ͳ͔ͬͨʣ ▸ தখاۀ޲͚ͷιϦϡʔγϣϯΛఏڙ

Slide 11

Slide 11 text

© ChatWork νϟοτϫʔΫ͕Ͱ͖Δ·Ͱ ▸ 2010೥ ▸ ࣾ಺πʔϧͱͯ͠ͷνϟοτϫʔΫΛ։ൃ ▸ Skypeͷෆຬͩͬͨ෦෼Λվྑ ▸ ͨ·ͨ·UstreamͰެ։ͨ͠ͱ͜Ζɺେ൓ڹʂ ▸ 2011೥ ▸ ਖ਼ࣜͳϓϩμΫτͱͯ͠ϩʔϯν͢Δ

Slide 12

Slide 12 text

© ChatWork ࣾ಺πʔϧ࣌ͷόʔδϣϯ

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

© ChatWork νϟοτϫʔΫϦϦʔε࣌ͷঢ়گ ▸ ͓͔͛͞·ͰαʔϏε͸ٸ੒௕ ▸ νϟοτϒʔϜͷ೾΋͋ΓɺޱίϛͰେ͖͘޿͕͍ͬͯ͘ ▸ େاۀ΁ͷಋೖ΋ਐΉ ▸ ໊ࣾΛChatWorkגࣜձࣾ΁มߋɺࣾӡΛṌ͚Δ֮ޛΛܾΊΔ

Slide 15

Slide 15 text

© ChatWork ੵΈॏͳ͍ٕͬͯ͘ज़తෛ࠴ ▸ ͱʹ͔͘εϐʔυॏࢹ ▸ ։ൃɺ։ൃɺ։ൃɾɾɾ ▸ ޙΖΛৼΓฦΒͳ͍ ▸ ਓһ૿Ճ ▸ ૿͑ଓ͚Δ҉໧஌ ▸ ࢲ͸͜͜Β΁ΜͰೖࣾʢ2013೥4݄ʣ ▸ Ҏલ͔Β࢖༻͍ͯͨ͠ಠࣗϑϨʔϜϫʔΫΛݩʹ։ൃΛ͢͢ΊΔ

Slide 16

Slide 16 text

© ChatWork ಠࣗϑϨʔϜϫʔΫ ▸ ECFʢEC Frameworkʣ ▸ ࣾ಺ͷಠࣗϑϨʔϜϫʔΫʢPHP4ϕʔεʣ ▸ ಈతͳWebϖʔδΛαΫοͱ࡞Δ͜ͱΛ໨తͱ͍ͯ͠Δ ▸ શ෦ೖΓɺAll in OneͳϑϨʔϜϫʔΫ ▸ Smarty template, QueryBuilder, Validator, scaffolding, Form ▸ TestFramework, Mail, i18n, ….

Slide 17

Slide 17 text

© ChatWork υΩϡϝϯτ͸ॆ࣮͍ͯ͠Δ

Slide 18

Slide 18 text

© ChatWork ChatWork on ECF ▸ EC studioͷ੡඼͸͢΂ͯECFͰ࡞ΒΕ͍ͯͨ ▸ νϟοτϫʔΫ΋ྫ֎Ͱ͸ͳ͍ ▸ ECF͸؆୯ͳಈతϖʔδΛ࡞ΔͨΊʹಛԽ͠ ͨϑϨʔϜϫʔΫ ▸ Ajaxલఏͷνϟοτπʔϧͷ૝ఆͳΜͯͳ͍

Slide 19

Slide 19 text

© ChatWork ςετ on ECF ▸ Ϣχοτςετ͕GUIͰ༻ҙ͞Ε͍ͯͨ ▸ νΣοΫϘοΫεʹνΣοΫɺϘλϯΫϦοΫͰ࣮ߦ ▸ શ෦νΣοΫ࣮ͯ͠ߦ͢ΔͱམͪΔʢҰͭҰͭͳΒಈ͘ʣ

Slide 20

Slide 20 text

© ChatWork ECFҎલʹ ▸ νϟοτϫʔΫ͸΋ͱ΋ͱ͸ࣾ಺πʔϧͱͯ͠։ൃ͍ͯͨ͠ ▸ େن໛ͳνʔϜ։ൃ΍ߴτϥϑΟοΫͳαʔϏεͷߟྀ͕͞Ε͍ͯͳ͍ ▸ σʔλઃܭ͕େྔσʔλΛѻ͏࡞ΓͰ͸ͳ͍

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

© ChatWork Ϣχο τςετͰಘΒΕΔ΋ͷ ▸ ؆୯ͳϛε͕ଈ࠲ʹΘ͔Δ ▸ ಛʹPHP͸࣮૷ऀ͕ҙࣝ͠ͳ͍ͱܕʹकΒΕͳ͍ ▸ ॲཧΛ෼ׂ͠ͳͯ͘͸Ϣχοτςετ͸ॻ͖ͮΒ͍ ͷͰɺ੹຿Λ෼ׂ͢Δ͔͠ͳ͍ ▸ ڊେϝιο υ͕࡞ΒΕʹ͘͘ͳΔ ▸ ࣗ৴Λ࣋ͬͯϦϑΝΫλͰ͖Δ

Slide 24

Slide 24 text

© ChatWork Ϣχο τςετͰಘΒΕͳ͍΋ͷ ▸ खಈςετΛ׬શʹͳ͘͢͜ͱ͸΄΅ແཧ ▸ Ϣχοτςετ͸खಈςετΛʮָʹ͢Δʯ͚ͩ ▸ खಈςετΛͮ͠Β͍෦෼ΛϢχοτςετͰ୲อ ͢ΔͱɺՁ஋͕ߴ͍

Slide 25

Slide 25 text

© ChatWork ςετΛॻ͖΍͘͢͢ΔͨΊʹ ▸ ݱঢ়ͩͱΫϥεɾϝιουͷ੹຿͕େ͖͗ͯ͢Ϣχοτςετ͕ॻ͖ͮΒ͍ ▸ 500ߦΛ௒͑ΔϩδοΫͷڽΓݻ·ͬͨϝιου ▸ 1ສߦΛ௒͑ΔਆΫϥεͷଘࡏ ▸ PSR४ڌͷύοέʔδΛ৽ͨʹ࡞ͬͨ ▸ ECFϕʔεͷΞϓϦέʔγϣϯ͔ΒPSR४ڌͷύοέʔδΛݺͼग़͢ܗ΁ Ҡߦ͍ͯͬͨ͠

Slide 26

Slide 26 text

© ChatWork PSRඪ४ύοέʔδʹ෼ׂ ৽ػೳ ECFͷίʔυ PSRඪ४ύοέʔδ΁ͷҠߦ ςετ ςετ

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

։ൃ؀ڥ MAMP Vagrant, Ansible ϦϦʔε खಈσϓϩΠ (SFTP) Jenkins όʔδϣϯ؅ཧ SVN Git, Github CI - TravisCI ϨϏϡʔख๏ ௚઀આ໌ PullRequestϕʔε © ChatWork ։ൃͷঢ়گʢ2014೥ࠒʣ

Slide 31

Slide 31 text

© ChatWork ·͊·͊ Ϟμϯʹͳ͖ͬͯͨ

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

© ChatWork Internet GAE (Comet) ▸ εέʔϧ͠ʹ͍͘ઃܭ ▸ ݻఆ୆਺αʔόʔ ▸ ΄ͱΜͲશͯͷ͜ͱΛWebαʔόʔͰ ಉظతʹॲཧ͍ͯ͠Δ ▸ ϑΝΠϧΞ οϓϩʔυ͕WebαʔόʔΛ ܦ༝ͯ͠S3΁Ξοϓϩʔυ͍ͯ͠Δ ໰୊఺ Tokyo S3 RDS(MySQL) ELB EC2 EC2 (groonga) 1 2 3 1 2 3

Slide 34

Slide 34 text

© ChatWork ଧͪख ▸ AutoScalingಋೖʹΑΓμ΢ϯλΠϜ͕େ෯ʹݮগ ▸ NewRelicͷಋೖɺPHPͷॏ͍ͨॲཧ΍DB΁ͷΫΤϦΛݟ௚͢ ▸ SQSΛ༻͍ͨඇಉظͳॲཧ ▸ WebαʔόʔͰ͸͋·Γ࢓ࣄΛͤ͞ͳ͍ 1 2 3

Slide 35

Slide 35 text

© 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

Slide 36

Slide 36 text

© ChatWork ͔͠͠ɺࠜຊղܾͰ͸ͳ͍ ▸ ίʔυϕʔε͸ґવͱͯ͠ݹ͍·· ▸ ͦ΋ͦ΋ͷઃܭతʹ໰୊͕͋Δ ▸ ٸ੒௕͢ΔαʔϏεɺ૿͑ΔϢʔβʔ਺ ▸ ͜ͷ··ͩͱ؇΍͔ʹࢮΛ଴ͭͷΈɾɾɾ

Slide 37

Slide 37 text

Α͠ɺγεςϜΛϦϓϨΠε͠Α͏

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

© ChatWork ٕज़ͷબఆ ▸ ΞʔΩςΫνϟબఆ߹॓Λ։࠵ ▸ ͍͔ͭ͘ͷνʔϜʹผΕɺͦΕͧΕͰ ৽͍͠ݴޠɾFWͰԾ࣮૷ͯ͠ΈΔ ▸ Python / Flask ▸ Scala / Play framework ▸ PHP / Laravel ▸ ͪͳΈʹࢲ͸PHPνʔϜ

Slide 40

Slide 40 text

© ChatWork ߹॓ͷ෩ܠ ▸ ֤νʔϜ͝ͱʹ։ൃɾൃදΛߦ͍ɺͲͷݴޠ͕ྑͦ͞͏͔Λબఆ

Slide 41

Slide 41 text

© ChatWork ScalaΛબఆ ▸ ڠٞͷ݁ՌɺScalaΛ࠾༻͢Δ͜ͱΛܾఆ ▸ େن໛PJ։ൃͰͷ੩తܕ෇͚ͷԸܙΛड͚͍ͨ ▸ ٕज़೉қ౓తʹ΋ͦ͜·Ͱϋʔυϧ͕ߴ͍΋ͷͰ͸ͳ͍ ▸ ͸͡ΊͯScalaΛ৮ͬͨਓͰ΋ʮΘΓͱ͍͚Δʯͱ͍͏ධՁ ▸ ؔ਺ܕͬΆ͘։ൃ͢Δ͔ɺΦϒδΣΫτࢦ޲ͬΆ͘։ൃ͢Δ͔͸ࣗ༝

Slide 42

Slide 42 text

© ChatWork ϦϓϨΠεͷൣғ ▸ ݱߦAPIΛScalaʹஔ͖׵͑Δ͜ͱΛ໨ඪͱ͢Δ ▸ νϟοτϫʔΫʹؔΘΔશػೳ͕ϦϓϨΠεର৅ ▸ طଘͷAPIͱฒߦͯ͠ӡ༻͢Δ͜ͱΛ૝ఆ ▸ ֤ΫϥΠΞϯτ͸޷͖ͳλΠϛϯάͰ৽API΁Ҡߦ͢Δ ▸ APIͷIO΋େ͖͘มΘΔͷͰɺ͜ͷλΠϛϯάͰΫϥΠΞϯτଆ΋େ͖͘ ࡮৽

Slide 43

Slide 43 text

© ChatWork Scalaͷ࠾༻΋Ճ଎ ▸ Ճ౻५Ұ͞Μʢ2014೥ೖࣾʣ ▸ ೔ຊScalaϢʔβʔζάϧʔϓൃىਓͷ ͻͱΓ ▸ DDD͓͡͞Μ͓ʹ͍͞Μ ▸ ΞʔΩςΫνϟઃܭɾScala/DDDͷࣾ ಺ܒ໤ ࣸਅࠨͷਓ

Slide 44

Slide 44 text

© ChatWork ϦϓϨΠεମ੍ ▸ Scalaଆ ▸ ࠾༻2໊ɺۀ຿ҕୗ2໊ɺࣾһ߹Θͤͯܥ5໊ମ੍ ▸ PHPଆʢ಺෦APIɺͦͷଞϦϓϨΠεͷͨΊͷվमʣ ▸ 5໊ମ੍ <- ࢲ͸͜͜ʹ഑ଐ ▸ طଘͷӡ༻΋ฒߦ

Slide 45

Slide 45 text

© ChatWork ৽γεςϜҠߦΞʔΩςΫνϟ ▸ ϥΠϒϚΠάϨʔγϣϯͱ͍͏ํ๏Λબ୒ͨ͠ ▸ ݱߦͷσʔλετΞͱ৽͍͠σʔλετΞʹಉ࣌ʹॻ͖ࠐΉ ▸ ݱߦσʔλ΋؇΍͔ʹҠߦ͍ͯ͘͠ ▸ બఆཧ༝ ▸ ϝϯςφϯεʹΑΔ௕࣌ؒͷγεςϜμ΢ϯ͕ڐ͞Εͳ͍ ▸ طଘγεςϜ΁ͷӨڹΛ࠷খݶʹ͢ΔͨΊ

Slide 46

Slide 46 text

© ChatWork ৽γεςϜҠߦΞʔΩςΫνϟ

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

© ChatWork ։࢝ͯ͠൒೥…

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

© ChatWork ։࢝ͯ͠1೥…

Slide 51

Slide 51 text

© ChatWork ·ͩͰ͖ͳ͍ ▸ ͦ΋ͦ΋ͷΞʔΩςΫνϟతͳઃܭ্ͷ໰୊΋ݟ͑࢝ΊΔ ▸ KeyValueετΞͰͷσʔλઃܭ ▸ LiveϚΠάϨʔγϣϯʹΑΔଟྔͳΠϕϯτͷॲཧɺແཧͳΞʔΩςΫ νϟ ▸ ͕͔ͩ͠͠ɺΑ͏΍͘։ൃͷऴΘΓ΋ݟ͑ͯ͘Δ ▸ ͜ͷ··Ҿ͖Լ͕ΔΘ͚ʹ͸͍͔ͳ͍ɾɾɾɻ

Slide 52

Slide 52 text

© ChatWork ։࢝ͯ͠1೥൒…

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

© ChatWork ϦϓϨΠεΛҰ࣌அ೦ ▸ ͜͜ʹདྷͯύϑΥʔϚϯε্ͷେ͖ͳ໰୊͕ൃ֮ ▸ ࣾһؚΊͨνʔϜϝϯόʔͷർฐ͕͔ͳΓߴ·͍ͬͯͨ ▸ ϦϓϨΠεʹ޲͚ͯಥ͖ਐΜͰ͍͕ͨɺݶք͕དྷ͍ͯͨ ▸ ձࣾͱͯ͠ͷେ͖ͳܾஅΛͤ͟ΔΛಘͳ͔ͬͨ

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

© ChatWork ৼΓฦΓޙɺ࠶௅ઓ ▸ ΋͏͜ΕҎ্ϢʔβʔΛ଴ͨͤΔ͜ͱ͸Ͱ͖ͳ͍ ▸ είʔϓΛݶఆ͠ɺνʔϜϝϯόʔΛ෼͚ͨ ▸ γεςϜҠߦ͢ΔνʔϜ ▸ ݱߦγεςϜͷػೳ։ൃΛ͢ΔνʔϜ ▸ Ͳ͜ΛγεςϜϦϓϨΠε͢Δ͔Λ࠶౓ఆٛ͢Δ

Slide 59

Slide 59 text

© ChatWork ϝοηʔδϯάγεςϜΛ࠶ߏங ▸ ͜ͷ࣌ɺ٤ۓͷ՝୊ͱͳ͍ͬͯͨͷ͕ϝοηʔδͷ૿Ճ཰ ▸ ͜ͷ··ͩͱintͷ࠷େ஋Λ௒͑Δʢ໿21ԯʣ ▸ ϝοηʔδσʔλ͸MySQLʢRDSʣ΁֨ೲ͍ͯͨ͠ ▸ idܕ͸unsigned int ▸ ͋ͱ2ഒͰऴྃ ▸ ૿Ճ཰ͷ৳ͼ͔Βͯ͠ɺͦΜͳઌͷ࿩Ͱ΋ͳͦ͞͏

Slide 60

Slide 60 text

© ChatWork ϝοηʔδϯάγεςϜΛ࠶ߏங ▸ νϟοτγεςϜͷࠜװΛͳ͢ػೳͳͷͰϏδωεతͳՁ஋΋͋Γͦ͏ ▸ είʔϓ΋͍͍ײ͡ʹݶఆͰ͖͍ͯΔ

Slide 61

Slide 61 text

͍͟ɺ࠶ग़ൃ΁

Slide 62

Slide 62 text

© ChatWork ࠶ग़ൃͷ࿩͸௕͘ͳΔͷͰলུ ▸ ৄ͘͠͸ԼهεϥΠυΛࢀߟʹ͍ͯͩ͘͠͞ ▸ https://speakerdeck.com/j5ik2o/chatworkfalsexin- metusezingusisutemuwozhi-eruji-shu ▸ ʮChatWork ϝοηʔδϯάγεςϜʯͰݕࡧ

Slide 63

Slide 63 text

© ChatWork ͬ͘͟Γ͍͏ͱ ▸ े෼ͳίϯηϓτݕূʢPoCʣͷظؒΛ͸͞Έɺٕज़બఆΛ͓͜ͳͬͨ ▸ Akka, HBase, KafkaΛϕʔεͱͨ͠ΞʔΩςΫνϟ ▸ 1೥Λ͔͚ͯϝοηʔδϯάγεςϜΛϦϓϨΠε ▸ 2016೥12݄຤ɺ໷ؒ࡞ۀʹͯϦϦʔε

Slide 64

Slide 64 text

© ChatWork Ұ୴ɺϦϓϨΠε͸ऴྃ ▸ ͓ർΕ༷Ͱͨ͠ ▸ ߹ܭͰ໿2೥൒͔͔ͬͨ

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

© ChatWork Ұ෦͸ஔ͖׵͚͑ͨͲ ▸ ґવͱͯ͠େ͖ͳίʔυϕʔε͸ͦͷ··ͷঢ়ଶ ▸ શͯΛஔ͖׵͑Δ͜ͱ͸ࠔ೉ ▸ ܦݧࡁΈ ▸ طଘͷϨΨγʔίʔυͱͲ͏෇͖߹͍͔ͬͯ͘

Slide 67

Slide 67 text

© ChatWork ϦϓϨΠε vs ϦϑΝΫλϦϯά ▸ ଟ͘ͷ৔߹͸ϦϑΝΫλϦϯάΛଓ͚Δ΄͏͕ྑ͍ ▸ ͦͷϨΨγʔίʔυʹ͸ɺ͍ͭ͘΋ͷվળͷ݁Ռ͕٧Ίࠐ·Ε͍ͯΔ ▸ ͦͷϨΨγʔίʔυʹ͸ɺ͋ͳͨͷ஌Βͳ͍Α͏ͳػೳ͕Ӆ͞Ε͍ͯΔ ▸ ϦϓϨΠε͢Δʹ͸ɺ͋·Γʹଟ͘ͷ͕͔͔࣌ؒΔ

Slide 68

Slide 68 text

© ChatWork ϦϓϨΠε vs ϦϑΝΫλϦϯά ▸ ҎԼͷ৔߹͸ϦϓϨΠε͕͍͍͔΋͠Εͳ͍ ▸ ϦϓϨΠεର৅͕খ͍͞ɺ͋Δ͍͸খ͘͞Ͱ͖Δ ▸ σʔλઃܭ౳ɺࠜຊతͳͱ͜Ζʹ໰୊͕͋Δ ▸ ϦϓϨΠε͢Δ৔߹΋ग़དྷΔݶΓہॴతʹ͢Δ΄͏͕Α͍

Slide 69

Slide 69 text

© ChatWork ࠓޙͷChatWork͸Ͳ͏͍͔ͯ͘͠ ▸ ෦෼తʹϦϓϨΠε͍ͯ͘͠ ▸ ͨͱ͑͹ɺAPIͷΤϯυϙΠϯτ୯Ґ౳ ▸ ϚΠΫϩαʔϏεԽ΋Ұͭͷखஈ ▸ σʔλઃܭతʹແཧͳՕॴɺେྔͷσʔλΛѻ͏ՕॴʢAkka/Actor͕ಘ ҙͳ෦෼ʣ ▸ ͨͩ͠ɺશͯΛϦϓϨΠε͠ͳ͍ɺPHPͱ΋௕͍͓෇͖߹͍Λ͍ͯ͘͠ ▸ ݱࡏPHPόʔδϣϯΞοϓΛݕ౼தʢݱঢ়5.6ʣ

Slide 70

Slide 70 text

© ChatWork PHP7 vs HHVM ▸ ඇৗʹ೰·͍͠બ୒

Slide 71

Slide 71 text

© 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 ▸ େ͖ͳҧ͍͸ͳͦ͞͏

Slide 72

Slide 72 text

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

Slide 73

Slide 73 text

© 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

Slide 74

Slide 74 text

© ChatWork ݴޠػೳൺֱ ▸ HHVM (Hack) ▸ Generics, Nullable, Collections, Lambda, Tuple, … ▸ ϚϧνεϨουʹΑΔඇಉظॲཧ ▸ PHP7 ▸ TypeHinting͕௥Ճ ▸ Hackͷ΋ͷͱൺֱ͢Δͱऑ͍͔

Slide 75

Slide 75 text

© ChatWork ίʔυվमྔ ▸ ͻͱͭͷAPIΛPHP7, HHVM্Ͱಈ͔͢·ͰͷมߋྔΛൺֱ ▸ ฐࣾͷ৔߹͸ɺґଘ͍ͯ͠ΔύοέʔδΛߋ৽͢Δඞཁ͕͋ͬͨͨΊ PHP7ͷํ͕มߋྔ͸ଟ͘ͳͬͨ ▸ ͨͩ͠ɺHHVMͷ΄͏͸ϥϯλΠϜ͕ҟͳΔͨΊɺϋϚϦϙΠϯτ͕
 େ͖ͦ͏ ▸ ϢχοτςετΛ௨ͨ͠ͱ͖ʹɺ໧ͬͯࢮΜͰ͍ͨ

Slide 76

Slide 76 text

© 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

Slide 77

Slide 77 text

© ChatWork ChatWork with PHP7 ▸ ChatWork͸PHP7Λબ୒ ▸ ੑೳࠩʹ͍ͭͯ͸େ͖ͳҧ͍͸ͳͦ͞͏ ▸ PHPίϛϡχςΟͷେ͖͞΍ɺࠓޙͷ֤ϥΠϒϥϦͷαϙʔτঢ়گΛצ Ҋ͠PHP7ΛબΜͩ ▸ HHVM͸৽͍͠ϥϯλΠϜͷͨΊɺֶशίετ΍Πϯϑϥͷ੔උ౳ɺଟগ ͷίετ͸͔͔Δ ▸ PHP7ͷTypeHintingͰ΋ɺݱঢ়ͱൺ΂Ε͹े෼ڧྗ

Slide 78

Slide 78 text

© ChatWork PHP7΁ͷҠߦઓུ ▸ ग़དྷΔݶΓϏοΫόϯϦϦʔε͸ආ͚͍ͨ ▸ ػೳ͝ͱʹมߋ͍ͨ͠

Slide 79

Slide 79 text

© ChatWork PHP7΁ͷҠߦઓུ ▸ ΤϯυϙΠϯτ͝ͱʹPHP7ͱPHP5.6ʹ෼ذͤ͞Δ ▸ ಉҰαʔόʔʹͯPHP7ɺPHP5.6Λڞଘͤ͞Δ ▸ ຊདྷͰ͋Ε͹PHP7ͱPHP5.6༻ͷαʔόʔΛ༻ҙͯ͠ALB౳Ͱ෼ذ
 ͤ͞Δͷ͕ྑ͍ ▸ ͔͠͠ɺ͍·ͷCDͷ࢓૊Έʹ৐͔ͬΔΑ͏ͳߏ੒ʹ͢ΔͨΊɺ͋͑ͯ
 ͜ͷΑ͏ͳߏ੒ʹ͍ͯ͠Δ

Slide 80

Slide 80 text

© ChatWork ߏ੒ਤ

Slide 81

Slide 81 text

© ChatWork · ͱ Ί

Slide 82

Slide 82 text

© ChatWork ▸ ϨΨγʔίʔυͷվम͸ඇৗʹɺඇৗʹɺඇৗʹେม ▸ ٕज़తෛ࠴͸ܭըతͳฦࡁΛ ▸ ҰؾʹϦϓϨΠε͢Δͷ͸ɺख़ߟ্ͨ͠Ͱ ▸ ϦϓϨΠεʹ͓͍ͯ͸PoCΛߦ͍৻ॏͳݕূΛ͢΂͖ ▸ ػೳ୯ҐͳͲɺͰ͖Δ͚ͩখ͘͞ϦϓϨΠε͍ͯ͘͠ͱΑ͍ ·ͱΊ

Slide 83

Slide 83 text

© ChatWork ΤϯδχΞืूத http://corp.chatwork.com/ja/recruit/ ▸ ओମੑΛ࣋ͪɺࣗΒߦಈͰ͖Δ ▸ ଞऀΛೝΊɺଚॏͰ͖Δ ▸ ৘ใΛूΊɺڞ༗Ͱ͖Δ ͱ͍͏ํΛ׻ܴ͠·͢ʂ