locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
24.84k stars 2.97k forks source link

ConnectionRefusedError and ConnectionResetError judgment abnormal #2743

Closed waitingSunset closed 4 months ago

waitingSunset commented 4 months ago

Prerequisites

Description

version: Locust 2.28.0

i use django write api : just

def api(request): return JsonResponse({"name": "unkown", "hobby": "eat"})

urlpatterns = [ path('api/', api) ]

and write locust file :just:

class HttpUserModel(HttpUser):

host = 'http://127.0.0.1:8000'

wait_time = constant_pacing(1)

@task
def api_task_1(self):
    self.client.get(url='/api/', name='api')

i find many ConnectionResetError or ConnectionRefusedError i user other tools, just jemter, LoadRunner , The problem did not occur

image

Command line

locust -f locustfiie.py

Locustfile contents

no~

Python version

Python 3.11.5

Locust version

version: Locust 2.28.0

Operating system

mac os

cyberw commented 4 months ago

Hi!

A connection reset is being sent by your server to locust. I'm guessing django's logs dont say anything helpful? Are requests failing even at lower load?

You could try FastHttpUser to see if there is any difference.

There shouldnt be any major differences between Locust and Jmeter in connection handling etc, but there could be minor differences in exactly what headers are sent.

cyberw commented 4 months ago

Oh, and one thing: you probably shouldnt be running load generation on the same machine as the application you are testing.

waitingSunset commented 4 months ago