Skip to content

Connection Error 104 when swarming the server #1918

@rodrigo-roth

Description

@rodrigo-roth

So i have a project that was made back in the days using Flask, and I wanted to test it with FastAPI.

I made the changes, and it worked normally, the problem occured when I made a swarm test using Locust.

With Flask, I got 0 failures in 10.000 requests, with 1.000 users at the same time.

With FastAPI, I got 387 failures in 10.000 requests, with 1.000 users at the same time.

The error is:

ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')),)

I started my app with the following command:

gunicorn -w 3 -k uvicorn.workers.UvicornH11Worker -b 0.0.0.0:5005 main:app --timeout 200

Anyone knows why I got this connection error with FastAPI and not with Flask?

This is my main.py FastAPI file:
fast1

This is the service that was tested:
fast2

This is the results that I got with FastAPI:
fast3

This is the results that I got with Flask:
fast4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions