Search code examples
python-3.xflaskuwsgiuwsgi-stats-server

Unable to use preloaded uWSGI cheaper algorithm


I'm unable to use uWSGI's busyness cheaper algorithm although it appears to be pre-loaded in my installation. Does it still merit an explicit install? Is so, where can I download the standalone plugin package from? Any help is appreciated, thank you.

uWSGI Information

uwsgi --version
2.0.19.1

uwsgi --cheaper-algos-list

*** uWSGI loaded cheaper algorithms ***
busyness
spare
backlog
manual
--- end of cheaper algorithms list ---

uWSGI Configuration File

[uwsgi]
module = myapp:app

socket = /path/to/myapp.sock
stats = /path/to/mystats.sock
chmod-socket = 766
socket-timeout = 60                     ; Set internal sockets timeout

logto = /path/to/logs/%n.log
log-maxsize = 5000000                   ; Max size before rotating file
disable-logging = true                  ; Disable built-in logging
log-4xx = true                          ; But log 4xx
log-5xx = true                          ; And 5xx

strict = true                           ; Enable strict mode (placeholder cannot be used)
master = true                           ; Enable master process
enable-threads = true                   ; Enable threads
vacuum = true                           ; Delete sockets during shutdown
single-interpreter = true               ; Do not use multiple interpreters (single web app per uWSGI process)
die-on-term = true                      ; Shutdown when receiving SIGTERM (default is respawn)
need-app = true                         ; Exit if no app can be loaded

harakiri = 300                          ; Forcefully kill hung workers after desired time in seconds

max-requests = 1000                     ; Restart workers after this many requests
max-worker-lifetime = 3600              ; Restart workers after this many seconds
reload-on-rss = 1024                    ; Restart workers after this much resident memory (this is per worker)
worker-reload-mercy = 60                ; How long to wait for workers to reload before forcefully killing them

cheaper-algo = busyness                 ; Specify the cheaper algorithm here
processes = 16                          ; Maximum number of workers allowed
threads = 4                             ; Number of threads per worker allowed
thunder-lock = true                     ; Specify thunderlock activation
cheaper = 8                             ; Number of workers to keep idle
cheaper-initial = 8                     ; Workers created at startup
cheaper-step = 4                        ; Number of workers to spawn at once
cheaper-overload = 30                   ; Check the busyness of the workers at this interval (in seconds)

uWSGI Log

*** Operational MODE: preforking+threaded ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x15e8f10 pid: 14479 (default app)
spawned uWSGI master process (pid: 14479)
spawned uWSGI worker 1 (pid: 14511, cores: 4)
spawned uWSGI worker 2 (pid: 14512, cores: 4)
spawned uWSGI worker 3 (pid: 14516, cores: 4)
spawned uWSGI worker 4 (pid: 14520, cores: 4)
spawned uWSGI worker 5 (pid: 14524, cores: 4)
spawned uWSGI worker 6 (pid: 14528, cores: 4)
spawned uWSGI worker 7 (pid: 14529, cores: 4)
spawned uWSGI worker 8 (pid: 14533, cores: 4)
THIS LINE --> unable to find requested cheaper algorithm, falling back to spare <-- THIS LINE

OS Information

Red Hat Enterprise Linux Server release 7.7 (Maipo)

Other Details

uWSGI was installed using pip

Solution

  • The comments were messing things up for me - the below format fixed the issue

    ########################################################
    #                                                      #
    #           Cheaper Algo and Worker Count              #
    #                                                      #
    ########################################################
    cheaper-algo = busyness
    processes = 16
    threads = 4
    thunder-lock = true
    cheaper = 8
    cheaper-initial = 8
    cheaper-step = 4
    cheaper-overload = 30