Gevent+Flask not running asynchronously on Windows 10, but does on Mac Sierra

169 views
Skip to first unread message

JL

unread,
Sep 26, 2017, 6:54:04 AM9/26/17
to gevent: coroutine-based Python network library
* gevent version: 1.2.2
* Python version: 3.5.4
* Operating System: Windows 10 Home

### Description:

I'm using gevent to deal with a computationally expensive streaming task on flask from tying up the server and preventing it from responding to other requests. Gevent works well under Mac OS sierra allowing me to stream and continue to quickly respond to other requests, but on windows 10 the streaming task is blocking as if gevent wasn't running. There are no error messages, just poor performance.

Running code:
```
from gevent.wsgi import WSGIServer
from webserver import application

http_server = WSGIServer(('', 5000), application)
http_server.serve_forever()
```

*One side-note but potentially related is that I needed to change my routing on my local frontend webapp from 127.0.0.1 to localhost to reach the gevent server. However, when I switched back to using the standard flask app with streaming deactivated, I noticed I had degraded server response rate due to the localhost (DNS lookup?). When I changed the localhost back to the 127.0.0.1 IP, I was able to get the good performance again.

I want to test using gevent with the 127.0.0.1 ip, but can't because of the way gevent interacts with the Windows networking. Already attempted: https://stackoverflow.com/questions/34543443/cant-access-127-0-0-1
without improvement.

Does anyone have any additional clues about what may be going wrong?
Reply all
Reply to author
Forward
0 new messages