Reputation: 2998
Here is the test script:
from gevent.monkey import patch_all; patch_all()
import subprocess
from subprocess import STDOUT
from tempfile import NamedTemporaryFile
import datetime
with NamedTemporaryFile() as f:
print('Subprocess call at {}'.format(datetime.datetime.now()))
ret = subprocess.check_call(['iptables', '-t', 'mangle', '-L', '-vx'], stdout = f, stderr = STDOUT)
print('Subprocess call end at {}'.format(datetime.datetime.now()))
With patch_all
, the execution time is usually about 600ms, and that without patch_all
is only ~30ms. Therefore, I was wondering what makes this happen, and what can I do to reduce the latency?
Upvotes: 0
Views: 390
Reputation: 2998
Well, it seems that this is a known issue of gevent
itself. Maybe the only thing I can do is to either rollback it to 1.1a1
or wait for 1.3b2
. Another solution could be passing subprocess=False
to patch_all()
Upvotes: 1