Skip to content

Instantly share code, notes, and snippets.

@immerrr
Created January 13, 2016 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save immerrr/fcba019e21dd823ee486 to your computer and use it in GitHub Desktop.
Save immerrr/fcba019e21dd823ee486 to your computer and use it in GitHub Desktop.
uwsgi & file descriptors
uwsgi \
--http :9090 \
--wsgi-file test_uwsgi.py \
--log-format='%(addr) %(username) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(rsize) "%(referer)" "%(uagent)" %(msecs)' \
| sed 's/^/###OUT:/'
from __future__ import print_function
import sys
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
print("stdout", file=sys.stdout)
print("stderr", file=sys.stderr)
print("sys.stdout=%s sys.stderr=%s" % (sys.stdout, sys.stderr))
return ['Hello']
*** Starting uWSGI 2.0.12 (64bit) on [Wed Jan 13 21:07:50 2016] ***
compiled with version: 4.6.4 on 13 January 2016 19:45:45
os: Linux-3.13.0-74-generic #118~precise1-Ubuntu SMP Fri Dec 18 10:38:55 UTC 2015
nodename: mmrdell
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/immerrr/scrapinghub/platform
detected binary path: /home/immerrr/.conda/envs/uwsgi2/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 127470
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :9090 fd 4
spawned uWSGI http 1 (pid: 13517)
uwsgi socket 0 bound to TCP address 127.0.0.1:48088 (port auto-assigned) fd 3
Python version: 2.7.11 |Continuum Analytics, Inc.| (default, Dec 6 2015, 18:08:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x183f460
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x183f460 pid: 13515 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 13515, cores: 1)
stderr
###OUT:stdout
###OUT:sys.stdout=<open file '<stdout>', mode 'w' at 0x7fed80ffc150> sys.stderr=<open file '<stderr>', mode 'w' at 0x7fed80ffc1e0>
127.0.0.1 - [13/Jan/2016:21:07:53 +0300] "GET / HTTP/1.1" 200 5 "-" "HTTPie/0.9.2" 0
*** Starting uWSGI 2.0.12 (64bit) on [Wed Jan 13 21:05:05 2016] ***
compiled with version: 4.6.4 on 13 January 2016 19:44:42
os: Linux-3.13.0-74-generic #118~precise1-Ubuntu SMP Fri Dec 18 10:38:55 UTC 2015
nodename: mmrdell
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/immerrr/scrapinghub/platform
detected binary path: /home/immerrr/.conda/envs/uwsgi3/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 127470
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :9090 fd 4
spawned uWSGI http 1 (pid: 13309)
uwsgi socket 0 bound to TCP address 127.0.0.1:44468 (port auto-assigned) fd 3
Python version: 3.5.1 |Continuum Analytics, Inc.| (default, Dec 7 2015, 11:16:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x941770
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x941770 pid: 13307 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 13307, cores: 1)
stdout
stderr
sys.stdout=<_io.TextIOWrapper name=2 mode='w' encoding='UTF-8'> sys.stderr=<_io.TextIOWrapper name=2 mode='w' encoding='UTF-8'>
127.0.0.1 - [13/Jan/2016:21:05:08 +0300] "GET / HTTP/1.1" 200 127 "-" "HTTPie/0.9.2" 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment