aded k6 and script and updated code with better logic and indexing on schema

This commit is contained in:
krizam
2026-10-22 07:50:26 +05:30
parent 4d937b92da
commit 36a7345d26
17 changed files with 1386 additions and 176 deletions
+37
View File
@@ -0,0 +1,37 @@
import http from 'k6/http';
import { check } from 'k6';
const BASE_URL = __ENV.BASE_URL || 'http://app:3000';
export const options = {
stages: [
{ duration: '20s', target: 5 },
{ duration: '20s', target: 10 },
{ duration: '20s', target: 20 },
{ duration: '20s', target: 30 },
{ duration: '20s', target: 40 },
{ duration: '20s', target: 50 },
{ duration: '15s', target: 0 },
],
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<500'],
checks: ['rate>0.99'],
},
};
export default function () {
const endpoints = [
'/users/',
'/teachers/',
'/sessions/available?dateTimestamp=2026-10-25T10%3A00%3A00.000Z',
];
for (const endpoint of endpoints) {
const response = http.get(`${BASE_URL}${endpoint}`);
check(response, {
[`${endpoint}: status 200`]: (r) => r.status === 200,
});
}
}