| 1 | # |
| 2 | # This file is part of gunicorn released under the MIT license. |
| 3 | # See the NOTICE for more information. |
| 4 | |
| 5 | """ |
| 6 | Gunicorn configuration for dirty pool integration benchmarks. |
| 7 | |
| 8 | Usage: |
| 9 | gunicorn -c benchmarks/dirty_bench_gunicorn.py \ |
| 10 | benchmarks.dirty_bench_wsgi:app |
| 11 | """ |
| 12 | |
| 13 | # Bind address |
| 14 | bindscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/bind. = "127.0.0.1:8000" |
| 15 | |
| 16 | # HTTP worker configuration |
| 17 | workersscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/workers. = 4 |
| 18 | worker_classscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/worker_class. = "gthread" |
| 19 | threadsscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/threads. = 4 |
| 20 | worker_connectionsscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/worker_connections. = 1000 |
| 21 | |
| 22 | # Dirty pool configuration |
| 23 | dirty_appsscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_apps. = ["benchmarks.dirty_bench_app:BenchmarkApp"] |
| 24 | dirty_workersscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_workers. = 4 |
| 25 | dirty_threadsscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_threads. = 1 |
| 26 | dirty_timeoutscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_timeout. = 300 |
| 27 | dirty_graceful_timeoutscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_graceful_timeout. = 30 |
| 28 | |
| 29 | # Logging |
| 30 | accesslogscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/accesslog. = "-" |
| 31 | errorlogscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/errorlog. = "-" |
| 32 | loglevelscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/loglevel. = "info" |
| 33 | |
| 34 | # Timeouts |
| 35 | timeoutscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/timeout. = 120 |
| 36 | graceful_timeoutscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/graceful_timeout. = 30 |
| 37 | keepalivescip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/keepalive. = 2 |
| 38 | |
| 39 | |
| 40 | # Lifecycle hooks |
| 41 | |
| 42 | def on_dirty_startingscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/on_dirty_starting().(arbiterscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/on_dirty_starting().(arbiter)): |
| 43 | """Called when dirty arbiter is starting.""" |
| 44 | printscip-python python python-stdlib 3.11 builtins/print().(f"[dirty] Arbiter starting (pid: {arbiterscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/on_dirty_starting().(arbiter).pid})") |
| 45 | |
| 46 | |
| 47 | def dirty_post_forkscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_post_fork().(arbiterscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_post_fork().(arbiter), workerscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_post_fork().(worker)): |
| 48 | """Called after dirty worker fork.""" |
| 49 | printscip-python python python-stdlib 3.11 builtins/print().(f"[dirty] Worker {workerscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_post_fork().(worker).pid} forked") |
| 50 | |
| 51 | |
| 52 | def dirty_worker_initscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_init().(workerscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_init().(worker)): |
| 53 | """Called after dirty worker apps are initialized.""" |
| 54 | printscip-python python python-stdlib 3.11 builtins/print().(f"[dirty] Worker {workerscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_init().(worker).pid} initialized with apps: " |
| 55 | f"{listscip-python python python-stdlib 3.11 builtins/list#(workerscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_init().(worker).apps.keys())}") |
| 56 | |
| 57 | |
| 58 | def dirty_worker_exitscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_exit().(arbiterscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_exit().(arbiter), workerscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_exit().(worker)): |
| 59 | """Called when dirty worker exits.""" |
| 60 | printscip-python python python-stdlib 3.11 builtins/print().(f"[dirty] Worker {workerscip-python python gunicorn 25.3.0 `benchmarks.dirty_bench_gunicorn`/dirty_worker_exit().(worker).pid} exiting") |