aioquic icon indicating copy to clipboard operation
aioquic copied to clipboard

client-server connection speed is very slow!

Open Hasan-aga opened this issue 3 years ago • 3 comments

I am running the example client and server and downloading a 5 MB video from the server, it works but it takes a very long time (over a minute) I am doing this in a network emulator (Mininet) where in other experiments I can get 1 Gbps speed, I experimented with changing the values of the following arguments at the client side:

  1. --max-data
  2. --max-stream-data One time the speed went up with --max-data 10 but when I tried it the next day it did not work.

What could be the cause of this?

here is the app that the server is serving:

#
# send video for http3_server.py
#

from urllib.parse import urlencode

from starlette.applications import Starlette
from starlette.responses import PlainTextResponse, Response, StreamingResponse
from starlette.routing import Route

from starlette.types import Receive, Scope, Send


from pathlib import Path

async def hello(request):
    """
    send 'Hello World' to client
    """
    print("sending 'hello world' to client...")
    return PlainTextResponse("Hello World")

async def video(request):
    """
    send video to client over http3
    """
    print("sending video...")
    path = Path("./examples/vid.mp4")
    file_size = path.stat().st_size
    print(file_size/1000, "kBytes")
    if(file_size == 0):
        print("error, file is missing.")
    videoFile = path.open("rb")
    response = StreamingResponse(videoFile, media_type='video/mp4')
    return response





starlette = Starlette(
    routes=[
        Route("/video", video),
        Route("/hello", hello)
    ]
)


async def app(scope: Scope, receive: Receive, send: Send) -> None:
    await starlette(scope, receive, send)

Hasan-aga avatar Feb 02 '22 20:02 Hasan-aga

Sorry, no idea you're going to have to do some more digging yourself. Interoperability tests don't show aioquic to be that slow:

https://interop.seemann.io/

jlaine avatar Feb 03 '22 07:02 jlaine

I do not think so. The throughput in https://interop.seemann.io/ is restricted in 10Mbps link.

Initially, I consider that the asyncio UDP contributes to the slow speed, and patched https://github.com/python/cpython/pull/91488 to CPython, so asyncio UDP provides at least 100 Mbps throughput when transferring a large file.

Subsequently, I wrote a script as simple as possible in order to measure transfer speed in https://gist.github.com/msoxzw/8c510b44bf8d9f39ddf181e77a481957 . This naive script shows approximately 10 Mbps whether above patch is applied or not.

msoxzw avatar Apr 20 '22 20:04 msoxzw

Great, I look forward to your PR which delivers a 10x improvement.

jlaine avatar Apr 20 '22 22:04 jlaine

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 19 '22 03:08 github-actions[bot]