3. Availability
crash happens. always.
giovedì 26 aprile 12
4. Concurrency
there is no “premature optimization” thing in
sysadmins world
giovedì 26 aprile 12
5. Users
They ignore you when things go well. They hate you
when things go wrong. They want to kill you a bunch
of minutes later...
giovedì 26 aprile 12
6. Servers are a cost
...and can became the higher cost very easily
giovedì 26 aprile 12
7. The manager want to scale
...even if he does not know what it means
giovedì 26 aprile 12
8. Security
be ready for the truth
giovedì 26 aprile 12
9. WSGI
one standard to rule them all...
def application(env, start_response):
start_response(‘200 OK’, [(‘Content-Type’,‘text/html’)])
return “Hello World”
giovedì 26 aprile 12
10. Proxy servers and static
contents
do not expose your app to the world. NEVER
do not serve static files with Django. NEVER
giovedì 26 aprile 12
11. app
world
webserver app
app
giovedì 26 aprile 12
12. Once upon a time...
Flup and mod_python
giovedì 26 aprile 12
13. Flup
FastCGI, SCGI, AJP
pure python, preforking-multithread
giovedì 26 aprile 12
14. mod_python
was a bad idea ?
giovedì 26 aprile 12
16. mod_wsgi
apache module (in C)
2 modes: embedded and daemon
preforking and multithread
mature
solid
Windows support
giovedì 26 aprile 12
17. # mod_wsgi config
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com
WSGIDaemonProcess pippo processes=2 threads=15
<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
giovedì 26 aprile 12
18. gunicorn
pure python
do one thing do it well
preforking (+async extensions)
speaks http
easy (maybe the easiest tool ever written)
giovedì 26 aprile 12
19. PYTHONPATH=/var/www gunicorn --workers 2 --bind 127.0.0.1:8000 pippo.wsgi:application
# or add gunicorn to INSTALLED_APPS
# it will bind to port 8000
python manage.py run_gunicorn
giovedì 26 aprile 12
20. uWSGI
pure C
preforking + multithread + async + plugins + blah blah
feature rich (a blast beat of options)
speaks uwsgi,FastCGI,Mongrel2-zeromq,HTTP and maybe Klingon
fat-beardy-braces_equipped sysadmin friendly
high learning curve
made only for making money
Mr Wolf would wear a uWSGI t-shirt
giovedì 26 aprile 12