Slide 1

Slide 1 text

4XPPMFͰ࣮૷͢Δ 1)1ඇಉظॲཧͷੈք খࢁ఩ࢤ !LPZIPHF PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21

Slide 2

Slide 2 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ࣗݾ঺հ খࢁ఩ࢤ ͜΍·ͯͭ͡ ߹ಉձࣾ΄ٕ͛ݚ Ϣʔβձ͍͔ͭ͘ ೔ຊ6/*9Ϣʔβձ ೔ຊ1PTUHSF42-Ϣʔβձ ೔ຊ1)1Ϣʔβձ SBLVNPגࣜձࣾΤϯδχΞ !LPZIPHF LPZIPHF

Slide 3

Slide 3 text

ʮখࢁ͞Μ͸ ɹͲ͜ʹͰ΋͍·͢Ͷʯ

Slide 4

Slide 4 text

ʮͲ͜ʹͰ΋͸͍ͳ͍Θɺ ͍Δͱ͜Ζʹ͚ͩʯ

Slide 5

Slide 5 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ͯ͞ 4XPPMF

Slide 6

Slide 6 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ʜͷલʹ

Slide 7

Slide 7 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ࣮ߦ଎౓ͷ௿ԼཁҼ w$16 wϝϞϦ wϩδοΫ wσʔλॲཧྔ w*0


Slide 8

Slide 8 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 *0 w$16ॲཧʹൺ΂Δͱஈҧ͍ʹ஗͍ wऴྃ଴ͪঢ়ଶ wಉظॲཧ

Slide 9

Slide 9 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 Gregg, Brendan. “Systems Performance: Enterprise and the Cloud.” *0஗Ԇ

Slide 10

Slide 10 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ඇಉظ*0 w*0ॲཧͷऴྃΛ଴ͨͳ͍ wϒϩοΫ͠ͳ͍ wͦͷؒʹଞͷॲཧΛ͢Δ w*0ॲཧ͕ऴΘͬͨΒͦͪΒʹ໭Δ

Slide 11

Slide 11 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 https://twitter.com/php_swoole/status/1060181279407169538

Slide 12

Slide 12 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 1)14XPPMF $PSPVUJOFCBTFEDPODVSSFODZMJCSBSZGPS1)1 https://www.swoole.co.uk/ https://github.com/swoole/swoole-src/ @php_swoole

Slide 13

Slide 13 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 4XPPMFͱ͸ wඇಉظॲཧΛجຊʹͨ͠ߴ଎Խॲཧͷ ٧Ί߹ΘͤϥΠϒϥϦ w೥͔Β։ൃ wݩ͸ӳࠃ5SBOTGPOʹΑͬͯ wݱࡏ͸தࠃݍͷ։ൃऀ͕໠྽ʹ

Slide 14

Slide 14 text

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 ϓϦΤϯϓςΟϒεέδϡʔϦϯά

Slide 15

Slide 15 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 Πϯετʔϧ $ pecl install swoole extension=swoole.so ZPVSJOJ

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ղઆ w4XPPMFa$PSPVUJOFʹ͸$Pͱ͍͏ΤΠϦ Ξε͕͍͍ͭͯΔ w࠷ॳͷVTFจ͸ͳͯ͘΋ಈ͘ w1)1͸Ϋϥε໊ͷେখจࣈ͸۠ผ͠ͳ͍ wHP ͸4XPPMFa$PSPVUJOFDSFBUF ͷΤ ΠϦΞε

Slide 18

Slide 18 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ղઆ wDPZJFME ͸ॲཧΛҰ୴தஅ͢Δ wDPSFTVNF ͸ର৅͕ZJFME ͢Δ·Ͱϒϩο Ϋ͢Δ

Slide 19

Slide 19 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 4XPPMFίϧʔνϯ w4XPPMFͷඇಉظॲཧͷࠜװ wதஅ࠶։Ͱ͖Δॲཧ୯Ґ w4XPPMFͰ͸γϯάϧεϨουͰ࣮૷ ͞Ε͍ͯΔ

Slide 20

Slide 20 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 swoole-src/include/coroutine.h ࣮૷ͷத֩෦෼

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 EFGFS wίϧʔνϯͷऴྃॲཧ wίϧʔνϯ͕FYJU͢Δ·Ͱ࣮ߦ͞Εͳ ͍ w࠷ޙʹݺ͹ΕͨEFGFS͔Βٯॱʹ࣮ߦ ͞ΕΔ

Slide 23

Slide 23 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 EFGFSͷྫ $ php defer.php abc~b~a

Slide 24

Slide 24 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 DIBO wνϟϯωϧΛ࡞੒͢Δ wίϧʔνϯؒͷϝοηʔδड͚౉͠

Slide 25

Slide 25 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 DIBOͷྫ

Slide 26

Slide 26 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 https://speakerdeck.com/team/swoole-4-introducing-the-new-coroutine-design-pattern-in-php?slide=26

Slide 27

Slide 27 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 4XPPMF4FSWFS w)551 w)551 w8FC4PDLFU w5$16%16OJY4PDLFU w3FEJT

Slide 28

Slide 28 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 )5514FSWFS

Slide 29

Slide 29 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 5$14FSWFS

Slide 30

Slide 30 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 ·ͱΊ w4XPPMF͸1)1ߴ଎Խͷ৽͍͠ํ޲ੑ wඇ࿈ଓతਐԽ w׆ൃʹ։ൃ͞Ε͍ͯΔ༷ࢠΛோΊ͍ͯ Δ͚ͩͰ΋ָ͍͠ wʮ1)1Ͱ͜͜·ͰͰ͖Δʯͱূ໌ͨ͠ ͜ͱʹܟҙΛධ͍ͨ͠

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

PHPΧϯϑΝϨϯε๺ւಓ2019 2019-09-21 3FG w IUUQTTXPPMFDPVL w IUUQTHJUIVCDPNTXPPMFTXPPMFTSD w IUUQTTQFBLFSEFDLDPNUFBNQSFFNQUJWF NVMUJUBTLJOHVTJOHDPSPVUJOFTJOQIQTXPPMF w IUUQTTQFBLFSEFDLDPNUFBNTXPPMF JOUSPEVDJOHUIFOFXDPSPVUJOFEFTJHOQBUUFSOJO QIQ