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
73
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
23
The Elephant and the Serpent (PyLatam 2019)
phildini
0
44
Account Security for the Fashionable App Developer
phildini
1
64
All in the Timing: Side-Channel Attacks
phildini
0
54
Giving Thanks
phildini
0
42
All in the Timing: Side-Channel Attacks in Python
phildini
0
400
API-Driven Django
phildini
1
350
Type uWSGI; Press Enter; What Happens?
phildini
0
93
Oops I Committed My Secret Key
phildini
0
390
Other Decks in Technology
See All in Technology
トークナイザー入門
payanotty
2
920
【swonet.conf_】NOCメンバーが語るSTMの実態!! ~ShowNetから若者への贈り物~
shownet
PRO
0
290
HashHub会社案内「なぜ今、パブリックブロックチェーンに賭けるのか」
hashhub
3
75k
【shownet.conf_】コンピューティング資源を統合した分散コンテナ基盤の進化
shownet
PRO
0
390
【shownet.conf_】3Dアプローチで守るセキュリティ
shownet
PRO
0
360
ドメインと向き合う - 旅行予約編
hidenorigoto
4
560
小さな勉強会の始め方、広げ方、あるいは友達の作り方 / How to Start, Grow, and Build Connections with Small Study Groups
ar_tama
6
2.4k
Oracle GoldenGate 23ai 導入Tips
oracle4engineer
PRO
1
260
それでもやっぱり ExpressRoute が好き!
skmkzyk
0
230
【shownet.conf_】ShowNet x 宇宙ネットワーク
shownet
PRO
0
390
【shownet.conf_】多様化するネットワーク環境を柔軟に統合するルーティングテクノロジー
shownet
PRO
0
360
たった一人で始めた音楽制作が気がついたら会社公認の部活動になっていた話〜組織の垣根を超えるコラボレーションを実現するには〜 / On-KAG-bu
piyonakajima
0
210
Featured
See All Featured
Navigating Team Friction
lara
183
14k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
Typedesign – Prime Four
hannesfritz
39
2.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
The Cost Of JavaScript in 2023
addyosmani
43
5.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
105
48k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.6k
Making Projects Easy
brettharned
115
5.8k
Pencils Down: Stop Designing & Start Developing
hursman
119
11k
How GitHub Uses GitHub to Build GitHub
holman
473
290k
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]