Search code examples
uwsgiuwsgi-stats-server

uwsgi --stats show different port number for socket


I start uwsgi with the following command:

$ uwsgi --http :8001 --module greendrinks.wsgi --master --stats :9191

If I check out localhost:9191 I see a lot of information. The only port number I see anywhere is in the following snippet:

"sockets":[
    {
        "name":"127.0.0.1:43864",
        "proto":"uwsgi",
        "queue":0,
        "max_queue":100,
        "shared":0,
        "can_offload":0
    }
],

I was expecting it to say port 8001, but instead I see 43864. Could someone explain how this works?


Solution

  • When you start uWSGI with --http you are starting a http proxy that forward requests to the real instance. The stats you get are from the real instance, that is bound to a random port (the one you see in stats) where the http router/proxy forward requests. You can have a stats server even for the http router/proxy using --http-stats-server. Using --http-socket (instead of --http) instruct the uWSGI instance to directly speak http