Skip to content

Instantly share code, notes, and snippets.

@QAInsights
Last active September 11, 2023 00:58
Show Gist options
  • Save QAInsights/d856303859c4a4957ad6b74d6e9c25c2 to your computer and use it in GitHub Desktop.
Save QAInsights/d856303859c4a4957ad6b74d6e9c25c2 to your computer and use it in GitHub Desktop.
import http from 'k6/http';
import { check } from 'k6';
export const options = {
vus: 1,
duration: '300s',
noConnectionReuse: false,
batchPerHost: 20,
};
export default function () {
// Define the number of parallel connections
const numConnections = 20;
const requests = [];
for (let i = 0; i < numConnections; i++) {
requests.push({ method: 'GET', url: 'http://{IP}' });
}
const responses = http.batch(requests);
// Process the responses and perform checks as needed
responses.forEach((res) => {
check(res, {
'Status is 200': (r) => r.status === 200,
// Add more checks as needed
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment