Python uWSGI烧瓶对同一用户使用同一工人

Python uWSGI烧瓶对同一用户使用同一工人,python,flask,socket.io,uwsgi,Python,Flask,Socket.io,Uwsgi,我有一个简单的应用程序,通过套接字提供数据,我需要一些工人为一些用户。它与nginx config非常相似,称为sticky headers。但nginx不知道我有多少工人。uWSGI知道并可以为用户提供特定的工作人员。但我不知道怎么做。我之所以需要这些,是因为我有种族问题 这是我的配置 [uwsgi] module = wsgi socket = backend.sock processes = 16 master = true enable-threads = true single-in

我有一个简单的应用程序,通过套接字提供数据,我需要一些工人为一些用户。它与nginx config非常相似,称为sticky headers。但nginx不知道我有多少工人。uWSGI知道并可以为用户提供特定的工作人员。但我不知道怎么做。我之所以需要这些,是因为我有种族问题

这是我的配置

[uwsgi]
module = wsgi

socket = backend.sock
processes = 16
master = true
enable-threads = true
single-interpreter = true
vacuum = true
die-on-term = true
thunder-lock = true

http-websockets = true
http-socket = :1234
chmod-socket = 660
gevent = 1024
gevent-early-monkey-patch = 1
当我设置进程
1
时,所有进程都能完美地工作,因为用户由同一个工人服务

processes = 4
socket = $(PWD)/run/socket_http
socket = $(PWD)/run/socket_ws
map-socket = 0:1,2,3
map-socket = 1:4
这将为web套接字指定1名工作人员(第4名)。 在nginx中,您最终可以执行以下操作:

location /socket.io/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        include uwsgi_params;
        uwsgi_pass unix:/path/to/project/run/socket_ws;
    }

这将为web套接字指定1名工作人员(第4名)。 在nginx中,您最终可以执行以下操作:

location /socket.io/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        include uwsgi_params;
        uwsgi_pass unix:/path/to/project/run/socket_ws;
    }