mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-02 18:51:31 +08:00
Add /slow endpoint to benchmark app
Add endpoint with 10ms simulated I/O for latency testing.
This commit is contained in:
parent
f9ca296d21
commit
f164d9d23e
@ -4,12 +4,18 @@
|
|||||||
|
|
||||||
# Simple WSGI app for benchmarking
|
# Simple WSGI app for benchmarking
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
def application(environ, start_response):
|
def application(environ, start_response):
|
||||||
"""Basic hello world response."""
|
"""Basic hello world response."""
|
||||||
path = environ.get('PATH_INFO', '/')
|
path = environ.get('PATH_INFO', '/')
|
||||||
|
|
||||||
if path == '/large':
|
if path == '/large':
|
||||||
body = b'X' * 65536 # 64KB
|
body = b'X' * 65536 # 64KB
|
||||||
|
elif path == '/slow':
|
||||||
|
time.sleep(0.01) # 10ms simulated I/O
|
||||||
|
body = b'Slow response'
|
||||||
else:
|
else:
|
||||||
body = b'Hello, World!'
|
body = b'Hello, World!'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user