-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1K Request can't be finished in a simultaneous way in aiohttp #3274
Comments
Looking on the stack trace I see that on your box Python is compiled with IPv6, OS declared to support it but actual call fails. Replacement |
@asvetlov Thanks for replying Andrew. I changed the address to Error Log
The above exception was the direct cause of the following exception: Traceback (most recent call last): |
The difference is: in the asyncio example you use 500 concurrent connections. The multiprocessed code starts 10 processes for processing 500 requests each one-by-one. As the result, you have concurrency factor 10. Looks like the server just doesn't support high parallelism. |
@asvetlov should we close this issue? |
Long story short
I set up a server for nlu service use Klein, and i was trying some pressure test using aiohttp. However, the maximum simultaneous seems to be under 100. If i have the number as 1000, then i will receive many ConnectionRefusedErrors.
I also tried another pressure test script using multiproccessing and it worked well, so i'm quite confusing about which part of aiohttp is restricting the performance?
aiohttp Code
multiprocessing Code
Error Log
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "test/pressure_test.py", line 37, in
loop.run_until_complete(future)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "test/pressure_test.py", line 26, in run
responses = await asyncio.gather(*tasks)
File "test/pressure_test.py", line 15, in fetch
async with session.post(url, data=payload) as response:
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 855, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 370, in _request
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 445, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 757, in _create_connection
req, traces, timeout)
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 879, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 862, in _create_direct_connection
req=req, client_error=client_error)
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 829, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:8081 ssl:None [Connect call failed ('::1', 8081)]
Your environment
aiohttp 3.4.4
python 3.6.5
MacOS 10.13.6
The text was updated successfully, but these errors were encountered: