Skip to content

Instantly share code, notes, and snippets.

@larsbutler
Created July 21, 2016 09:33
Show Gist options
  • Save larsbutler/9ff534827919fe14e5a3a5ceddfc9431 to your computer and use it in GitHub Desktop.
Save larsbutler/9ff534827919fe14e5a3a5ceddfc9431 to your computer and use it in GitHub Desktop.
Gunicorn experiment
# to run:
# gunicorn --workers=3 --worker-class sync gu:app
# gunicorn --workers=3 --worker-class gevent gu:app
# etc.
import threading
import os
def app(environ, start_response):
"""Simplest possible application object"""
print("current-tid: {0}. active-count: {1}. pid: {2}".format(
threading.current_thread().ident,
threading.active_count(),
os.getpid(),
))
data = 'Hello, World!\n'
status = '200 OK'
response_headers = [
('Content-type','text/plain'),
('Content-Length', str(len(data)))
]
start_response(status, response_headers)
return iter([data])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment