> My bad, we use http-socket in prod and for some reason I put http locally
> and checked only our prod settings.
>
> Try again...
>
> With no-defer-accept:
>
> $ uwsgi --http-socket :9090 --wsgi-file test.py --single-interpreter
> --master --die-on-term --enable-threads --pyhome ~/tmp/testenv --harakiri
> 28 -l 3 --no-defer-accept
>
> $ time telnet localhost 9090
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /test HTTP/1.1
>
> HTTP/1.1 200 OK
> Content-Type: text/html
>
> Hello WorldConnection closed by foreign host.
>
> real    2m22.434s
> user    0m0.003s
> sys     0m0.006s
>
> All requests responded (waiting as long as necessary) except one which
> ended with:
>
> curl: (56) Recv failure: Connection reset by peer
>
> after 1min46
>
>
> Without --no-defer-accept:
>
> $ uwsgi --http-socket :9090 --wsgi-file test.py --single-interpreter
> --master --die-on-term --enable-threads --pyhome ~/tmp/testenv --harakiri
> 28 -l 3
>
> $ time telnet localhost 9090
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /test HTTP/1.1
>
> Connection closed by foreign host.
>
> real    1m17.867s
> user    0m0.000s
> sys     0m0.008s
>
> and worked another time:
>
> $ time telnet localhost 9090
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /test HTTP/1.1
>
> HTTP/1.1 200 OK
> Content-Type: text/html
>
> Hello WorldConnection closed by foreign host.
>
> real    1m59.701s
> user    0m0.000s
> sys     0m0.004s
>
>
> So either way, uwsgi still accepts the connection.
>
>

I fear you are testing in the wrong way. What you describe is basically
impossible, event with defer-accept the amount of manageable connections
is always limited (by the kernel memory).

With defer-accept you tell the kernel to pass the request to the socket
until a packet arrives, without defer-accept the connection (if there are
slots in the listen queue) the request is passed to the socket and first
free worker accept() it.

Best way, would be attaching a strace to the worker before running the
test (in uWSGI only workers accept() requests, there is no arbitrer or
similar, unless you add a proxy)

You should:

spawn a single worker with --http-socket and listen queue of 2 and strace
it, open at least 10 curl requests (the listen queue size is not precise
for various reasons, there are generally a couple more slots allocated) to
the app (the should generate a loop). Open a telnet session, without
defer-accept the connection should timeout or close (based on kernel
settings)

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to