This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Irvin.Probst
Recipients Irvin.Probst, neologix, pitrou, sbt, vstinner
Date 2014-02-07.14:53:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391784832.03.0.100782981292.issue20540@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-02-07 14:53:52Irvin.Probstsetrecipients: + Irvin.Probst, pitrou, vstinner, neologix, sbt
2014-02-07 14:53:52Irvin.Probstsetmessageid: <1391784832.03.0.100782981292.issue20540@psf.upfronthosting.co.za>
2014-02-07 14:53:52Irvin.Probstlinkissue20540 messages
2014-02-07 14:53:51Irvin.Probstcreate