-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed as not planned
Labels
OS-windowsperformancePerformance or resource usagePerformance or resource usagetopic-SSLtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
After updating my Python from version 3.11.3 to 3.11.5 on Windows, I noticed unusually high CPU usage when running Python scripts. I ran simple python scripts with requests, and it was more evident when I started running multiple instances.
With Python version 3.11.3, my CPU usage is extremely low even when I have 100's of python instances running concurrently. (< 10%)
I tried other version of Python releases and found out this behavior is apparent for Python versions 3.11.5 and above.
3.11.3 - Normal
3.11.4 - Normal
3.11.5 - High CPU usage
3.12.0rc1 - High CPU usage
3.12.0rc2 - High CPU usage
Tested on both Widows 10 and 11.
Here's an example python code used.
from concurrent.futures import ProcessPoolExecutor
import time
import requests
def worker(name):
while True:
try:
res = requests.get("https://httpbin.org/get")
if res:
print(f"Worker {name}: {res.status_code}")
except:
pass
time.sleep(3)
def start_worker(workers):
executor = ProcessPoolExecutor(max_workers=workers)
for n in range(workers):
executor.submit(worker, n)
time.sleep(1)
executor.shutdown(wait=False)
if __name__ == '__main__':
print("Starting workers ...")
start_worker(20)CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Windows 10, 11
rseuchter-vw
Metadata
Metadata
Assignees
Labels
OS-windowsperformancePerformance or resource usagePerformance or resource usagetopic-SSLtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error