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
Swooleで実装するPHP非同期処理の世界/phpcondo2019-swoole
Search
KOYAMA Tetsuji
September 21, 2019
Programming
3
5.1k
Swooleで実装するPHP非同期処理の世界/phpcondo2019-swoole
2019-09-21 に開催されたPHPカンファレンス北海道2019で発表した資料です。
KOYAMA Tetsuji
September 21, 2019
Tweet
Share
More Decks by KOYAMA Tetsuji
See All by KOYAMA Tetsuji
全日本PHPカンファレンス2024スタンプラリーについて/stamprally-php2024
koyhoge
0
130
日本PHPカンファレンス2024スタンプラリーとその実装/phpcon-stamprally
koyhoge
1
1.1k
日本のPHPカンファレンスの歩みと、その辺もろもろ/phpcon_japan_history
koyhoge
0
250
Inside SWOOLE: 非同期処理はどのようにして動くのか/inside_swoole
koyhoge
0
18k
映画を年300本観る技術/watch_300_movies_in_a_year
koyhoge
0
1.2k
CloudFormation と FaaS のはざま - Kubernetes の設計思想を探る -/cf-faas-k8s
koyhoge
0
1.4k
ITイベントマニアから見る技術イベントの動向/techevent
koyhoge
0
300
Skaffoldを使ってKubernetes してみた/skaffold_k8s
koyhoge
2
1.3k
東京が大雪の日に何気ない写真がバズった/snow_tree_buzz
koyhoge
0
520
Other Decks in Programming
See All in Programming
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
CSC305 Lecture 26
javiergs
PRO
0
140
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
似たもの同士のPerlとPHP
uzulla
1
130
Symfony Mapper Component
soyuka
2
730
Security_for_introducing_eBPF
kentatada
0
110
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
layerx_20241129.pdf
kyoheig3
2
290
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
CSC305 Lecture 25
javiergs
PRO
0
130
N.E.X.T LEVEL
pluu
2
300
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Designing Experiences People Love
moore
138
23k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Thoughts on Productivity
jonyablonski
67
4.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
A designer walks into a library…
pauljervisheath
204
24k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Building Your Own Lightsaber
phodgson
103
6.1k
Transcript
4XPPMFͰ࣮͢Δ 1)1ඇಉظॲཧͷੈք খࢁࢤ !LPZIPHF PHPΧϯϑΝϨϯεւಓ2019 2019-09-21
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ࣗݾհ খࢁࢤ ͜·ͯͭ͡ ߹ಉձࣾ΄ٕ͛ݚ Ϣʔβձ͍͔ͭ͘ ຊ6/*9Ϣʔβձ ຊ1PTUHSF42-Ϣʔβձ
ຊ1)1Ϣʔβձ SBLVNPגࣜձࣾΤϯδχΞ !LPZIPHF LPZIPHF
ʮখࢁ͞Μ ɹͲ͜ʹͰ͍·͢Ͷʯ
ʮͲ͜ʹͰ͍ͳ͍Θɺ ͍Δͱ͜Ζʹ͚ͩʯ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ͯ͞ 4XPPMF
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ʜͷલʹ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ࣮ߦͷԼཁҼ w$16 wϝϞϦ wϩδοΫ wσʔλॲཧྔ w*0
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 *0 w$16ॲཧʹൺΔͱஈҧ͍ʹ͍ wऴྃͪঢ়ଶ wಉظॲཧ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 Gregg, Brendan. “Systems Performance: Enterprise and the Cloud.”
*0Ԇ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ඇಉظ*0 w*0ॲཧͷऴྃΛͨͳ͍ wϒϩοΫ͠ͳ͍ wͦͷؒʹଞͷॲཧΛ͢Δ w*0ॲཧ͕ऴΘͬͨΒͦͪΒʹΔ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 https://twitter.com/php_swoole/status/1060181279407169538
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 1)14XPPMF $PSPVUJOFCBTFEDPODVSSFODZMJCSBSZGPS1)1 https://www.swoole.co.uk/ https://github.com/swoole/swoole-src/ @php_swoole
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 4XPPMFͱ wඇಉظॲཧΛجຊʹͨ͠ߴԽॲཧͷ ٧Ί߹ΘͤϥΠϒϥϦ w͔Β։ൃ wݩӳࠃ5SBOTGPOʹΑͬͯ wݱࡏதࠃݍͷ։ൃऀ͕ʹ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 1)14XPPMF w Φʔϓϯιʔε "QBDIFϥΠηϯε w 1)1&YUFOTJPO w
$$ #PPTU$POUFYU w ίʔϧόοΫίϧʔνϯ w Πϕϯτۦಈͷඇಉظ*0 w )551)5518FC4PDLFU5$16%1 w ϚΠΫϩඵλεΫεέδϡʔϥ w ϓϩηεϚωʔδϟ w ϓϦΤϯϓςΟϒεέδϡʔϦϯά
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 Πϯετʔϧ $ pecl install swoole extension=swoole.so ZPVSJOJ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ࠷ॳͷҰา $ php co.php start coro 1 start
to resume 1 @1 resume coro 1 @1 start to resume 1 @2 resume coro 1 @2 main
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ղઆ w4XPPMFa$PSPVUJOFʹ$Pͱ͍͏ΤΠϦ Ξε͕͍͍ͭͯΔ w࠷ॳͷVTFจͳͯ͘ಈ͘ w1)1Ϋϥε໊ͷେখจࣈ۠ผ͠ͳ͍ wHP 4XPPMFa$PSPVUJOFDSFBUF ͷΤ
ΠϦΞε
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ղઆ wDPZJFME ॲཧΛҰ୴தஅ͢Δ wDPSFTVNF ର͕ZJFME ͢Δ·Ͱϒϩο Ϋ͢Δ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 4XPPMFίϧʔνϯ w4XPPMFͷඇಉظॲཧͷࠜװ wதஅ࠶։Ͱ͖Δॲཧ୯Ґ w4XPPMFͰγϯάϧεϨουͰ࣮ ͞Ε͍ͯΔ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 swoole-src/include/coroutine.h ࣮ͷத֩෦
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ίϧʔνϯྫ $ php co2.php write...: data/00.out write...: data/01.out
write...: data/02.out write...: data/03.out write...: data/04.out write: data/00.out done write: data/01.out done write: data/02.out done write: data/03.out done write: data/04.out done
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 EFGFS wίϧʔνϯͷऴྃॲཧ wίϧʔνϯ͕FYJU͢Δ·Ͱ࣮ߦ͞Εͳ ͍ w࠷ޙʹݺΕͨEFGFS͔Βٯॱʹ࣮ߦ ͞ΕΔ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 EFGFSͷྫ $ php defer.php abc~b~a
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 DIBO wνϟϯωϧΛ࡞͢Δ wίϧʔνϯؒͷϝοηʔδड͚͠
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 DIBOͷྫ
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 https://speakerdeck.com/team/swoole-4-introducing-the-new-coroutine-design-pattern-in-php?slide=26
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 4XPPMF4FSWFS w)551 w)551 w8FC4PDLFU w5$16%16OJY4PDLFU w3FEJT
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 )5514FSWFS
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 5$14FSWFS
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 ·ͱΊ w4XPPMF1)1ߴԽͷ৽͍͠ํੑ wඇ࿈ଓతਐԽ w׆ൃʹ։ൃ͞Ε͍ͯΔ༷ࢠΛோΊ͍ͯ Δ͚ͩͰָ͍͠ wʮ1)1Ͱ͜͜·ͰͰ͖Δʯͱূ໌ͨ͠ ͜ͱʹܟҙΛධ͍ͨ͠
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 એ w ݄ʹٕज़ධࣾΑΓʮΈΜͳͷ1)1ʯ͕ग़·͢ w 1)1ΛςʔϚʹͨ͠ϜοΫ w ϖʔδલޙ w
Ձ֨ະఆ w 4PGUXBSF%FTJHO݄߸ ൃച w λΠΞοϓಛू1 w 8&# %#13&44WPM ൃച w 4XPPMFʹؔ͢ΔλΠΞοϓهࣄ1
PHPΧϯϑΝϨϯεւಓ2019 2019-09-21 3FG w IUUQTTXPPMFDPVL w IUUQTHJUIVCDPNTXPPMFTXPPMFTSD w IUUQTTQFBLFSEFDLDPNUFBNQSFFNQUJWF NVMUJUBTLJOHVTJOHDPSPVUJOFTJOQIQTXPPMF
w IUUQTTQFBLFSEFDLDPNUFBNTXPPMF JOUSPEVDJOHUIFOFXDPSPVUJOFEFTJHOQBUUFSOJO QIQ