mirror of
https://github.com/sol1/rustguac.git
synced 2026-09-10 09:35:45 +00:00
74f67d0ed9
Bench suite: k6 load tests, Python Guacamole protocol client, Vault population scripts, server metrics collector, xrdp target setup. Results from 100 concurrent RDP session test on 16 GB server: - rustguac: 45 MB RSS, 9 threads — not the bottleneck - guacd/FreeRDP: 15.8 GB RSS (~158 MB/session) — primary bottleneck - Zero errors, p95 session create 98ms, p95 WS connect 63ms - Address book: 982 entries loads in 2.4s (sequential Vault reads)
70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
// k6 address book latency test.
|
|
// Measures GET /api/addressbook response time at various entry counts.
|
|
//
|
|
// Usage:
|
|
// k6 run --env API_KEY=rgu_xxx \
|
|
// --env BASE_URL=https://10.10.50.51:8089 \
|
|
// bench/k6-addressbook.js
|
|
//
|
|
// Run after populating Vault with populate-vault.sh at different counts
|
|
// to measure how response time scales with entry count.
|
|
|
|
import http from 'k6/http';
|
|
import { check, sleep } from 'k6';
|
|
import { Trend, Counter } from 'k6/metrics';
|
|
|
|
const abListDuration = new Trend('ab_list_all_ms');
|
|
const abEntryCount = new Counter('ab_total_entries');
|
|
const abFolderCount = new Counter('ab_total_folders');
|
|
|
|
export let options = {
|
|
scenarios: {
|
|
// Single user, repeated requests
|
|
ab_serial: {
|
|
executor: 'constant-vus',
|
|
vus: 1,
|
|
duration: '60s',
|
|
},
|
|
},
|
|
insecureSkipTLSVerify: true,
|
|
};
|
|
|
|
const API_KEY = __ENV.API_KEY;
|
|
const BASE_URL = __ENV.BASE_URL || 'https://localhost:8089';
|
|
|
|
export default function () {
|
|
const res = http.get(`${BASE_URL}/api/addressbook`, {
|
|
headers: { 'X-API-Key': API_KEY },
|
|
tags: { name: 'list_all' },
|
|
});
|
|
|
|
check(res, { 'status 200': (r) => r.status === 200 });
|
|
abListDuration.add(res.timings.duration);
|
|
|
|
if (res.status === 200) {
|
|
try {
|
|
const data = JSON.parse(res.body);
|
|
const folders = data.folders || [];
|
|
let totalEntries = 0;
|
|
folders.forEach(function (f) {
|
|
totalEntries += (f.entries || []).length;
|
|
});
|
|
abFolderCount.add(folders.length);
|
|
abEntryCount.add(totalEntries);
|
|
} catch (e) {}
|
|
}
|
|
|
|
sleep(1);
|
|
}
|
|
|
|
// Also run a concurrent-user variant
|
|
export function concurrent() {
|
|
const res = http.get(`${BASE_URL}/api/addressbook`, {
|
|
headers: { 'X-API-Key': API_KEY },
|
|
tags: { name: 'list_all_concurrent' },
|
|
});
|
|
check(res, { 'status 200': (r) => r.status === 200 });
|
|
abListDuration.add(res.timings.duration);
|
|
sleep(0.5);
|
|
}
|