Skip to content

Commit

Permalink
chore: remove sleeps in k6 load tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jhandguy committed Oct 3, 2023
1 parent 6edae61 commit 162e6d9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
8 changes: 1 addition & 7 deletions dynamo/k6/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import grpc from 'k6/net/grpc';
import {check, sleep} from 'k6';
import {check} from 'k6';
import {randomString, uuidv4} from 'https://jslib.k6.io/k6-utils/1.4.0/index.js';

export const options = {
Expand Down Expand Up @@ -50,18 +50,12 @@ export default function () {
'create message is valid': (r) => r.message.item.id === id && r.message.item.content === content,
});

sleep(0.5);

check(client.invoke('item.ItemService/GetItem', {id: id}, params), {
'get status is OK': (r) => r.status === grpc.StatusOK,
'get message is valid': (r) => r.message.item.id === id && r.message.item.content === content,
});

sleep(0.5);

check(client.invoke('item.ItemService/DeleteItem', {id: id}, params), {
'delete status is OK': (r) => r.status === grpc.StatusOK,
});

sleep(1);
}
8 changes: 1 addition & 7 deletions gateway/k6/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import http from 'k6/http';
import {check, sleep} from 'k6';
import {check} from 'k6';
import {randomString, uuidv4} from 'https://jslib.k6.io/k6-utils/1.4.0/index.js';

export const options = {
Expand Down Expand Up @@ -44,18 +44,12 @@ export default function () {
'post response body is valid': (r) => r.json().id === id && r.json().content === content,
});

sleep(0.5);

check(http.get(`${url}/message/${id}`, params), {
'get response status is 200': (r) => r.status === 200,
'get response body is valid': (r) => r.json().id === id && r.json().content === content,
});

sleep(0.5);

check(http.del(`${url}/message/${id}`, null, params), {
'delete response status is 200': (r) => r.status === 200,
});

sleep(1);
}
8 changes: 1 addition & 7 deletions s3/k6/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import grpc from 'k6/net/grpc';
import {check, sleep} from 'k6';
import {check} from 'k6';
import {randomString, uuidv4} from 'https://jslib.k6.io/k6-utils/1.4.0/index.js';

export const options = {
Expand Down Expand Up @@ -50,18 +50,12 @@ export default function () {
'create message is valid': (r) => r.message.object.id === id && r.message.object.content === content,
});

sleep(0.5);

check(client.invoke('object.ObjectService/GetObject', {id: id}, params), {
'get status is OK': (r) => r.status === grpc.StatusOK,
'get message is valid': (r) => r.message.object.id === id && r.message.object.content === content,
});

sleep(0.5);

check(client.invoke('object.ObjectService/DeleteObject', {id: id}, params), {
'delete status is OK': (r) => r.status === grpc.StatusOK,
});

sleep(1);
}
5 changes: 2 additions & 3 deletions sql/k6/script.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import http from 'k6/http';
import {check, sleep} from 'k6';
import {check} from 'k6';
import {randomItem, randomString, uuidv4} from 'https://jslib.k6.io/k6-utils/1.4.0/index.js';

export const options = {
setupTimeout: '3m',
rps: 30,
scenarios: {
load: {
executor: 'ramping-arrival-rate',
Expand Down Expand Up @@ -63,8 +64,6 @@ export function setup() {
});

messages.push(message)

sleep(0.03);
}

users.push({
Expand Down

0 comments on commit 162e6d9

Please sign in to comment.