Development #44416
debian, paramétrage "cheaper" pour uwsgi
0%
Description
Pour réagir à la charge, tourner avec peu de process sur des installations légères, tout en permettant de monter haut sur des installations qui seraient sollicitées. cf le lien dans #42249 et la doc de uwsgi.
Fichiers
Demandes liées
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a presque 4 ans
- Fichier 0001-debian-use-cheaper-uwsgi-subsystem-44416.patch 0001-debian-use-cheaper-uwsgi-subsystem-44416.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
(ce qui serait à adopter/adapter pour tous les modules).
Ça introduit aussi les options suivantes, recommandées dans l'article lié : die-on-term = true (même si en manipulant via systemctl ça n'a pas tellement d'importance), single-interpreter = true (cf l'article), need-app = true (vraiment utile celui-ci, pour permettre à uwsgi de ne pas démarrer si jamais l'application ne démarrait pas, et donc que ça foire bien correctement dans systemd).
Mis à jour par Emmanuel Cazenave il y a presque 4 ans
Testé un fichier dans le même genre chez moi pour docbow, avec la nuance d'un strict = true
qui me plait bien, et ça échoue sur ces directives non reconnues :
cheaper-busyness-multiplier = 30 cheaper-busyness-min = 20 cheaper-busyness-max = 70 cheaper-busyness-backlog-alert = 16 cheaper-busyness-backlog-step = 2
avec :
apt-cache policy uwsgi uwsgi: Installed: 2.0.18-1 Candidate: 2.0.18-1 Version table: *** 2.0.18-1 500 500 http://ftp.fr.debian.org/debian buster/main amd64 Packages 100 /var/lib/dpkg/status 2.0.14+20161117-3+deb9u2 500 500 http://deb.debian.org/debian stretch/main amd64 Packages 500 http://deb.debian.org/debian-security stretch/updates/main amd64 Packages
Mis à jour par Frédéric Péters il y a presque 4 ans
ça échoue sur ces directives non reconnues
Bizarre elles sont documentées et la présence de cheaper = 5 doit activer le plugin,
To enable cheaper mode add the cheaper = N option to the uWSGI configuration file
— https://uwsgi-docs-additions.readthedocs.io/en/latest/Cheaper.html
Pas fan de cette possibilité de strict=true qui empêcherait de mettre des options de buster tant qu'il nous resterait des installations en strech.
Mis à jour par Emmanuel Cazenave il y a presque 4 ans
En fait je n'ai pas l'algo 'busyness' de disponible :
cazino@cazino-laptop:/var/lib/eobuilder/results/buster-amd64$ /usr/bin/uwsgi --cheaper-list *** uWSGI loaded cheaper algorithms *** spare backlog manual --- end of cheaper algorithms list ---
Et retour à la doc : https://uwsgi-docs-additions.readthedocs.io/en/latest/Cheaper.html#cheaper-busyness-algorithm , il faut un plugin 'cheaper_busyness' semble absent des dépôts debian.
(d'où l'intérêt du strict
selon moi, ne pas passer à coté de ce genre de choses).
Mis à jour par Frédéric Péters il y a presque 4 ans
- Fichier 0001-debian-use-cheaper-uwsgi-subsystem-44416.patch 0001-debian-use-cheaper-uwsgi-subsystem-44416.patch ajouté
Ok, je l'ai bien chez moi et d'après le paquet, ça devrait y être depuis 1.9.11-1,
* Add plugins to uwsgi-core package: - cheaper_backlog2 - cheaper_busyness
et le fichier est bien présent, https://packages.debian.org/buster/amd64/uwsgi-core/filelist
mais ok,
jun 26 04:20:09 wcs uwsgi[2343]: unable to find requested cheaper algorithm, falling back to spare
il faut visiblement être explicite contrairement à ce que j'écrivais, ajouter un plugin = cheaper_busyness dans l'uwsgi.ini, sauf qu'à faire ça le stop/restart ne fonctionne plus...
Tentative avec,
cheaper-algo = spare2 cheaper = 5 cheaper-initial = 5 cheaper-step = 5
(et la doc parle d'un cheaper-idle mais j'ai mis strict = true et donc ça me dit que non, n'existe visiblement pas encore là).
Mis à jour par Frédéric Péters il y a presque 4 ans
(si ça intéresse quelqu'un de regarder du côté de busyness en soit ça a l'air mieux, mais je vais me contenter de spare2).
Mis à jour par Emmanuel Cazenave il y a presque 4 ans
Frédéric Péters a écrit :
il faut visiblement être explicite contrairement à ce que j'écrivais, ajouter un plugin = cheaper_busyness dans l'uwsgi.ini, sauf qu'à faire ça le stop/restart ne fonctionne plus...
Pareil chez moi.
Mis à jour par Emmanuel Cazenave il y a presque 4 ans
A aller à un peu loin avec un cheaper-busyness-verbose = true
,
Sur un stop, on dirait que l'algo busyness est pas d'accord pour couper tout de suite :
juin 29 16:11:10 cazino-laptop uwsgi[18984]: [busyness] 5s average busyness of 10 worker(s) is at 0% juin 29 16:11:10 cazino-laptop uwsgi[18984]: [busyness] need to wait 19 more second(s) to cheap worker juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 1 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 2 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 3 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 4 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 5 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 6 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 7 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 8 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 9 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] worker nr 10 5s average busyness is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] 5s average busyness of 10 worker(s) is at 0% juin 29 16:11:15 cazino-laptop uwsgi[18984]: [busyness] need to wait 14 more second(s) to cheap worker juin 29 16:11:20 cazino-laptop uwsgi[18984]: [busyness] worker nr 1 5s average busyness is at 0% etc
et systemd finit par perdre patience :
juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: State 'stop-sigterm' timed out. Killing. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 18984 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19018 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19020 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19022 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19024 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19026 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19028 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19030 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19032 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Killing process 19034 (uwsgi) with signal SIGKILL. juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Main process exited, code=killed, status=9/KILL juin 29 16:12:08 cazino-laptop systemd[1]: docbow.service: Failed with result 'timeout'. juin 29 16:12:08 cazino-laptop systemd[1]: Stopped Docbow.
En passant de de KillSignal=SIGQUIT
à KillSignal=SIGTERM
dans la conf systemd, ça a l'air de stopper proprement (on voit du VACUUM, j'ai vacuum = true
dans ma conf) :
juin 29 16:09:18 cazino-laptop systemd[1]: Stopping Docbow... juin 29 16:09:18 cazino-laptop uwsgi[16406]: SIGINT/SIGQUIT received...killing workers... juin 29 16:09:19 cazino-laptop uwsgi[16406]: worker 6 buried after 1 seconds juin 29 16:09:19 cazino-laptop uwsgi[16406]: worker 7 buried after 1 seconds juin 29 16:09:19 cazino-laptop uwsgi[16406]: worker 8 buried after 1 seconds juin 29 16:09:19 cazino-laptop uwsgi[16406]: worker 9 buried after 1 seconds juin 29 16:09:19 cazino-laptop uwsgi[16406]: worker 10 buried after 1 seconds juin 29 16:09:19 cazino-laptop uwsgi[16406]: goodbye to uWSGI. juin 29 16:09:19 cazino-laptop uwsgi[16406]: VACUUM: unix socket /run/docbow/docbow.sock removed. juin 29 16:09:19 cazino-laptop uwsgi[16406]: VACUUM: unix socket /run/docbow/stats.sock (stats) removed. juin 29 16:09:19 cazino-laptop systemd[1]: docbow.service: Succeeded. juin 29 16:09:19 cazino-laptop systemd[1]: Stopped Docbow.
Je ne sais pas si c'est casher d'utiliser SIGTERM, je m'arrête là.
Mis à jour par Emmanuel Cazenave il y a presque 4 ans
Mais en fait un petit dernier.
En restant sur KillSignal=SIGQUIT, mais en shootant die-on-term = true
, le start/stop est ok en mode busyness :
juin 29 16:36:08 cazino-laptop uwsgi[24371]: SIGINT/SIGQUIT received...killing workers... juin 29 16:36:08 cazino-laptop systemd[1]: Stopping Docbow... juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 1 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 2 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 3 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 4 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 5 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 6 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 7 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 8 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 9 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: worker 10 buried after 1 seconds juin 29 16:36:09 cazino-laptop uwsgi[24371]: goodbye to uWSGI. juin 29 16:36:09 cazino-laptop uwsgi[24371]: VACUUM: unix socket /run/docbow/docbow.sock removed. juin 29 16:36:09 cazino-laptop uwsgi[24371]: VACUUM: unix socket /run/docbow/stats.sock (stats) removed. juin 29 16:36:09 cazino-laptop systemd[1]: docbow.service: Succeeded. juin 29 16:36:09 cazino-laptop systemd[1]: Stopped Docbow.
Mis à jour par Emmanuel Cazenave il y a presque 4 ans
Frédéric Péters a écrit :
(si ça intéresse quelqu'un de regarder du côté de busyness en soit ça a l'air mieux, mais je vais me contenter de spare2).
Pour revenir, frais et dispo, à un commentaire plus synthétique.
Sur ton premier patch sur busyness, ajouter plugin = cheaper_busyness
et strict = true
, enlever die-on-term = true
et ça me semblerait nickel.
Si tu veux malgré tout du spare2, je peux valider aussi.
Mis à jour par Frédéric Péters il y a presque 4 ans
- Fichier 0001-debian-use-cheaper-uwsgi-subsystem-44416.patch 0001-debian-use-cheaper-uwsgi-subsystem-44416.patch ajouté
Sur ton premier patch sur busyness, ajouter plugin = cheaper_busyness et strict = true, enlever die-on-term = true et ça me semblerait nickel.
Voilà fait ainsi.
Mis à jour par Emmanuel Cazenave il y a presque 4 ans
- Statut changé de Solution proposée à Solution validée
Mis à jour par Frédéric Péters il y a presque 4 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit 2dc86a681474d350e737e58995d09c1af3c6c072 Author: Frédéric Péters <fpeters@entrouvert.com> Date: Wed Jun 24 15:30:51 2020 +0200 debian: use cheaper uwsgi subsystem (#44416)
Mis à jour par Frédéric Péters il y a presque 4 ans
- Statut changé de Résolu (à déployer) à Solution déployée
Mis à jour par Frédéric Péters il y a environ 3 ans
- Lié à Support #42249: arrêter d'être cheap sur les process lancés par uwsgi ajouté
debian: use cheaper uwsgi subsystem (#44416)