Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Swoole in 5 Minutes [en]
Search
Christoph Lühr
February 06, 2018
Technology
12k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swoole in 5 Minutes [en]
Blazingly-Fast, Event-Driven, Asynchronous PHP. Berlin PHP Usergroup 02/06/2018
Christoph Lühr
February 06, 2018
More Decks by Christoph Lühr
See All by Christoph Lühr
Vektor-Suche & LLMs
chluehr
0
150
Search, Embeddings & Vector-DBs
chluehr
0
190
Reality Check: Automated Content Production at Enterprise Scale with Pimcore
chluehr
0
110
The how and why of getting Freelancers
chluehr
0
99
Content & Master Data Management with Pimcore
chluehr
1
770
Master Data Management with Pimcore
chluehr
0
240
PIM & Master Data Management with Pimcore 5 [en]
chluehr
2
340
Digital Transformation & Master Data Management with Pimcore 5
chluehr
0
270
LXD System Containers [en]
chluehr
0
400
Other Decks in Technology
See All in Technology
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
30
19k
地方移住と都心キャリアの両立は「金・時間・人」のリソースをフル活用すれば実現できる!〜Snowflake女子会 vol.8
snowwmn0824
0
100
Genieを崇めよ
kameitomohiro
0
170
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
2.9k
2026-09-08 そのJavaモダナイゼーション、AIに丸投げで大丈夫?IBM Bobで変わる品質と効率
yutanonaka
1
150
Mastering Agentic Development: Harness Engineering for Effective Coding Agents
konippi
1
350
EventBridge に「合流」はない ― サーバーレスのワークフローを育てるということ / No Join in EventBridge
yusukeshimizu
2
480
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
540
【技術的負債conf】事業成長に伴う技術的負債の説明責任とAIによるモニタリング、認知的負債について
i35_267
3
2.1k
10Xに技術的負債をもたらした「2つの境界の歪み」その構造と解消への営み
10xinc
0
2.4k
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.6k
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
120
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Darren the Foodie - Storyboard
khoart
PRO
4
3.9k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
510
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
500
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
RailsConf 2023
tenderlove
30
1.6k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
260
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Side Projects
sachag
456
43k
Transcript
Christoph Lühr @chluehr / bephpug 2018 "Fast, faster, Swoole" Teaser:
Swoole in 5 Minutes
None
SIN CE 2000
None
"Blazingly-Fast, Event-Driven, Asynchronous PHP."
None
$ pecl install swoole
$ brew install swoole
<?php $server = new \Swoole\Http\Server('0.0.0.0', 9000); $server->on('Request', function ($request, $response)
{ $response->end('OK'); }); $server->start();
<?php $loop = React\EventLoop\Factory::create(); $server = stream_socket_server('tcp://0.0.0.0:9000'); stream_set_blocking($server, 0); $loop->addReadStream($server,
function ($server) use ($loop) { $conn = stream_socket_accept($server); $data = "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nHi\n"; $loop->addWriteStream($conn, function ($conn) use (&$data, $loop) { $written = fwrite($conn, $data); if ($written === strlen($data)) { fclose($conn); $loop->removeStream($conn); } else { $data = substr($data, $written); } }); }); $loop->run();
PHP-PM
None
Sugar and Cream? (PHP is not enough ...)
Async IO
File I/O (and some tagline to go along)
TCP Clients MySQL / Redis / HTTP / WebSocket
"Reality Distortion" BENCHMARKS
300.000 Req/Sec
wrk -t4 -c400 -d10s http://127.0.0.1:1337/ Running 10s test @ http://127.0.0.1:1337/
4 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 1.46ms 1.42ms 27.96ms 85.66% Req/Sec 75.29k 36.43k 183.55k 72.75% 3007806 requests in 10.06s, 605.25MB read Requests/sec: 299103.32 Transfer/sec: 60.19MB
wrk -t16 -c400 -d30s http://localhost:9000/ Running 30s test @ http://localhost:9000/
16 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 6.97ms 7.07ms 226.95ms 93.28% Req/Sec 4.00k 0.96k 15.36k 76.15% 1909179 requests in 30.09s, 282.21MB read Requests/sec: 63442.77 Transfer/sec: 9.38MB
Demo
Real World(tm) References?
None
None
To good to be true...? DRAWBACKS
中文
None
Thanks! Questions? Christoph Lühr
[email protected]
[email protected]
@chluehr Slides license Attribution-NonCommercial-ShareAlike
3.0 http://creativecommons.org/licenses/by-nc-sa/3.0/
• Swoole 2.0 https://www.swoole.co.uk/