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
50
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
360
Type uWSGI; Press Enter; What Happens?
phildini
0
93
Oops I Committed My Secret Key
phildini
0
400
Other Decks in Technology
See All in Technology
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
350
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.5k
型情報を用いたLintでコード品質を向上させる
sansantech
PRO
2
160
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
340
なぜCodeceptJSを選んだか
goataka
0
190
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
1
340
組み込みアプリパフォーマンス格闘記 検索画面編
wataruhigasi
1
180
多様なメトリックとシステムの健全性維持
masaaki_k
0
130
[JAWS-UG新潟#20] re:Invent2024 -CloudOperationsアップデートについて-
shintaro_fukatsu
0
130
Server-Side Engineer of LINE Sukimani
lycorp_recruit_jp
0
430
OCI技術資料 : ファイル・ストレージ 概要
ocise
3
11k
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
520
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Cost Of JavaScript in 2023
addyosmani
46
7k
Practical Orchestrator
shlominoach
186
10k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
The Language of Interfaces
destraynor
155
24k
RailsConf 2023
tenderlove
29
950
Facilitating Awesome Meetings
lara
50
6.1k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
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]