【问题标题】:Locust load testing gives me ChunkedEncodingErrorLocust 负载测试给了我 ChunkedEncodingError
【发布时间】:2020-05-17 05:24:04
【问题描述】:

我正在对我的 django gunicorn nginx 和 postgresql 应用程序进行负载测试。 在大约 1500 个并发用户之后,我的 locust failed 选项卡中出现以下错误:

1   GET /   ChunkedEncodingError(ProtocolError('Connection broken: IncompleteRead(2773 bytes read, 7467 more expected)', IncompleteRead(2773 bytes read, 7467 more expected)))

我已经检查了我所有的访问和错误日​​志(nginx 访问和错误日​​志、gunicorn 日志、syslog、postgresql 日志),但我找不到与上述错误相关的任何内容。

这是 Locust 错误吗?是超时错误吗?我似乎找不到出了什么问题。

这是我的蝗虫文件:

from locust import HttpLocust, TaskSet, task, between
from requests.auth import HTTPBasicAuth


class UserBehavior(TaskSet):

    @task(4)
    def index(self):
        self.client.get("", auth=("user", "pass"))

    @task(4)
    def program(self):
        self.client.get("page1/", auth=("user", "pass"))

    @task(1)
    def artist(self):
        self.client.get("page1/sub-page/", auth=("user", "pass"))

    @task(2)
    def tickets(self):
        self.client.get("page2/", auth=("user", "pass"))


class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    wait_time = between(7, 30)

如您所见,我正在使用基本身份验证来访问该页面。我不知道这是否真的导致了很多请求后的错误。

什么可能导致此错误?提前致谢!

【问题讨论】:

    标签: python postgresql nginx gunicorn locust


    【解决方案1】:

    似乎有人(可能是服务器)正在关闭连接,而 locust 无法告诉你更多信息。

    在 SO 上还有许多关于此异常的其他票证(关于一般的请求库,而不是专门针对 locust),也许其中一个可能会有所帮助。

    您也可以尝试新的 FastHttpLocust,它使用不同的请求库(您很可能仍会收到错误,但可能会显示不同的内容)

    可能值得在服务器端检查您的 ulimits 设置。

    【讨论】:

    • 嘿@Cyber​​wiz,感谢您的回复!我会检查 FastHttpLocust 并希望这会给我一个不同的错误。
    猜你喜欢
    • 2017-04-14
    • 2020-01-02
    • 2019-01-22
    • 2017-08-09
    • 2021-03-18
    • 2019-12-26
    • 2019-09-18
    • 2021-07-29
    • 1970-01-01
    相关资源
    最近更新 更多