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
19
The Elephant and the Serpent (PyLatam 2019)
phildini
0
42
Account Security for the Fashionable App Developer
phildini
1
59
All in the Timing: Side-Channel Attacks
phildini
0
48
Giving Thanks
phildini
0
39
All in the Timing: Side-Channel Attacks in Python
phildini
0
370
API-Driven Django
phildini
1
320
Type uWSGI; Press Enter; What Happens?
phildini
0
93
Oops I Committed My Secret Key
phildini
0
370
Other Decks in Technology
See All in Technology
Janus
bkuhlmann
1
490
エンジニアのキャリアをちょっと楽しくする3本の軸/Three Pillars to Make an Engineer's Career More Enjoyable
kwappa
0
2.7k
20分で完全に理解するGrafanaダッシュボード
hamadakoji
3
590
Compose Compiler Metricsを使った実践的なコードレビュー
tomorrowkey
1
220
一生覚えておきたい「システム開発=コミュニケーション」〜初めての実務案件振り返りLT〜
maimyyym
0
140
Delivering Millions of Messages within seconds @ Duolingo
pelelgrino
0
350
ChatworkのSRE部って実は 半分くらいPlatform Engineering部かもしれない
saramune
0
160
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
2.1k
Vertex AI を中心に 生成AIのアップデートを共有します
kaz1437
0
310
Building Dashboards as a Hobby
egmc
0
180
Além do else! Categorizando Pokemóns com Pattern Matching no JavaScript
wmsbill
0
620
GraphQL 成熟度モデルの紹介と、プロダクトに当てはめた事例 / GraphQL maturity model
mh4gf
7
1.3k
Featured
See All Featured
Fireside Chat
paigeccino
21
2.6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
2
3.4k
Build your cross-platform service in a week with App Engine
jlugia
225
17k
Git: the NoSQL Database
bkeepers
PRO
422
63k
GraphQLとの向き合い方2022年版
quramy
32
12k
The Pragmatic Product Professional
lauravandoore
25
5.8k
Embracing the Ebb and Flow
colly
80
4.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
20
1.9k
Ruby is Unlike a Banana
tanoku
96
10k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
17
1.4k
Adopting Sorbet at Scale
ufuk
68
8.6k
Designing for humans not robots
tammielis
248
25k
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]