Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ChatWorkとPHPと私
Search
tan-yuki
October 08, 2017
Technology
14
15k
ChatWorkとPHPと私
PHPConference 2017
ChatWork株式会社 田中佑樹
tan-yuki
October 08, 2017
Tweet
Share
More Decks by tan-yuki
See All by tan-yuki
モノリスから小さなシステムへ / Chatworkシステム移行の現在地と今後について@開発生産性カンファレンス
tanakayuki
3
5.1k
2024-03-16 社員30人 → 300人のフェーズを経験し見えてきた、 エンジニアとして成長するための考え方
tanakayuki
5
1.5k
リリースから12年! Chatworkの過去をふりかえり ~ ChatworkとPHPの歩み ~
tanakayuki
0
690
フィーチャーチーム化への取り組みと、それを支える組織マネジメント体制
tanakayuki
2
23k
運用について - 2020 Chatwork サマーインターンシップ
tanakayuki
0
760
Chatworkから学ぶインフラサービス提供の心得.pdf
tanakayuki
0
1.5k
開発者からみたCloudSearch
tanakayuki
2
2.6k
git
tanakayuki
3
540
Other Decks in Technology
See All in Technology
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
190
UI State設計とテスト方針
rmakiyama
2
590
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
840
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
310
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
530
生成AIのガバナンスの全体像と現実解
fnifni
1
190
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
170
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
540
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
Featured
See All Featured
Making Projects Easy
brettharned
116
5.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
4 Signs Your Business is Dying
shpigford
181
21k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Building Your Own Lightsaber
phodgson
103
6.1k
Music & Morning Musume
bryan
46
6.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Documentation Writing (for coders)
carmenintech
66
4.5k
Transcript
ChatWorkͱPHPͱࢲ PHPConference 2017
© ChatWork ✔ Java ✔ JavaScript ✔ PHP ɹScala ✔
Vim ాத༎थ ChatWorkגࣜձࣾ ɹɹtan-yuki ɹɹtan_yuki ɹ৽ׁग़ ɹChatWork͔Ε͜Ε5 ɹೣ͕1ඖ
© ChatWork ▸ ຊൃϏδωενϟοτ ▸ λεΫཧϏσΦ௨͕Մೳ ▸ ಋೖاۀ150,000ࣾʢ※20179݄࣌ʣ
© ChatWork ChatWorkͷΠϝʔδ
© ChatWork ▸ Scala͚ͩ͡Όͳ͍ΑʂPHPͬͯΔΑʂ ࣮ࡍ
© ChatWork ͜ͷεϥΠυͷత ▸ ͜Μͳਓͨͪʹฉ͍ͯΒ͍͍ͨ ▸ ϨΨγʔ͔Β٫͍ͨ͠ͱࢥ͍ͬͯΔ ▸ ֦େͭͭ͋͠Δاۀɾ৫ ▸
͜Μͳ͜ͱ͕Θ͔Δ ▸ ϨΨγʔ٫ͷͨΊͷઓུͷҰྫ ▸ ϨΨγʔ٫Λઓͨ͠ਓͨͪͷྺ࢙
© ChatWork ྺ࢙܁Γฦ͢ ▸ ࣦഊͱޭͷ܁Γฦ͠ ▸ ྺ࢙͔Βֶ΅͏
© ChatWork ChatWorkͱPHPͷྺ࢙
© ChatWork ChatWorkͷੜ 1 2 3
© ChatWork νϟοτϫʔΫ͕Ͱ͖Δ·Ͱ ▸ 2000 ▸ EC studioۀ ʢͱͱChatWorkͱ͍͏ձࣾͰͳ͔ͬͨʣ ▸
தখاۀ͚ͷιϦϡʔγϣϯΛఏڙ
© ChatWork νϟοτϫʔΫ͕Ͱ͖Δ·Ͱ ▸ 2010 ▸ ࣾπʔϧͱͯ͠ͷνϟοτϫʔΫΛ։ൃ ▸ Skypeͷෆຬͩͬͨ෦Λվྑ ▸
ͨ·ͨ·UstreamͰެ։ͨ͠ͱ͜Ζɺେڹʂ ▸ 2011 ▸ ਖ਼ࣜͳϓϩμΫτͱͯ͠ϩʔϯν͢Δ
© ChatWork ࣾπʔϧ࣌ͷόʔδϣϯ
© ChatWork ॳظϦϦʔεόʔδϣϯ
© ChatWork νϟοτϫʔΫϦϦʔε࣌ͷঢ়گ ▸ ͓͔͛͞·ͰαʔϏεٸ ▸ νϟοτϒʔϜͷ͋ΓɺޱίϛͰେ͖͕͍ͬͯ͘͘ ▸ େاۀͷಋೖਐΉ ▸
໊ࣾΛChatWorkגࣜձࣾมߋɺࣾӡΛṌ͚Δ֮ޛΛܾΊΔ
© ChatWork ੵΈॏͳ͍ٕͬͯ͘ज़తෛ࠴ ▸ ͱʹ͔͘εϐʔυॏࢹ ▸ ։ൃɺ։ൃɺ։ൃɾɾɾ ▸ ޙΖΛৼΓฦΒͳ͍ ▸
ਓһ૿Ճ ▸ ૿͑ଓ͚Δ҉ ▸ ࢲ͜͜ΒΜͰೖࣾʢ20134݄ʣ ▸ Ҏલ͔Β༻͍ͯͨ͠ಠࣗϑϨʔϜϫʔΫΛݩʹ։ൃΛ͢͢ΊΔ
© ChatWork ಠࣗϑϨʔϜϫʔΫ ▸ ECFʢEC Frameworkʣ ▸ ࣾͷಠࣗϑϨʔϜϫʔΫʢPHP4ϕʔεʣ ▸ ಈతͳWebϖʔδΛαΫοͱ࡞Δ͜ͱΛతͱ͍ͯ͠Δ
▸ શ෦ೖΓɺAll in OneͳϑϨʔϜϫʔΫ ▸ Smarty template, QueryBuilder, Validator, scaffolding, Form ▸ TestFramework, Mail, i18n, ….
© ChatWork υΩϡϝϯτॆ࣮͍ͯ͠Δ
© ChatWork ChatWork on ECF ▸ EC studioͷͯ͢ECFͰ࡞ΒΕ͍ͯͨ ▸ νϟοτϫʔΫྫ֎Ͱͳ͍
▸ ECF؆୯ͳಈతϖʔδΛ࡞ΔͨΊʹಛԽ͠ ͨϑϨʔϜϫʔΫ ▸ AjaxલఏͷνϟοτπʔϧͷఆͳΜͯͳ͍
© ChatWork ςετ on ECF ▸ Ϣχοτςετ͕GUIͰ༻ҙ͞Ε͍ͯͨ ▸ νΣοΫϘοΫεʹνΣοΫɺϘλϯΫϦοΫͰ࣮ߦ ▸
શ෦νΣοΫ࣮ͯ͠ߦ͢ΔͱམͪΔʢҰͭҰͭͳΒಈ͘ʣ
© ChatWork ECFҎલʹ ▸ νϟοτϫʔΫͱͱࣾπʔϧͱͯ͠։ൃ͍ͯͨ͠ ▸ େنͳνʔϜ։ൃߴτϥϑΟοΫͳαʔϏεͷߟྀ͕͞Ε͍ͯͳ͍ ▸ σʔλઃܭ͕େྔσʔλΛѻ͏࡞ΓͰͳ͍
© ChatWork ͳΜͱ͔ͤͶɾɾɾ
© ChatWork ͱΓ͋͑ͣϢχο τςετ ▸ ͱʹ͔͘ɺϢχοτςετΛॻ͖͍ͨ͘͢͠ ▸ ແҋʹϦϑΝΫλͯ͠ɺςετ͕ਏ͍ ▸ ࣾϝϯόʔखಈςετͰͷݶքΛײ͓ͯ͡Γɺ
ςετʹର͢ΔԹײߴ͔ͬͨ
© ChatWork Ϣχο τςετͰಘΒΕΔͷ ▸ ؆୯ͳϛε͕ଈ࠲ʹΘ͔Δ ▸ ಛʹPHP࣮ऀ͕ҙࣝ͠ͳ͍ͱܕʹकΒΕͳ͍ ▸ ॲཧΛׂ͠ͳͯ͘Ϣχοτςετॻ͖ͮΒ͍
ͷͰɺΛׂ͢Δ͔͠ͳ͍ ▸ ڊେϝιο υ͕࡞ΒΕʹ͘͘ͳΔ ▸ ࣗ৴Λ࣋ͬͯϦϑΝΫλͰ͖Δ
© ChatWork Ϣχο τςετͰಘΒΕͳ͍ͷ ▸ खಈςετΛશʹͳ͘͢͜ͱ΄΅ແཧ ▸ ϢχοτςετखಈςετΛʮָʹ͢Δʯ͚ͩ ▸ खಈςετΛͮ͠Β͍෦ΛϢχοτςετͰ୲อ
͢ΔͱɺՁ͕ߴ͍
© ChatWork ςετΛॻ͖͘͢͢ΔͨΊʹ ▸ ݱঢ়ͩͱΫϥεɾϝιουͷ͕େ͖͗ͯ͢Ϣχοτςετ͕ॻ͖ͮΒ͍ ▸ 500ߦΛ͑ΔϩδοΫͷڽΓݻ·ͬͨϝιου ▸ 1ສߦΛ͑ΔਆΫϥεͷଘࡏ ▸
PSR४ڌͷύοέʔδΛ৽ͨʹ࡞ͬͨ ▸ ECFϕʔεͷΞϓϦέʔγϣϯ͔ΒPSR४ڌͷύοέʔδΛݺͼग़͢ܗ Ҡߦ͍ͯͬͨ͠
© ChatWork PSRඪ४ύοέʔδʹׂ ৽ػೳ ECFͷίʔυ PSRඪ४ύοέʔδͷҠߦ ςετ ςετ
© ChatWork ύοέʔδׂͷϝϦοτ ▸ શ෦࡞Γม͑Δඞཁͳ͘ɺہॴతʹมߋ͢Δ͜ͱ͕Ͱ͖Δ ▸ ςετͮ͠Β͍ߏ͔Βςετ͍͢͠ߏͷΠϯΫϦϝϯλϧͳϦϑΝ ΫλϦϯά͕Մೳ
© ChatWork ύοέʔδׂͷσϝϦοτ ▸ Ͱɺ݁ہECFʹΛͭͿ͍ͬͯΔ͚ͩ ▸ ࠜຊղܾͰͳ͍ ▸ ਏ͍ͱ͜ΖΓͦ͏
© ChatWork ChatWorkظɾసظ 1 2 3
։ൃڥ MAMP Vagrant, Ansible ϦϦʔε खಈσϓϩΠ (SFTP) Jenkins όʔδϣϯཧ SVN
Git, Github CI - TravisCI ϨϏϡʔख๏ આ໌ PullRequestϕʔε © ChatWork ։ൃͷঢ়گʢ2014ࠒʣ
© ChatWork ·͊·͊ Ϟμϯʹͳ͖ͬͯͨ
© ChatWork ͕ɺαʔόʔμϯ͕૬͙࣍ ▸ ϦϑΝΫλΛਐΊ͍ͯΔͱ͍͑ɺࠜຊతͳ෦ͦͷ·· ▸ Ϣʔβʔ૿Ճɺແཧͳҧ๏ݐங͕ੵΈॏͳΓαʔόʔμϯ͕૬͍࣍ͩ ▸ αʔϏεͷੑ্࣭ɺαʔϏεΛࢭΊΔͱϢʔβʔͷࣄ͕ࢭ·ͬͯ͠·͏
© ChatWork Internet GAE (Comet) ▸ εέʔϧ͠ʹ͍͘ઃܭ ▸ ݻఆαʔόʔ ▸
΄ͱΜͲશͯͷ͜ͱΛWebαʔόʔͰ ಉظతʹॲཧ͍ͯ͠Δ ▸ ϑΝΠϧΞ οϓϩʔυ͕WebαʔόʔΛ ܦ༝ͯ͠S3Ξοϓϩʔυ͍ͯ͠Δ Tokyo S3 RDS(MySQL) ELB EC2 EC2 (groonga) 1 2 3 1 2 3
© ChatWork ଧͪख ▸ AutoScalingಋೖʹΑΓμϯλΠϜ͕େ෯ʹݮগ ▸ NewRelicͷಋೖɺPHPͷॏ͍ͨॲཧDBͷΫΤϦΛݟ͢ ▸ SQSΛ༻͍ͨඇಉظͳॲཧ ▸
WebαʔόʔͰ͋·ΓࣄΛͤ͞ͳ͍ 1 2 3
© 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
© ChatWork ͔͠͠ɺࠜຊղܾͰͳ͍ ▸ ίʔυϕʔεґવͱͯ͠ݹ͍·· ▸ ͦͦͷઃܭతʹ͕͋Δ ▸ ٸ͢ΔαʔϏεɺ૿͑ΔϢʔβʔ ▸
͜ͷ··ͩͱ؇͔ʹࢮΛͭͷΈɾɾɾ
Α͠ɺγεςϜΛϦϓϨΠε͠Α͏
© ChatWork ࠶࣮Λܾஅ ▸ ίʔυϕʔεΛഁغ͢Δ͜ͱΛܾஅ ▸ θϩϕʔεͰߟ͑ɺνϟοτϫʔΫΛߏங͢Δʹ Ͳ͏͍ͬͨݴޠɾઃܭɾFW͕ద͔Λߟ͑Δ ▸ ࠷దͳઃܭͰ࠶ઓͰ͖Δ
© ChatWork ٕज़ͷબఆ ▸ ΞʔΩςΫνϟબఆ߹॓Λ։࠵ ▸ ͍͔ͭ͘ͷνʔϜʹผΕɺͦΕͧΕͰ ৽͍͠ݴޠɾFWͰԾ࣮ͯ͠ΈΔ ▸ Python
/ Flask ▸ Scala / Play framework ▸ PHP / Laravel ▸ ͪͳΈʹࢲPHPνʔϜ
© ChatWork ߹॓ͷ෩ܠ ▸ ֤νʔϜ͝ͱʹ։ൃɾൃදΛߦ͍ɺͲͷݴޠ͕ྑͦ͞͏͔Λબఆ
© ChatWork ScalaΛબఆ ▸ ڠٞͷ݁ՌɺScalaΛ࠾༻͢Δ͜ͱΛܾఆ ▸ େنPJ։ൃͰͷ੩తܕ͚ͷԸܙΛड͚͍ͨ ▸ ٕज़қతʹͦ͜·Ͱϋʔυϧ͕ߴ͍ͷͰͳ͍ ▸
͡ΊͯScalaΛ৮ͬͨਓͰʮΘΓͱ͍͚Δʯͱ͍͏ධՁ ▸ ؔܕͬΆ͘։ൃ͢Δ͔ɺΦϒδΣΫτࢦͬΆ͘։ൃ͢Δ͔ࣗ༝
© ChatWork ϦϓϨΠεͷൣғ ▸ ݱߦAPIΛScalaʹஔ͖͑Δ͜ͱΛඪͱ͢Δ ▸ νϟοτϫʔΫʹؔΘΔશػೳ͕ϦϓϨΠεର ▸ طଘͷAPIͱฒߦͯ͠ӡ༻͢Δ͜ͱΛఆ ▸
֤ΫϥΠΞϯτ͖ͳλΠϛϯάͰ৽APIҠߦ͢Δ ▸ APIͷIOେ͖͘มΘΔͷͰɺ͜ͷλΠϛϯάͰΫϥΠΞϯτଆେ͖͘ ৽
© ChatWork Scalaͷ࠾༻Ճ ▸ Ճ౻५Ұ͞Μʢ2014ೖࣾʣ ▸ ຊScalaϢʔβʔζάϧʔϓൃىਓͷ ͻͱΓ ▸ DDD͓͡͞Μ͓ʹ͍͞Μ
▸ ΞʔΩςΫνϟઃܭɾScala/DDDͷࣾ ܒ ࣸਅࠨͷਓ
© ChatWork ϦϓϨΠεମ੍ ▸ Scalaଆ ▸ ࠾༻2໊ɺۀҕୗ2໊ɺࣾһ߹Θͤͯܥ5໊ମ੍ ▸ PHPଆʢ෦APIɺͦͷଞϦϓϨΠεͷͨΊͷվमʣ ▸
5໊ମ੍ <- ࢲ͜͜ʹଐ ▸ طଘͷӡ༻ฒߦ
© ChatWork ৽γεςϜҠߦΞʔΩςΫνϟ ▸ ϥΠϒϚΠάϨʔγϣϯͱ͍͏ํ๏Λબͨ͠ ▸ ݱߦͷσʔλετΞͱ৽͍͠σʔλετΞʹಉ࣌ʹॻ͖ࠐΉ ▸ ݱߦσʔλ؇͔ʹҠߦ͍ͯ͘͠ ▸
બఆཧ༝ ▸ ϝϯςφϯεʹΑΔ࣌ؒͷγεςϜμϯ͕ڐ͞Εͳ͍ ▸ طଘγεςϜͷӨڹΛ࠷খݶʹ͢ΔͨΊ
© ChatWork ৽γεςϜҠߦΞʔΩςΫνϟ
४උͬͨ ͋ͱલਐΉͷΈ
© ChatWork ։࢝ͯ͠…
© ChatWork ·ͩͰ͖ͳ͍ ▸ ݟ͍͑ͯͳ͔ͬͨվमϙΠϯτ͕ͨ͘͞Μݟ͑ͯ͘Δ ▸ ऴΘΓ͕ݟ͑ͳ͍ঢ়گ͕ଓ͘ ▸ ͜͜·Ͱͬͨͷ͔ͩΒɺ͜ͷ··Ҿ͖Լ͕ΔΘ͚ʹ͍͔ͳ͍ɾɾɾɻ
© ChatWork ։࢝ͯ͠1…
© ChatWork ·ͩͰ͖ͳ͍ ▸ ͦͦͷΞʔΩςΫνϟతͳઃܭ্ͷݟ͑࢝ΊΔ ▸ KeyValueετΞͰͷσʔλઃܭ ▸ LiveϚΠάϨʔγϣϯʹΑΔଟྔͳΠϕϯτͷॲཧɺແཧͳΞʔΩςΫ νϟ
▸ ͕͔ͩ͠͠ɺΑ͏͘։ൃͷऴΘΓݟ͑ͯ͘Δ ▸ ͜ͷ··Ҿ͖Լ͕ΔΘ͚ʹ͍͔ͳ͍ɾɾɾɻ
© ChatWork ։࢝ͯ͠1…
© ChatWork ·ͩͰ͖ͳ͍ ▸ ։ൃ͕΄΅ऴྃɺεςʔδϯάڥࡌͤͯͰ ಈ͔ͯ͠ΈΔ ▸ ύϑΥʔϚϯε্ͷେ͖ͳ͕ݟ͔ͭΔ ▸ DynamoDbͷ՝͕ۚଌఆෆೳ
▸ ͜ͷ··ͰAWSͷ՝͕ۚɾɾɾɻ
© ChatWork ϦϓϨΠεΛҰ࣌அ೦ ▸ ͜͜ʹདྷͯύϑΥʔϚϯε্ͷେ͖ͳ͕ൃ֮ ▸ ࣾһؚΊͨνʔϜϝϯόʔͷർฐ͕͔ͳΓߴ·͍ͬͯͨ ▸ ϦϓϨΠεʹ͚ͯಥ͖ਐΜͰ͍͕ͨɺݶք͕དྷ͍ͯͨ ▸
ձࣾͱͯ͠ͷେ͖ͳܾஅΛͤ͟ΔΛಘͳ͔ͬͨ
© ChatWork Կ͕͔ͩͬͨ ▸ େ͖͘ϓϩδΣΫτϚωδϝϯτମ੍ͷͱݴ͑Δ ▸ ʮશ෦ϦϓϨΠεͯ͠Δʂʯͱ͍͏ҙؾࠐΈͷͱ࢝·͕ͬͨɺείʔ ϓ͕͋·Γʹ͗ͨ͢ɻͦΕ͚ͩγεςϜ͕͍ͯͨ͠ͱݴ͑Δɻ ▸ είʔϓΛڱΊɺεέδϡʔϧ͕ݟ͑ΔൣғͰͷϦϓϨΠεʹཹΊΔ͖
ͩͬͨ
© ChatWork Կ͕͔ͩͬͨ ▸ ύϑΥʔϚϯε՝ۚͷ͜ͱΛޙճ͠Ͱߟ͑ͯ͠·ͬͨ ▸ ϦεΫཧ͕Ͱ͖͍ͯͳ͔ͬͨ ▸ ͜͜ΒΜϓϩδΣΫτϚωδϝϯτମ੍ͷ
© ChatWork Ҿ͖ฦͤͳ͍ ▸ ్தͰҾ͖ฦ͢͜ͱՄೳͩͬͨ ▸ ͔͠͠ɺҾ͖ฦ͢ͱ͍͏͜ͱࠓ·ͰੵΈ্͛ͯ ͖ͨͷΛશͯແʹ͢Δͱ͍͏ҙຯ ▸ ޙʹͳΕͳΔ΄ͲɺҾ͖ฦͤͳ͍ঢ়گʹ
▸ ͦͯ͠ɺޙʹͳΕͳΔ΄ͲɺҾ͖ฦͨ͠ͱ͖ͷ μϝʔδେ͖͍
© ChatWork ৼΓฦΓޙɺ࠶ઓ ▸ ͏͜ΕҎ্ϢʔβʔΛͨͤΔ͜ͱͰ͖ͳ͍ ▸ είʔϓΛݶఆ͠ɺνʔϜϝϯόʔΛ͚ͨ ▸ γεςϜҠߦ͢ΔνʔϜ ▸
ݱߦγεςϜͷػೳ։ൃΛ͢ΔνʔϜ ▸ Ͳ͜ΛγεςϜϦϓϨΠε͢Δ͔Λ࠶ఆٛ͢Δ
© ChatWork ϝοηʔδϯάγεςϜΛ࠶ߏங ▸ ͜ͷ࣌ɺ٤ۓͷ՝ͱͳ͍ͬͯͨͷ͕ϝοηʔδͷ૿Ճ ▸ ͜ͷ··ͩͱintͷ࠷େΛ͑Δʢ21ԯʣ ▸ ϝοηʔδσʔλMySQLʢRDSʣ֨ೲ͍ͯͨ͠ ▸
idܕunsigned int ▸ ͋ͱ2ഒͰऴྃ ▸ ૿Ճͷ৳ͼ͔Βͯ͠ɺͦΜͳઌͷͰͳͦ͞͏
© ChatWork ϝοηʔδϯάγεςϜΛ࠶ߏங ▸ νϟοτγεςϜͷࠜװΛͳ͢ػೳͳͷͰϏδωεతͳՁ͋Γͦ͏ ▸ είʔϓ͍͍ײ͡ʹݶఆͰ͖͍ͯΔ
͍͟ɺ࠶ग़ൃ
© ChatWork ࠶ग़ൃͷ͘ͳΔͷͰলུ ▸ ৄ͘͠ԼهεϥΠυΛࢀߟʹ͍ͯͩ͘͠͞ ▸ https://speakerdeck.com/j5ik2o/chatworkfalsexin- metusezingusisutemuwozhi-eruji-shu ▸ ʮChatWork
ϝοηʔδϯάγεςϜʯͰݕࡧ
© ChatWork ͬ͘͟Γ͍͏ͱ ▸ ेͳίϯηϓτݕূʢPoCʣͷظؒΛ͞Έɺٕज़બఆΛ͓͜ͳͬͨ ▸ Akka, HBase, KafkaΛϕʔεͱͨ͠ΞʔΩςΫνϟ ▸
1Λ͔͚ͯϝοηʔδϯάγεςϜΛϦϓϨΠε ▸ 201612݄ɺؒ࡞ۀʹͯϦϦʔε
© ChatWork Ұ୴ɺϦϓϨΠεऴྃ ▸ ͓ർΕ༷Ͱͨ͠ ▸ ߹ܭͰ2͔͔ͬͨ
© ChatWork ChatWorkͷݱࡏͱࠓޙ 1 2 3
© ChatWork Ұ෦ஔ͖͚͑ͨͲ ▸ ґવͱͯ͠େ͖ͳίʔυϕʔεͦͷ··ͷঢ়ଶ ▸ શͯΛஔ͖͑Δ͜ͱࠔ ▸ ܦݧࡁΈ ▸
طଘͷϨΨγʔίʔυͱͲ͏͖߹͍͔ͬͯ͘
© ChatWork ϦϓϨΠε vs ϦϑΝΫλϦϯά ▸ ଟ͘ͷ߹ϦϑΝΫλϦϯάΛଓ͚Δ΄͏͕ྑ͍ ▸ ͦͷϨΨγʔίʔυʹɺ͍ͭ͘ͷվળͷ݁Ռ͕٧Ίࠐ·Ε͍ͯΔ ▸
ͦͷϨΨγʔίʔυʹɺ͋ͳͨͷΒͳ͍Α͏ͳػೳ͕Ӆ͞Ε͍ͯΔ ▸ ϦϓϨΠε͢Δʹɺ͋·Γʹଟ͘ͷ͕͔͔࣌ؒΔ
© ChatWork ϦϓϨΠε vs ϦϑΝΫλϦϯά ▸ ҎԼͷ߹ϦϓϨΠε͕͍͍͔͠Εͳ͍ ▸ ϦϓϨΠεର͕খ͍͞ɺ͋Δ͍খ͘͞Ͱ͖Δ ▸
σʔλઃܭɺࠜຊతͳͱ͜Ζʹ͕͋Δ ▸ ϦϓϨΠε͢Δ߹ग़དྷΔݶΓہॴతʹ͢Δ΄͏͕Α͍
© ChatWork ࠓޙͷChatWorkͲ͏͍͔ͯ͘͠ ▸ ෦తʹϦϓϨΠε͍ͯ͘͠ ▸ ͨͱ͑ɺAPIͷΤϯυϙΠϯτ୯Ґ ▸ ϚΠΫϩαʔϏεԽҰͭͷखஈ ▸
σʔλઃܭతʹແཧͳՕॴɺେྔͷσʔλΛѻ͏ՕॴʢAkka/Actor͕ಘ ҙͳ෦ʣ ▸ ͨͩ͠ɺશͯΛϦϓϨΠε͠ͳ͍ɺPHPͱ͍͓͖߹͍Λ͍ͯ͘͠ ▸ ݱࡏPHPόʔδϣϯΞοϓΛݕ౼தʢݱঢ়5.6ʣ
© ChatWork PHP7 vs HHVM ▸ ඇৗʹ·͍͠બ
© 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 ▸ େ͖ͳҧ͍ͳͦ͞͏
© ChatWork ϝϞϦ༻ྔൺֱ ▸ ԼهؔΛ༻͍ͯ༻ྔൺֱ ▸ memory_get_peak_usage — PHP ʹΑׂͬͯΓͯΒΕͨϝϞϦͷ࠷
େΛฦ͢ ▸ ୈҰҾʹtrueΛࢦఆͯ͠ܭଌɻҧ͍ҎԼɻ ࢀߟʣhttp://php.net/manual/ja/function.memory-get-peak-usage.php ͜ΕΛ TRUE ʹઃఆ͢ΔͱɺγεςϜׂ͕Γ࣮ͯͨࡍͷϝϞϦͷେ͖͞Λऔಘ͠·͢ɻ লུͨ͠Γ FALSEΛઃఆͨ͠Γ͢Δͱɺ emalloc() ͕༻͢ΔϝϞϦͷΈΛใࠂ͠·͢ɻ
© 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
© ChatWork ݴޠػೳൺֱ ▸ HHVM (Hack) ▸ Generics, Nullable, Collections,
Lambda, Tuple, … ▸ ϚϧνεϨουʹΑΔඇಉظॲཧ ▸ PHP7 ▸ TypeHinting͕Ճ ▸ Hackͷͷͱൺֱ͢Δͱऑ͍͔
© ChatWork ίʔυվमྔ ▸ ͻͱͭͷAPIΛPHP7, HHVM্Ͱಈ͔͢·ͰͷมߋྔΛൺֱ ▸ ฐࣾͷ߹ɺґଘ͍ͯ͠ΔύοέʔδΛߋ৽͢Δඞཁ͕͋ͬͨͨΊ PHP7ͷํ͕มߋྔଟ͘ͳͬͨ ▸
ͨͩ͠ɺHHVMͷ΄͏ϥϯλΠϜ͕ҟͳΔͨΊɺϋϚϦϙΠϯτ͕ େ͖ͦ͏ ▸ ϢχοτςετΛ௨ͨ͠ͱ͖ʹɺͬͯࢮΜͰ͍ͨ
© ChatWork ͦͷଞࢀߟใ ▸ Symfony ▸ ࣍ͷόʔδϣϯͰ͋ΔSymfony4HackΛαϙʔτ͠ͳ͍͜ͱΛൃද ▸ https://symfony.com/blog/symfony-4-end-of-hhvm-support ▸
HHVM͕PHP7ͷαϙʔτΛ͓͜ͳΘͳ͍͜ͱΛൃද ▸ http://hhvm.com/blog/2017/09/18/the-future-of-hhvm.html
© ChatWork ChatWork with PHP7 ▸ ChatWorkPHP7Λબ ▸ ੑೳࠩʹ͍ͭͯେ͖ͳҧ͍ͳͦ͞͏ ▸
PHPίϛϡχςΟͷେ͖͞ɺࠓޙͷ֤ϥΠϒϥϦͷαϙʔτঢ়گΛצ Ҋ͠PHP7ΛબΜͩ ▸ HHVM৽͍͠ϥϯλΠϜͷͨΊɺֶशίετΠϯϑϥͷඋɺଟগ ͷίετ͔͔Δ ▸ PHP7ͷTypeHintingͰɺݱঢ়ͱൺΕेڧྗ
© ChatWork PHP7ͷҠߦઓུ ▸ ग़དྷΔݶΓϏοΫόϯϦϦʔεආ͚͍ͨ ▸ ػೳ͝ͱʹมߋ͍ͨ͠
© ChatWork PHP7ͷҠߦઓུ ▸ ΤϯυϙΠϯτ͝ͱʹPHP7ͱPHP5.6ʹذͤ͞Δ ▸ ಉҰαʔόʔʹͯPHP7ɺPHP5.6Λڞଘͤ͞Δ ▸ ຊདྷͰ͋ΕPHP7ͱPHP5.6༻ͷαʔόʔΛ༻ҙͯ͠ALBͰذ ͤ͞Δͷ͕ྑ͍
▸ ͔͠͠ɺ͍·ͷCDͷΈʹ͔ͬΔΑ͏ͳߏʹ͢ΔͨΊɺ͋͑ͯ ͜ͷΑ͏ͳߏʹ͍ͯ͠Δ
© ChatWork ߏਤ
© ChatWork · ͱ Ί
© ChatWork ▸ ϨΨγʔίʔυͷվमඇৗʹɺඇৗʹɺඇৗʹେม ▸ ٕज़తෛ࠴ܭըతͳฦࡁΛ ▸ ҰؾʹϦϓϨΠε͢Δͷɺख़ߟ্ͨ͠Ͱ ▸ ϦϓϨΠεʹ͓͍ͯPoCΛߦ͍৻ॏͳݕূΛ͖͢
▸ ػೳ୯ҐͳͲɺͰ͖Δ͚ͩখ͘͞ϦϓϨΠε͍ͯ͘͠ͱΑ͍ ·ͱΊ
© ChatWork ΤϯδχΞืूத http://corp.chatwork.com/ja/recruit/ ▸ ओମੑΛ࣋ͪɺࣗΒߦಈͰ͖Δ ▸ ଞऀΛೝΊɺଚॏͰ͖Δ ▸ ใΛूΊɺڞ༗Ͱ͖Δ
ͱ͍͏ํΛܴ͠·͢ʂ