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
PHP ステートレス VS ステートフル 状態管理と並行性 / php-stateless-s...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
yuuki takezawa
February 05, 2025
Programming
310
0
Share
PHP ステートレス VS ステートフル 状態管理と並行性 / php-stateless-stateful
つよナレ #1 PHPにまつわる話
https://techtrain.connpass.com/event/330882/
でのお話です
yuuki takezawa
February 05, 2025
More Decks by yuuki takezawa
See All by yuuki takezawa
なぜAI時代に 「イベント」を中心に考えるのか? / Why focus on "events" in the age of AI?
ytake
4
2k
PHPでアクターモデルを活用したSagaパターンの実践法 / php-saga-pattern-with-actor-model
ytake
0
2.5k
PHPでアクターモデルを理解・体験しよう / Understand and experience the actor model in PHP
ytake
2
900
再考 アクターモデル/ reconsider actor model
ytake
0
1.6k
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
650
Phluxorでアクターモデルを 理解・体験しよう / toolkit-for-flexible-actor-models-in-php-phluxor
ytake
1
370
オブジェクトのおしゃべり大失敗 メッセージングアンチパターン集 / messaging anti-pattern collection
ytake
2
1.3k
DRE/SREのプラクティス融合によるクラウドネイティブなデータ基盤作り / dre_sre
ytake
0
1k
技術的負債と向き合う取り組みでよかったもの / positive_efforts_to_tackle_technical_debt
ytake
10
4k
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
350
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
150
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
440
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
150
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.7k
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
150
PHPer、Cloudflare に引っ越す
suguruooki
2
210
ふにゃっとしない名前の付け方 〜哲学で茹で上げる、コシのあるソフトウェア設計〜
shimomura
0
120
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
350
Making the RBS Parser Faster
soutaro
0
720
空間オーディオの活用
objectiveaudio
0
150
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
180
Featured
See All Featured
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
550
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
800
A Tale of Four Properties
chriscoyier
163
24k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
310
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
410
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
We Are The Robots
honzajavorek
0
230
Skip the Path - Find Your Career Trail
mkilby
1
120
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
140
Transcript
εςʔτϨε VS εςʔτϑϧ ঢ়ଶཧͱฒߦੑ TechTrain ͭΑφϨ #1 PHPʹ·ͭΘΔ ytake
Pro fi le • ᖒ ༗و a.k.a ytake • ઍגࣜձࣾ
CTO / ΄͔ٕज़ސ • Go / Scala / Kotlin • ΞΫλʔϞσϧɺσʔλج൫ɺDDD·ΘΓɺࢄॲཧͳͲ
ঢ়ଶͱϥϯλΠϜ • ϥϯλΠϜͷҧ͍Λཧղ͓͖ͯ͠·͠ΐ͏ • εςʔτϨε͔εςʔτϑϧ ͲͪΒ͔Ͱͳ྆͘ํ͏·͘ѻ͏ • PHPͰฒߦॲཧΛ͏·͘Δʹঢ়ଶཧ͕ඞཁʂ
PHP • WebΞϓϦέʔγϣϯͱͯ͠ੈքͰͨ͘͞ΜΘΕ͍ͯΔݴޠ • FacebookݩʑPHP / PHPͷݱࡏͷਐԽʹେ͖͘ߩݙ • ͳΜ͔ͩΜͩWordpressҒେ •
WebαʔόͷϞδϡʔϧɺ͘͠࿈ܞͯ͠ಈ͘ࣄ͕ଟ͍
Go • goroutineͱ͍͏ΈΛͬͯฒߦॲཧΛಘҙͱ͢Δݴޠ • γϯάϧόΠφϦͰϓϩηεͱͯ͠ಈ࡞ • ίϯςφͱͷ૬ੑྑ͍ • ΞϓϦέʔγϣϯαʔόͱͯ͠ػೳʢWebαʔόෆཁʣ
Scala • ScalaؔܕϓϩάϥϛϯάͱΦϒδΣΫτࢦ • ޮతͳฒߦॲཧΛαϙʔτ͢ΔFutureͳͲ • σʔλॲཧܥେنͳΈΛࢧ͑Δ͜ͱ͕ଟ͍ • ΞϓϦέʔγϣϯαʔόͱͯ͠ػೳʢWebαʔόෆཁʣ
ͦͦฒߦͬͯʁ • ฒྻ"શʹಠཱ"ͯ͠ϦιʔεΛফඅ͢Δͷ • ฒߦϦιʔεΛڞ༗͠ͳ͕Βަޓʹফඅ ॲཧத"ฒྻʹݟ͑Δࣄ͕͋Δ" • PHPͰ؆୯ʹѻ͑ΔͷͦΜͳʹଟ͘ͳ͍
ͦͦฒߦͬͯʁ • खΛୟ͘ͷ͕ऴΘ͔ͬͯΒΛୟ͘ͷ͕ஞ࣍ • खΛୟ͍͍͚ͯͨͲ్தͰΊͯΛୟ͍ͯ ·ͨखΛୟ͘Έ͍ͨͳͷ͕ฒߦ • खͱΛಉ࣌ୟ͘ͷ͕ฒྻ • खΛୟ͖͍ͨͳ͊ͱࢥ͍͔ͬͯͭୟ͘ͷ͕ඇಉظ
• खΛୟͧ͘ʂͰୟ͘ͷ͕ಉظ
େ͖ͳҧ͍ͬͯʁ • PHP HTTPϦΫΤετ͕དྷͨΒͦͷϓϩηεΛ্ཱͪ͛ͯऴྃ • جຊతʹঢ়ଶΛ࣋ͨͣʢ࣋ͯͳ͍ʣɺ ঢ়ଶอ࣋֎෦ʹ͓ئ͍͢ΔΈ • ނʹඇৗʹγϯϓϧ
େ͖ͳҧ͍ͬͯʁ • GoScalaϓϩηεͱͯ͠ಈ࡞͢ΔͨΊɺ ঢ়ଶΛཧ͠ͳ͕ΒޮతʹॲཧΛߦ͏ • ͕ࣗσʔλετϨʔδʹͳΔ͜ͱͪΖΜOK • ϓϩηεͱͯ͠ঢ়ଶΛࣗͰ࣋ͭͨΊɺ ฒߦॲཧͳͲ༰қ
PHPͰฒߦॲཧ͍ͨ͠ɾɾʁ • ผϓϩηεͰىಈͨ͠PHPϓϩηεಉ࢜ͷ ίϛϡχέʔγϣϯ͕͍͠ɾɾ • εϨουతͳͷͳ͍ʢextentionআ͘ʣ • ॏ͍ͨॲཧඇಉظʹ͢Δ͔͠ͳ͍ɾɾ
None
PHPͰඇಉظॲཧ͍ͨ͠ɾɾʁ • QueueͳͲͷϛυϧΣΞΛͬͯ ผϓϩηεɾΞϓϦέʔγϣϯͱͯ͠औΓʹߦͬͯॲཧ • SwooleReactPHPͳͲΛซ༻ͯ͠ؤுΔ • ϓϩηεͱͯ͠ಈ࡞ͤ͞ΔͨΊʹsupervisorͳͲͰཧ͠ͳ͚Εɾ
ॱ൪ • Ͳ͕ͬͪૣ͘ऴΘΔ͔ • ࢄͨ͠ͱ͖ૢ࡞ෆՄ
PHPͰৗ࣌ϓϩηεʹ͢ΔͱϋϚΔͷ • εςʔτϨεલఏͷίʔυΛॻ͘ͱϝϞϦϦʔΫʹɾɾ • ඞཁ͕ͳ͘ͳͬͨมͱʹ͔͘ϝϞϦ͔Βଈղ์͢Δʂ • σʔλϕʔεconnectͱdisconnectΛ͖ͪΜͱཧ͢Δ • ࣋ଓଓ͕ۤखͳͷͰɺphp.iniWebαʔόͷઃఆΛ
GoScalaͰɾɾʁ • ͦͦϙΠϯλεϨουͳͲͰޮతʹॲཧ͢ΔΈ • ΞυϨεʹଓͳͲΛ֬อ͍ͯ͠ճͨ͠Γ͢Δ • ScalaͰΞΫλʔΛར༻ͯ͠ҙਤతʹϦιʔεؔ࿈ૢ࡞Ͱ͖Δ
<?php use Swoole\Http\Server; $server = new Server("127.0.0.1", 9501); $leakyArray =
[]; $server->on("request", function ($request, $response) use (&$leakyArray) { $leakyArray[] = str_repeat("leak", 1000); $tempFile = fopen("/tmp/tempfile", "w"); fwrite($tempFile, "temporary data"); $response->end("Hello World\n"); }); $server->start();
<?php use Swoole\Http\Server; $server = new Server("127.0.0.1", 9501); $leakyArray =
[]; $server->on("request", function ($request, $response) use (&$leakyArray) { $leakyArray[] = str_repeat("leak", 1000); $tempFile = fopen("/tmp/tempfile", "w"); fwrite($tempFile, "temporary data"); $response->end("Hello World\n"); }); $server->start(); ϦΫΤετͷͨͼʹ Ճ
<?php use Swoole\Http\Server; $server = new Server("127.0.0.1", 9501); $leakyArray =
[]; $server->on("request", function ($request, $response) use (&$leakyArray) { $leakyArray[] = str_repeat("leak", 1000); $tempFile = fopen("/tmp/tempfile", "w"); fwrite($tempFile, "temporary data"); $response->end("Hello World\n"); }); $server->start(); Ϧιʔε։์Ε '%͕Ұഋʹɾɾ
None
PHPͰΞΫλʔϞσϧΛཧղɾମݧ͠Α͏ Understand and experience the actor model in PHP phpcon
okinawa 2024 yuuki takezawa a.k.a ytake
γϯάϧτϯ • PHPͷγϯάϧτϯHTTPͷϥΠϑαΠΫϧͷΈͷͷ • PHPͰৗ࣌ϓϩηεͰγϯάϧτϯʹ͢Δͱ ଞͷॴͰॻ͖ࠐ·ΕΔ͜ͱ͋Γɺঢ়ଶมΘΔ • mutexͳͲซ༻͠Α͏ʂ • DIίϯςφ͕ରԠ͍ͯ͠ͳ͍߹ଟ͋Γ
͓·͚ PHP͋Δ͋Δ1 • ޮՌతʹΩϟογϡ͢ΔͨΊʹphpserialize͠Α͏ʂ • ଞݴޠ͔Βར༻Ͱ͖ͳ͍ɾɾ ͔ͭ෮ݩ͠Α͏ͱ͢ΔPHPΞϓϦέʔγϣϯ ಉ͡ΫϥεͳͲΛߏͱ͍ͯ࣋ͬͯ͠ͳ͚ΕͳΒͳ͍ • ଞݴޠͱΓऔΓΛߦ͏߹ϚΠΫϩαʔϏεͰආ͚Α͏ʂ
·ͱΊ • ϥΠϑαΠΫϧϥϯλΠϜͷҧ͍Λཧղ͠·͠ΐ͏ʂ • ݴޠ͕ѱ͍ͷͰͳͯ͘େମ࡞Γํͷ • ͍ΖΜͳݴޠΛ৮ͬͯࣝΛ͚ͭΑ͏ʂ