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
yuuki takezawa
February 05, 2025
Programming
300
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.4k
PHPでアクターモデルを理解・体験しよう / Understand and experience the actor model in PHP
ytake
2
870
再考 アクターモデル/ reconsider actor model
ytake
0
1.5k
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
640
Phluxorでアクターモデルを 理解・体験しよう / toolkit-for-flexible-actor-models-in-php-phluxor
ytake
1
360
オブジェクトのおしゃべり大失敗 メッセージングアンチパターン集 / messaging anti-pattern collection
ytake
2
1.3k
DRE/SREのプラクティス融合によるクラウドネイティブなデータ基盤作り / dre_sre
ytake
0
990
技術的負債と向き合う取り組みでよかったもの / positive_efforts_to_tackle_technical_debt
ytake
10
4k
Other Decks in Programming
See All in Programming
RSAが破られる前に知っておきたい 耐量子計算機暗号(PQC)入門 / Intro to PQC: Preparing for the Post-RSA Era
mackey0225
3
130
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
140
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
9
5.2k
感情を設計する
ichimichi
5
1.3k
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
140
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
220
20260320登壇資料
pharct
0
170
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
200
Don't Prompt Harder, Structure Better
kitasuke
0
640
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
190
의존성 주입과 모듈화
fornewid
0
120
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
330
Featured
See All Featured
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
97
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Building an army of robots
kneath
306
46k
Abbi's Birthday
coloredviolet
2
6.5k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Mobile First: as difficult as doing things right
swwweet
225
10k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
350
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
220
Leo the Paperboy
mayatellez
7
1.6k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
270
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
130
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ΞϓϦέʔγϣϯ ಉ͡ΫϥεͳͲΛߏͱ͍ͯ࣋ͬͯ͠ͳ͚ΕͳΒͳ͍ • ଞݴޠͱΓऔΓΛߦ͏߹ϚΠΫϩαʔϏεͰආ͚Α͏ʂ
·ͱΊ • ϥΠϑαΠΫϧϥϯλΠϜͷҧ͍Λཧղ͠·͠ΐ͏ʂ • ݴޠ͕ѱ͍ͷͰͳͯ͘େମ࡞Γํͷ • ͍ΖΜͳݴޠΛ৮ͬͯࣝΛ͚ͭΑ͏ʂ