Search code examples
pythonnginxtornado

have nginix assign a process to one connection


this is my current nginx.conf file:

user www-data;worker_processes 4;
pid /run/nginx.pid;

events {
    #connections a worker can handle: ulimit -n
    worker_connections 1024;
    use epoll;
   # multi_accept on;
}

http{

upstream pumpkins{
server localhost:8000;
server localhost:8001;
server localhost:8002;
server localhost:8003;
}

proxy_next_upstream error;

server{
listen 80;
#listen localhost;
#server_name localhost;

# Allow file uploads
client_max_body_size 50M;

location / {
    proxy_pass_header Server;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_pass http://pumpkins;
}

}

}

I HAVEN'T done any async coding in tornado as yet to handle connections concurrently but I was wondering is there a way to have nginx assign a process to a connection and stay with that connection till the client logs off or disconnects, or is this something that would have to be done in tornado/python? if so how would I go about that.


Solution

  • I think you need session persistence