If you use http request or something using socket in gevent spawn,
you should make a limit of file open count. use python resource. like this,
import resource
resource.setrlimit(resource.RLIMIT_NOFILE, (1024, 1024))
Otherwise, It will consume all your memory as much as it can by consuming all file count that it can consume as specified on limit.conf (/etc/security/limit.conf)
But requests still consumes a lot of memory.. I just decided to use tornado instead of flask+gevent+requests
'python' 카테고리의 다른 글
gevent monkey patch all, code location (0) | 2017.09.14 |
---|---|
flask with gevent monkey patch all (0) | 2017.07.26 |
websocket with gunicorn (0) | 2017.03.03 |
gunicorn vs uwsgi (0) | 2017.01.20 |
flask async response (0) | 2017.01.04 |