Locust使用點滴

博客原文
安利一篇我翻譯的國外大牛的神經網絡入門文章

locust的基本使用方法可以直接參考官方文檔
這裏主要記下一些使用時候遇到的細節需要注意的地方

1. –no-web的使用

參考官方文檔,寫了一個簡單測試,但是運行時候總是無法發起請求:

(locust) liujinliu@liujinliu-OptiPlex-7010:~/code/servertest/locust$ locust --host=http://{ip}:{port} --print-stats
/home/liujinliu/venv/locust/local/lib/python2.7/site-packages/locust/rpc/__init__.py:6: UserWarning: WARNING: Using pure Python socket RPC implementation instead of zmq. If running in distributed mode, this could cause a performance decrease. We recommend you to install the pyzmq python package when running in distributed mode.
  warnings.warn("WARNING: Using pure Python socket RPC implementation instead of zmq. If running in distributed mode, this could cause a performance decrease. We recommend you to install the pyzmq python package when running in distributed mode.")
[2017-01-14 18:23:46,358] liujinliu-OptiPlex-7010/INFO/locust.main: Starting web monitor at *:8089
[2017-01-14 18:23:46,358] liujinliu-OptiPlex-7010/INFO/locust.main: Starting Locust 0.7.5
 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                              0     0(0.00%)                                       0.00

 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                              0     0(0.00%)                                       0.00

 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                              0     0(0.00%)                                       0.00

 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                              0     0(0.00%)                                       0.00

^C[2017-01-14 18:23:53,095] liujinliu-OptiPlex-7010/ERROR/stderr: KeyboardInterrupt
[2017-01-14 18:23:53,095] liujinliu-OptiPlex-7010/INFO/locust.main: Shutting down (exit code 0), bye.
 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                              0     0(0.00%)                                       0.00

Percentage of the requests completed within given times
 Name                                                           # reqs    50%    66%    75%    80%    90%    95%    98%    99%   100%
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------

在最後加上--no-web的參數就好了
即正確寫法是這樣:

locust --host=http://{ip}:{port} --print-stats --no-web
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章