???????????????????????????????ab??locust??????
?????????????demo??Σ??????????????????????????????趨??500????20????
???????????
????ab
????ab??????Apache HTTP server benchmarking tool
????ab??apache????????????????ab??????????????????apache??????????????????????????????????????????????????????????????nginx??tomcat??IIS???
????locust
????locust??????????????????????python?????????????????
????locust??web ui???棬?????????????????????????
???????????
???????ab????
???????????????????????www.example.com
?????????????????????? /index
????ab -n 500 -c 20 https://www.example.com/  #500 ?????20 ????????n?????????????c?????????
??????????????????????ab??????????ο??? Web???????????????ApacheBench??ab?????
???????locust????
????locust?????python????????????pip????? pip install locustio ?????????? locust --help
??????????? ?????? ??д??????????
????vim locustfile.py
from locust import Locust?? TaskSet?? task
class MyTaskSet(TaskSet):
min_wait = 5000
max_wait = 15000
@task
def task1(self):
self.client.get("/")
'''
@task
def task2(self):
self.client.get("/index")
'''
class MyLocust(Locust):
task_set = MyTaskSet
????locust -f locustfile.py --host=http://www.example.com
??????????127.0.0.1:8089????????????

???????????????????п?????.??locust?д???session??????:
????The HttpSession instance will preserve cookies between requests so that it can be used to log in to websites and keep a session between requests.