Irvin Probst added the comment:

FWIW, according to your comments I tried a quick and dirty fix in my code as I 
can't wait for a new Python release to make it work:

The do_stuff function now does:

"""
def do_stuff():
    client=make_client('',6666, b"foo")
    data_proxy=client.get_proxy()

    #make a dummy request to get the underlying
    #fd we are reading from (see bug #20540)
    c=data_proxy.good([1,2],[3,4])
    fd=data_proxy._tls.connection._handle

    #setting TCP_NODELAY on 3.3.x should fix the delay issue until a new release
    sock=socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM)
    sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)

    for i in range(10):
        t_s=time.time()
        c=data_proxy.good([1,2],[3,4])
        print(time.time()-t_s)
    print(c)
"""

I'm now down to 0.04s per request instead of ~0.08s, I guess the remaining 
delay comes from the server side socket which has not been affected by the 
TCP_NODELAY on the client side.

Regards.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20540>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to