Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jspdown/node-locust
NodeJs load generator for locust
https://github.com/jspdown/node-locust
Last synced: 28 days ago
JSON representation
NodeJs load generator for locust
- Host: GitHub
- URL: https://github.com/jspdown/node-locust
- Owner: jspdown
- Created: 2018-05-12T04:36:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T11:10:19.000Z (almost 6 years ago)
- Last Synced: 2024-04-26T00:42:52.318Z (8 months ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 10
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-locust - node-locust - A Node.js load generator for Locust. (Tools / Workers)
README
# node-locust
## Links
- Locust Website: locust.io
- Locust Documentation: docs.locust.io## Description
`node-locust` is a load generator for locust written in JavaScript
## Usage:
```
# Start locust master
locust --master \
--master-bind-port 5557 \
--host \
--locustfile ./locust-node/dummy.py# Start node client
node-locust --locustfile ./examples/basic.js \
--master-host 127.0.0.1
--master-port 5557
```## Locust file:
```javascript
const { Locust, TaskSet, HTTPClient } = require('node-locust');class UserTasks extends TaskSet {
constructor() {
super();this.http = new HTTPClient({
baseURL: ,
timeout: 2000
}, this.recordSuccess.bind(this),
this.recordFailure.bind(this));this.tasks = [{
task: () => this.getUserInfo(),
weight: 2
}, {
task: () => this.updateUserInfo(),
weight: 1
}];
}async getUserInfo() {
await this.http.request({
method: 'GET',
url: '/users/1'
});
}async updateUserInfo() {
await this.http.request({
method: 'PUT',
url: '/users/1',
body: {
name: 'user-name'
}
});
}
}class MyLocust extends Locust {
constructor() {
super();this.taskSet = new UserTasks();
}
}module.exports = { MyLocust };
```## License
Open source licensed under the MIT license (see LICENSE file for details).