Projet

Général

Profil

Development #44416

debian, paramétrage "cheaper" pour uwsgi

Ajouté par Frédéric Péters il y a presque 4 ans. Mis à jour il y a presque 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
24 juin 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

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

Lié à Publik - Support #42249: arrêter d'être cheap sur les process lancés par uwsgiFermé29 avril 2020

Actions

Révisions associées

Révision 2dc86a68 (diff)
Ajouté par Frédéric Péters il y a presque 4 ans

debian: use cheaper uwsgi subsystem (#44416)

Historique

#1

Mis à jour par Frédéric Péters il y a presque 4 ans

(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).

#2

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
#3

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.

#4

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).

#5

Mis à jour par Frédéric Péters il y a presque 4 ans

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à).

#6

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).

#7

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.

#8

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à.

#9

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.
#10

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.

#11

Mis à jour par Frédéric Péters il y a presque 4 ans

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.

#12

Mis à jour par Emmanuel Cazenave il y a presque 4 ans

  • Statut changé de Solution proposée à Solution validée
#13

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)
#14

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
#15

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é

Formats disponibles : Atom PDF