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.

Title: Very slow upload with http.client on Windows when setting timeout
Type: performance Stage:
Components: IO, Library (Lib), Windows Versions: Python 3.10, Python 3.9, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ivknv, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-06-11 17:49 by ivknv, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg319323 - (view) Author: Ivan Konovalov (ivknv) Date: 2018-06-11 17:49
Normally, when I upload files using the PUT request I get upload speed of about 100 Mb/s.
But as soon as I set the timeout, the speed drops to about 4 Mb/s (can vary depending on the server):

# Running on Windows 10, using Python 3.6.5

from io import BytesIO
import http.client

def upload(timeout=None):
    test_file = BytesIO(b"0" * 15 * 1024**2)

    if timeout is not None:
        conn = http.client.HTTPConnection("", timeout=timeout)
        conn = http.client.HTTPConnection("")

    conn.request("PUT", "/put", body=test_file)


upload(25) # Painfully slow
upload() # Pretty fast

This problem seems to only affect Windows.
Date User Action Args
2022-04-11 14:59:01adminsetgithub: 78019
2021-10-21 14:52:53ivknvsetversions: + Python 3.9, Python 3.10
2018-06-11 17:49:58ivknvcreate