wrk icon indicating copy to clipboard operation
wrk copied to clipboard

Requests in Keep-Alive connections are not ACKed correctly

Open kolbma opened this issue 3 years ago • 2 comments

My wrk is from Linux distribution and RPM has version 4.0.2 wrk --version just ouputs the help.

Please have a look at my comment here...
https://github.com/SergioBenitez/Rocket/issues/2062#issuecomment-1011247208

To summarize: When the server has enabled keep-alive http1.1 after some requests in the connection wrk ACKs the received data with over 40ms delay.

In this image the 1st marked ACK (which is for the 3rd request in connection) is without delay, any later is with delay.
wrk got called with wrk -c 2 -t 2 <url>

wrk_c2_t2_4097

kolbma avatar Jan 12 '22 17:01 kolbma

I have encountered the same bug. This can be reproduced by running this in one terminal:

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install django
$ cat <<EOF >settings.py
from django.http import HttpResponse
from django.urls import re_path

def view(request):
    r = HttpResponse('')
    r.headers["Content-Length"] = '0'
    return r

ROOT_URLCONF = 'settings'
ALLOWED_HOSTS = ['127.0.0.1']
urlpatterns = [re_path('', view)]
EOF
$ DJANGO_SETTINGS_MODULE=settings python3 -m django runserver

And this in another:

$ wrk -c1 -t1 http://127.0.0.1:8000/

The result shows a latency of 44 ms. However, with:

$ wrk -c1 -t1 -H 'Connection: close' http://127.0.0.1:8000/ 

We get 0.5 ms of latency.

So, basically, use -H 'Connection: close' or something other than wrk if you want reliable benchmarks.

qsantos avatar Jan 13 '24 20:01 qsantos

See also: https://vorner.github.io/2020/11/06/40-ms-bug.html

qsantos avatar Jan 13 '24 21:01 qsantos