[Bug 2091733] Re: Performance improvement for concurrent SSL connections

Mauricio Faria de Oliveira 2091733 at bugs.launchpad.net
Fri Dec 20 17:41:49 UTC 2024


$ cat ./test-https-concurrent.py
#!/usr/bin/python3
import requests
import concurrent.futures
import time
from statistics import mean, median

def run_https_get():
    return requests.get('https://example.com').content

def run_https_get_concurrent():
    with concurrent.futures.ThreadPoolExecutor(max_workers=30) as executor:
        futures = { executor.submit(run_https_get): i for i in range(100) }
        for future in concurrent.futures.as_completed(futures, timeout=300):
            pass
    return 'Finished'

def measure_run_time():
    start = time.time()
    run_https_get_concurrent()
    stop = time.time()
    ms = int((stop - start) * 1000)
    return ms

if __name__ == "__main__":
    times = []
    for i in range(10):
        ms = measure_run_time()
        times.append(ms)
        print("Run: %d, Time: %d ms" % (i, ms))
    print("Mean: %s ms, Median: %s ms" % (mean(times), median(times)))

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-urllib3 in Ubuntu.
https://bugs.launchpad.net/bugs/2091733

Title:
  Performance improvement for concurrent SSL connections

Status in python-urllib3 package in Ubuntu:
  Invalid
Status in requests package in Ubuntu:
  Fix Released
Status in python-urllib3 source package in Jammy:
  In Progress
Status in requests source package in Jammy:
  In Progress
Status in python-urllib3 source package in Noble:
  Invalid
Status in requests source package in Noble:
  In Progress

Bug description:
  WIP.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-urllib3/+bug/2091733/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list