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
Type uWSGI; Press Enter; What Happens?
Search
Philip James
August 14, 2017
Technology
1
74
Type uWSGI; Press Enter; What Happens?
Talk given at DjangoCon US 2017
Philip James
August 14, 2017
Tweet
Share
More Decks by Philip James
See All by Philip James
Frog and Toad Learn about Django Security - NBT6
phildini
0
25
The Elephant and the Serpent (PyLatam 2019)
phildini
0
54
Account Security for the Fashionable App Developer
phildini
1
64
All in the Timing: Side-Channel Attacks
phildini
0
56
Giving Thanks
phildini
0
42
All in the Timing: Side-Channel Attacks in Python
phildini
0
410
API-Driven Django
phildini
1
370
Type uWSGI; Press Enter; What Happens?
phildini
0
95
Oops I Committed My Secret Key
phildini
0
400
Other Decks in Technology
See All in Technology
第27回クラウド女子会 ~re:Invent 振り返りLT会~ 宣言型ポリシー、使ってみたらこうだった!
itkr2305
0
290
論文紹介 ”Long-Context LLMs Meet RAG: Overcoming Challenges for Long Inputs in RAG” @GDG Tokyo
shukob
0
270
What the history of the web can teach us about the future of AI
inesmontani
PRO
0
100
CloudWatch Container Insightsを使ったAmazon ECSのリソース監視
umekou
1
120
信頼性を支えるテレメトリーパイプラインの構築 / Building Telemetry Pipeline with OpenTelemetry
ymotongpoo
9
5k
CNAPPから考えるAWSガバナンスの実践と最適化
yuobayashi
5
680
HCP TerraformとAzure:イオンスマートテクノロジーのインフラ革新 / HCP Terraform and Azure AEON Smart Technology's Infrastructure Innovation
aeonpeople
3
990
データ基盤の成長を加速させる:アイスタイルにおける挑戦と教訓
tsuda7
0
110
ソフトウェア開発現代史:製造業とソフトウェアは本当に共存できていたのか?品質とスピードを問い直す
takabow
15
5.3k
extensionとschema
yahonda
1
100
現実的なCompose化戦略 ~既存リスト画面の置き換え~
sansantech
PRO
0
170
サーバーレスで楽しよう!お気軽に始められる3つのポイント / Have fun with Serverless!
_kensh
2
230
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
171
14k
No one is an island. Learnings from fostering a developers community.
thoeni
20
3.1k
The Cult of Friendly URLs
andyhume
78
6.2k
Designing for humans not robots
tammielis
250
25k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
52k
Adopting Sorbet at Scale
ufuk
74
9.2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.4k
Code Reviewing Like a Champion
maltzj
521
39k
Become a Pro
speakerdeck
PRO
26
5.1k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
Transcript
#typeuwsgi Type uWSGI; Press Enter; What Happens? Philip James —
@phildini DjangoCon US 2017
#typeuwsgi uWSGI…?
#typeuwsgi
#typeuwsgi • How does uWSGI handle processes? • How does
uWSGI handle networking? • Why use uWSGI?
#typeuwsgi
#typeuwsgi pythonista@conf:~ $ python Python 3.5.2 (default, Oct 11 2016,
05:05:28) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
#typeuwsgi python pid: 1222 argv = [‘python’] 0: [terminal] 1:
[terminal] 2: [terminal] bash pid: 1221
#typeuwsgi • How does uWSGI handle processes? • How does
uWSGI handle networking? • Why use uWSGI?
#typeuwsgi Catserve: Cats as a Service https://github.com/phildini/catserve
#typeuwsgi
#typeuwsgi me@conf:~ $ uwsgi --master --http :8000 --module catserve.wsgi -p
2 *** Starting uWSGI 2.0.15 (64bit) on [Thu May 11 10:09:35 2017] *** . . . uWSGI http bound on :8000 fd 4 spawned uWSGI http 1 (pid: 1220) uwsgi socket 0 bound to TCP address 127.0.0.1:52891 (port auto-assigned) fd 3 Python version: 3.5.2 (default, Oct 11 2016, 05:05:28) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] . . . spawned uWSGI worker 1 (and the only) (pid: 1221, cores: 1) Processes
#typeuwsgi *** Starting uWSGI 2.0.15 (64bit) on [Thu May 11
10:09:35 2017] *** . . . uWSGI http bound on :8000 fd 4 spawned uWSGI http 1 (pid: 1220) uwsgi socket 0 bound to TCP address 127.0.0.1:52891 (port auto-assigned) fd 3 Python version: 3.5.2 (default, Oct 11 2016, 05:05:28) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] . . . spawned uWSGI worker 1 (and the only) (pid: 1221, cores: 1) Processes me@conf:~ $ uwsgi --master --http :8000 --module catserve.wsgi -p 2
#typeuwsgi uwsgi pid: 1220 python pid: 1221
#typeuwsgi
#typeuwsgi *** Starting uWSGI 2.0.15 (64bit) on [Thu May 11
10:09:35 2017] *** . . . uWSGI http bound on :8000 fd 4 spawned uWSGI http 1 (pid: 1220) uwsgi socket 0 bound to TCP address 127.0.0.1:52891 (port auto-assigned) fd 3 Python version: 3.5.2 (default, Oct 11 2016, 05:05:28) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] . . . spawned uWSGI worker 1 (pid: 1221, cores: 1) spawned uWSGI worker 2 (pid: 1222, cores: 1) Processes me@conf:~ $ uwsgi --master --http :8000 --module catserve.wsgi -p 2
#typeuwsgi
#typeuwsgi uwsgi pid: 1220 python pid: 1221 python pid: 1222
#typeuwsgi • How does uWSGI handle processes? • How does
uWSGI handle networking? • Why use uWSGI?
#typeuwsgi Networking *** Starting uWSGI 2.0.15 (64bit) on [Thu May
11 10:09:35 2017] *** . . . uWSGI http bound on :8000 fd 4 spawned uWSGI http 1 (pid: 1220) uwsgi socket 0 bound to TCP address 127.0.0.1:52891 (port auto-assigned) fd 3 Python version: 3.5.2 (default, Oct 11 2016, 05:05:28) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] . . . spawned uWSGI worker 1 (pid: 1221, cores: 1) spawned uWSGI worker 2 (pid: 1222, cores: 1) me@conf:~ $ uwsgi --master --http :8000 --module catserve.wsgi -p 2
#typeuwsgi 22 sshd 8000 uwsgi Kernel Userland syscall syscall
#typeuwsgi uwsgi Kernel 8000
#typeuwsgi uwsgi Kernel socket() 8000
#typeuwsgi uwsgi Kernel 4 -> socket:[…] 8000
#typeuwsgi uwsgi Kernel 4 -> socket:[…] bind() 8000
#typeuwsgi uwsgi Kernel 4 -> socket:[…] bind() 8000
#typeuwsgi uwsgi Kernel 4 -> socket:[…] listen() 8000
#typeuwsgi uwsgi Kernel 4 -> socket:[…] 8000 python python 4
-> socket:[…] 4 -> socket:[…]
#typeuwsgi uwsgi Kernel 4 -> socket:[…] 8000 python python 4
-> socket:[…] 4 -> socket:[…] epoll_wait() epoll_wait()
#typeuwsgi uwsgi Kernel 4 -> socket:[…] 8000 python python 4
-> socket:[…] 4 -> socket:[…] accept() epoll_wait() 5 -> socket:[…] epoll_wait() accept()
#typeuwsgi • How does uWSGI handle processes? • How does
uWSGI handle networking? • Why use uWSGI?
#typeuwsgi Code Reloading uwsgi pid: 1220 python pid: 1221 python
pid: 1222 sighup sighup 4 -> socket:[…]
#typeuwsgi Tunability uwsgi pid: 1220 python pid: 1221 python pid:
1222 me@conf:~ $ uwsgi --master --http :8000 --module catserve.wsgi -p 2
#typeuwsgi Security GET / HTTP/1.1 Host: catserve.io GET / HTTP/1.1
Host: catserve.io Host: catserve.biz "[runserver] has not gone through security audits… and that’s how it’s gonna stay.”
#typeuwsgi Config Files [uwsgi] master = 1 http = 8000
module = catserve.wsgi processes = 2 me@conf:~ $ uwsgi --master --http :8000 --module catserve.wsgi -p 2
#typeuwsgi Features • Static file serving • Max requests per
worker • Queuing systems • HTTPS support, HTTP2 support • Harakiri • uwsgitop • memory-report • async
#typeuwsgi Why uWSGI? • Code Reloading • Tunability • Security
• Config Files • Features
#typeuwsgi • How does uWSGI handle processes? • How does
uWSGI handle networking? • Why use uWSGI? Thanks! @unbit Questions? Consulting! Philip James @phildini
[email protected]