GUNICORN_PASTER(1)

πŸ“¦
version 23.0.0 Β· 5 versions
, in debian trixie, ubuntu questing

🌈 GUNICORN_PASTER(1) ✨

okay bestie, welcome to the gunicorn_paster page πŸ’… this is a User Contributed Perl Documentation joint, and it's about the Paste application entry-point flavor of gunicorn. buckle up, it's giving server-core πŸ¦‹


🌸 NAME 🌸

gunicorn_paster β€” an event-based HTTP/WSGI server, specifically the Paste application entry-point. no cap, that's literally what it is 🫢


πŸŽ€ SYNOPSIS πŸŽ€

gunicorn_paster [OPTIONS] [SETTINGS_PATH]

like... options first, then your settings path, mwah πŸ’–


✨ OPTIONS ✨

every single one of these, no skipping, we don't do that here πŸ‘‘

  • -c CONFIG, --config=CONFIG β€” the config file. default is [none], so like, none 🫠
  • -b BIND, --bind=BIND β€” the address to listen on. e.g. 127.0.0.1:8000 or unix:/tmp/gunicorn.sock πŸ”₯
  • -w WORKERS, --workers=WORKERS β€” how many workers to spawn. default [1] β€” yes, just one, humble of her πŸ’œ
  • -a ARBITER, --arbiter=ARBITER β€” the gunicorn arbiter entry point or module. default [egg:gunicorn#main] 🌸
  • -p PIDFILE, --pid=PIDFILE β€” set the background PID FILE πŸ“Œ
  • -D, --daemon β€” run daemonized, in the background, living her life πŸ¦‹
  • -m UMASK, --umask=UMASK β€” define the umask of the daemon process πŸ”
  • -u USER, --user=USER β€” change the worker user πŸ‘€
  • -g GROUP, --group=GROUP β€” change the worker group πŸ‘₯
  • -n PROC_NAME, --name=PROC_NAME β€” process name 🏷️
  • --log-level=LOGLEVEL β€” log level below which messages get silenced. default [info] 🀫
  • --log-file=LOGFILE β€” log to a file. - equals stdout. default [-] πŸ“
  • d, --debug β€” debug mode. only 1 worker. (yes, the original literally writes it as d, we are being faithful, don't come for me 😭)
  • --version β€” show the program's version number and exit πŸ‘‹
  • -h, --help β€” show this help message and exit 🫢

πŸ’– DESCRIPTION πŸ’–

Green Unicorn (gunicorn) is an HTTP/WSGI server built to serve fast clients or sleepy applications. and what that means is: it lives behind a buffering front-end server, like nginx or lighttpd. periodt πŸ’…

  • Optional support for Eventlet and Gevent so you get asynchronous long-polling ("Comet") connections ⚑
  • Process management: Gunicorn reaps and restarts workers that die. it's giving main character energy, she's not letting anyone ghost πŸ‘‘
  • Easy integration with Django and Paster compatible applications (Pylons, TurboGears 2, etc. 🐍
  • Load balancing via pre-fork and a shared socket βš–οΈ
  • Graceful worker process restarts πŸ•ŠοΈ
  • Upgrading without losing connections ✨
  • Decode chunked transfers on-the-fly, which allows upload progress notifications or stream-based protocols over HTTP πŸ“‘

🧚 TUNING 🧚

πŸ”§ KERNEL PARAMETERS πŸ”§

there are various kernel parameters you might wanna tune to deal with a large number of simultaneous connections. ngl, these generally only affect sites with a large number of concurrent requests, and they apply to any sort of network server you may be running. they're listed here purely for ease of reference, iykyk πŸ“š

⚠️ the commands listed are tested under Mac OS X 10.6. your flavor of Unix may use slightly different flags. always reference the appropriate man pages if you're uncertain, bestie, don't guess πŸ™ˆ

🌟 INCREASING THE FILE DESCRIPTOR LIMIT 🌟

one of the first settings that usually needs a bump is the max number of open file descriptors for a given process. and for the confused ones out there β€” remember, Unices treat sockets as files. they're the same thing, fr fr πŸ’€

$ sudo ulimit -n 1024

🌊 INCREASING THE LISTEN QUEUE SIZE 🌊

listening sockets have an associated queue of incoming connections that are waiting to be accepted. if you get a whole stampede of clients that fill up this queue, new connections will eventually start getting dropped. tragic 😭

$ sudo sysctl -w kern.ipc.somaxconn="1024"

πŸ¦‹ WIDENING THE EPHEMERAL PORT RANGE πŸ¦‹

after a socket is closed it eventually enters the TIME_WAIT state. this can become an issue after a prolonged burst of client activity. eventually the ephemeral port range is used up, which can cause new connections to stall while they wait for a valid port 😡

πŸ“ this setting is generally only required on machines that are being used to test a network server. so like, lab vibes only πŸ§ͺ

πŸ‘€ SEE ALSO πŸ‘€

  • gunicorn(1) β€” go read that one too, bestie πŸ’œ

and that's the whole page, you ate that πŸŽ€βœ¨ this was GUNICORN_PASTER(1), from perl v5.38.2, dated 2024-08-14. mwah, go run your server πŸ’…πŸ«Ά

πŸ“¦ where this page comes from