locust

关于怎么下载安装locust,网上已经有很多啦

我就大致说一下我的坑吧

我是一个神奇的人,基本上安装什么东西,没有坑,我也会弄出坑

from locust import HttpLocust, TaskSet, task

class UserBehavior(TaskSet):
    def on_start(self):
        """ on_start is called when a Locust start before any task is scheduled """
        self.login()

    def login(self):
        self.client.post("/login", {"username":"ellen_key", "password":"education"})#post方法需要放入请求头之类的内容

    @task(2)
    def index(self):
        self.client.get("/")# get方法只需要加入地址就可以

    @task(1)#分权重
    def profile(self):
        self.client.get("/profile")

class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait = 5000  #默认值,一般情况自带有
    max_wait = 9000
   

是这样子的,你在你的电脑装入xshell等一些可以连接服务器的软件,想把服务器虚拟机作为locust的测试A端,那么你需要在服务器上安装locust等

安装完启动web网页时,注意是否有开防火墙

开启防火墙,打不开本机的浏览器

防火墙的相关操作如下:

service iptables status  

# 停止防火墙

service iptables stop  

# 启动防火墙

service iptables start  

# 重启防火墙

service iptables restart  

# 永久关闭防火墙

chkconfig iptables off  

# 永久关闭后重启

chkconfig iptables on  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值