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
25
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
410
API-Driven Django
phildini
1
360
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
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.9k
強いチームと開発生産性
onk
PRO
35
11k
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
330
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.7k
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
Can We Measure Developer Productivity?
ewolff
1
150
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
What's in a price? How to price your products and services
michaelherold
243
12k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Practical Orchestrator
shlominoach
186
10k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
What's new in Ruby 2.0
geeforr
343
31k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Become a Pro
speakerdeck
PRO
25
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]