基於python的效能負載測試Locust-1 簡介

來源:互聯網
上載者:User

標籤:大量   通過   uid   安裝   int   title   imp   模擬   中文   

官網: http://locust.io/
GitHub: https://github.com/locustio/locust

簡介

Locust 是一個開源負載測試工具。使用 Python 代碼定義使用者行為,也可以模擬百萬個使用者。
Locust 是非常簡單易用,分布式,使用者負載測試工具。Locust 主要為網站或者其他系統進行負載測試,能測試出一個系統可以並發處理多少使用者。
Locust 是完全基於時間的,因此單個機器支援幾千個並發使用者。相比其他許多事件驅動的應用,Locust 不使用回調,而是使用輕量級的處理方式 gevent。

 

 

 

特性
  • 使用純 Python 代碼編寫使用者測試情境;不需要 UIs 或者 XML
  • 分布式&可伸縮 - 支援成千上萬的使用者
  • 基於 Web 的 UI
  • 可以測試任意系統;雖然 Locust 是面向 Web 的,但是也可以測試其他任意的系統

##安裝:

pip install locustio

##範例程式碼:

from locust import HttpLocust, TaskSet, taskclass WebsiteTasks(TaskSet):    def on_start(self):        self.client.post("/login", {            "username": "test_user",            "password": ""        })    @task    def index(self):        self.client.get("/")    @task    def about(self):        self.client.get("/about/")class WebsiteUser(HttpLocust):    task_set = WebsiteTasks    min_wait = 5000    max_wait = 15000
其他資料

python模組介紹-locustio:效能測試工具locustio中文文檔

背景

我們研究了現有的解決方案,都不符合要求。比如Apache JMeter和Tsung。JMeter基於UI操作,容易上手,但是通過UI點擊進行測試情境的配置讓它脫離了編程的樂趣。其次JMeter基於線程,要類比數千使用者幾乎不可能。 Tsung基於Erlang,能類比上千使用者並易於擴充,但它它基於XML的DSL,描述情境能力弱,且需要大量的資料處理才知道測試結果。

無論如何,我們試圖通過Locust來解決這些問題,希望以上問題都不會成為Locust的痛點。

也許你會說我們試圖撓到癢處。希望其他人和我們一樣認為這是件有意義的事情。

作者
  • Jonatan Heyman (@jonatanheyman on Twitter)
  • Carl Bystr?m (@cgbystrom on Twitter)
  • Joakim Hamrén (@Jahaaja on Twitter)
  • Hugo Heyman (@hugoheyman on Twitter)

基於python的效能負載測試Locust-1 簡介

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.