我正在使用Locust测试我的服务器性能。
API和server按照本教程进行了配置:https://medium.com/swlh/python-with-docker-compose-fastapi-part-2-88e164d6ef86
这里是我的蝗虫负载测试代码:
from locust import HttpUser, TaskSet, task, between
class FastApi(TaskSet):
@task(1)
def user_by_name(self):
self.client.get(
url="/user/?first_name=Name"
)
class ApiLoadTest(HttpUser):
tasks = [FastApi]
host = "http://vps1234.vps.ovh.net:8000"
stop_timeout = 20
wait_time = between(1, 3)我设置蝗虫如下:
目前蝗虫的统计数据如下:
服务器(OVH):
F 225
我的问题是,性能低下是因为VPS不太好,还是我在负载测试代码中犯了一些错误?我想知道,要想提高服务器性能,实现大约100 ms的平均响应,是否只有升级VPS才能拥有更多的CPU/RAM/Mbps?
亲切的问候
发布于 2021-01-13 17:07:37
您需要为您的VPS查找性能统计数据来回答这个问题。
在负载测试期间,需要查看的基本内容是CPU、RAM和磁盘的使用情况。
另一个限制可能是客户端机器本身。但是对于1000个用户和以上的脚本来说,应该是可以的。
https://stackoverflow.com/questions/65701963
复制相似问题