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 in 5 Minutes [en]
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
140
Search, Embeddings & Vector-DBs
chluehr
0
180
Reality Check: Automated Content Production at Enterprise Scale with Pimcore
chluehr
0
100
The how and why of getting Freelancers
chluehr
0
87
Content & Master Data Management with Pimcore
chluehr
1
760
Master Data Management with Pimcore
chluehr
0
230
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
390
Other Decks in Technology
See All in Technology
Kotlin 開発のツラミを爆破した話! / Explode the difficulty of Kotlin dev!
eller86
0
140
グローバルチームと挑むプロダクト開発
sansantech
PRO
1
150
Fabricをフル活用する AI Agent Hub -製造業特化AIエージェントの設計
iotcomjpadmin
0
200
AWS Summit 2026で見えたSIerにとっての Amazon Quickの位置づけ
maf_0521
0
160
トークン最適化のためのユーザーストーリー分析 / User Story Analysis for Token Optimization
oomatomo
0
160
どうして今サーバーサイドKotlinを選択したのか
nealle
0
190
HookでSAST、CIでSAST、SCAでどうにかしている話 / layered-security-for-ai-written-code-with-sast-and-sca
yamaguchitk333
0
110
小さいから、全部わかる。— 常駐AI "xangi" のすすめ
sugupoko
0
250
AIに「使われる」時代のSaaS戦略 〜既存WebAPIのMCPサーバー化における開発ノウハウ〜
ekispert_api
0
290
依頼文化をやめる日 EM視点で語るPlatform EngineeringとInclusive SRE / Discussing Platform Engineering and Inclusive SRE from an EM's Perspective
shin1988
1
260
次世代ランサムウェア対策の考察 / 20260704 Mitsutoshi Matsuo
shift_evolve
PRO
5
1.7k
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
350
Featured
See All Featured
Color Theory Basics | Prateek | Gurzu
gurzu
0
380
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
330
4 Signs Your Business is Dying
shpigford
187
22k
How GitHub (no longer) Works
holman
316
150k
Amusing Abliteration
ianozsvald
1
220
Visualization
eitanlees
152
17k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
55k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
Prompt Engineering for Job Search
mfonobong
0
360
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
460
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
260
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/